@mocanvas/editor · function

isPointInShape

declare function isPointInShape(editor: Editor, shape: ShapeRef, point: VecLike, opts?: TLPointInShapeOptions): boolean

Whether a page-space point falls on a shape, honouring what clips it.

The clip check is the reason to call this instead of the shape's geometry directly: a shape scrolled out of its frame is still *there* geometrically, and hit-testing it would let a click land on something the user cannot see.

Unlike Editor.getShapeAtPoint this asks about one named shape and consults no z-order, so it is the right test for "is the pointer still on the shape I am dragging".

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.