demo · v136
SVG DOMPointInit
Move the mouse over the canvas. isPointInFill() and isPointInStroke() now accept plain {x, y} dictionaries (DOMPointInit), not just full SVGPoint objects.
Probing…
Hover — tests use el.isPointInFill({x, y}), the new DOMPointInit form. Blue star = fill region, rose ring = stroke region.
cursor (SVG coords)—
isPointInFill—
isPointInStroke—
charNumAtPosition with DOMPointInit
getCharNumAtPosition({x,y})—
the code
// Pre-136: had to construct a real SVGPoint via svg.createSVGPoint()
const pt = svg.createSVGPoint();
pt.x = e.offsetX; pt.y = e.offsetY;
path.isPointInFill(pt);
// 136+: pass a DOMPointInit dictionary
path.isPointInFill({ x: e.offsetX, y: e.offsetY });
text.getCharNumAtPosition({ x: e.offsetX, y: e.offsetY });
see also
- SVG DOMPointInit — feature index
- ChromeStatus entry
- SVG 2 spec