# Anchor

Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.

### Constructors

- - new Anchor(Document doc, Number row, Number column)

Creates a new `Anchor` and associates it with a document.

Creates a new `Anchor` and associates it with a document.

#### Arguments

doc | Document | Required. The document to associate with the anchor
row | Number | Required. The starting row position
column | Number | Required. The starting column position

### Events

- - Anchor.on("change", function( Object e))

Fires whenever the anchor position changes.

Fires whenever the anchor position changes.

Both of these objects have a `row` and `column` property corresponding to the position.

Events that can trigger this function include `setPosition()`.

#### Arguments

e

Object

Required. An object containing information about the anchor position. It has two properties:

- `old`: An object describing the old Anchor position
- `value`: An object describing the new Anchor position

### Methods

- - Anchor.detach()

When called, the `'change'` event listener is removed.

When called, the `'change'` event listener is removed.

- - Anchor.getDocument()
  - - Document

Returns the current document.

Returns the current document.

- - Anchor.getPosition()
  - - Object

Returns an object identifying the `row` and `column` position of the current anchor.

Returns an object identifying the `row` and `column` position of the current anchor.

- - Anchor.onChange()
  - Undocumented

- - Anchor.setPosition(Number row, Number column, Boolean noClip)

Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.

Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.

#### Arguments

row | Number | Required. The row index to move the anchor to
column | Number | Required. The column index to move the anchor to
noClip | Boolean | Required. Identifies if you want the position to be clipped