@mocanvas/editor · function

getCursor

declare function getCursor(cursor: TLCursor | TLCursorType, rotation?: number, color?: string): string

The CSS cursor value for a cursor record.

Directional cursors are stored as a name plus a rotation, because a rotated shape's handles need cursors at arbitrary angles and CSS has only eight names. This renders the rotated ones as an inline SVG data URL and passes the rest through as the plain CSS keyword, which keeps the common case free.

SEMANTICS-ASSUMED: the artwork. The docs pin the *names* (TL_CURSOR_TYPES) but not the images; these are drawn to the same conventions the platform cursors use — a white-outlined black glyph, 32×32, hot spot at the centre — so a custom cursor sits alongside the native ones without looking foreign.

Mentioned here

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.