diff --git a/docs/class-definitions.md b/docs/class-definitions.md index 4067f76a..c2be9144 100644 --- a/docs/class-definitions.md +++ b/docs/class-definitions.md @@ -390,7 +390,7 @@ Handles tracking of member cursors within a space. Inherits from [EventEmitter]( Set the position of a cursor. This will emit a `CursorUpdate` event. If a member has not yet entered the space, this method will error. -`CursorUpdate` is an object with 2 properties. `position` is an object with 2 required properties, `x` and `y`. These represent the position of the cursor on a 2D plane. A second property, `data` can passed. This is an object of any shape and is meant for data associated with the cursor movement (like drag or hover calculation results): +A `CursorUpdate` is an object with 2 properties. `position` is an object with 2 required properties, `x` and `y`. These represent the position of the cursor on a 2D plane. A second optional property, `data` can also be passed. This is an object of any shape and is meant for data associated with the cursor movement (like drag or hover calculation results): ```ts type set = (update: { position: CursorPosition, data?: CursorData }) @@ -420,7 +420,7 @@ const lastPositions = space.cursors.getAll(); ### on -Listen to cursor update events. See [EventEmitter](/docs/usage.md#event-emitters) for overloading usage. +Listen to `CursorUpdate` events. See [EventEmitter](/docs/usage.md#event-emitters) for overloading usage. Available events: diff --git a/docs/usage.md b/docs/usage.md index 782b8f73..a348300c 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -297,7 +297,7 @@ The listener will be called with a `CursorUpdate`: } ``` -To set cursor updates, first enter the space: +To set the position of a cursor and emit a `CursorUpdate`, first enter the space: ```ts space.enter(); @@ -323,7 +323,7 @@ window.addEventListner('mousemove', ({ clientX, clientY }) => { To retrieve the initial position and data of all cursors within a space, you can use the `space.cursors.getAll()` method. This returns an object keyed by `connectionId`. The value is the last `cursorUpdate` set by the given `connectionId`. -Example of calling `getAll` to return all cursor positions: +Example of calling `getAll()` to return all cursor positions: ```ts const lastPositions = await space.cursors.getAll();