@mocanvas/mocanvas · function
declare function getHitShapeOnCanvasPointerDown(editor: Editor, hitLabels?: boolean): UnknownShape | undefinedThe shape under the pointer, as a click should resolve it.
Not the same question as editor.getShapeAtPoint, which answers about
geometry. This one answers about *intent*, and differs in three ways that
each come from how a click reads to a person:
- a filled shape is hit anywhere inside it, an unfilled one only on its edge, because clicking through the middle of an outline is how you select what is behind it; - a locked shape is not hit at all; - a frame is hit on its edge and its heading, not across its interior, so a click inside a frame reaches what is in the frame.
hitLabels widens it to count a shape's text label as part of the shape,
which is what a double-click-to-edit needs.
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.