sammycage / lunasvg

lunasvg is a standalone SVG rendering library in C++
MIT License
818 stars 115 forks source link

hit-testing? (mouse interaction) #134

Open g40 opened 1 year ago

g40 commented 1 year ago

A very useful library. Thank you.

I'm looking at an application where the UI is specified in SVG with interactive elements (sliders, buttons). See example below, rendered with lunasvg.

There does not appear to be any API for getting the bounding box of an element. I'd have thought a simple mapping of element ID to a bounding rectangle that was optionally generated when rendering would do the trick. And without compromising the desire to keep the render tree implementation internal? Does this make sense?

image

P.S. Did https://github.com/sammycage/lunasvg/issues/71 ever get implemented?