@mocanvas/editor · function

isCursorInViewport

declare function isCursorInViewport(source: TLCursorViewportSource): boolean

Whether the pointer is currently over the canvas.

Used to decide where a paste lands and whether an edge-scroll should start: both should follow the pointer when it is on the canvas, and fall back to the centre of the viewport when it is not — the pointer's last known position is stale and possibly far off screen once it has left.

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.