demo · v136

Method Explorer

Click or drag anywhere on the canvas: the cursor position becomes a DOMPointInit dictionary { x, y } and feeds three SVG hit-test methods at once — isPointInFill(), isPointInStroke(), and getCharNumAtPosition() on a text element. The "true" badges tell you which method matched.

DOMPointInit hit testing

cursor: (—, —) — click any shape

circle.isPointInFill({ x, y })

—

rect.isPointInStroke({ x, y })

—

path.isPointInStroke({ x, y })

—

text.getCharNumAtPosition({ x, y })

—

see also