Thanks Marc - seems I will need to stick with what I have then.

Currently I am pulling all object info from the SVG into an array and assigning quadrant positions.

Then do best guess by relative quadrant of mouse click position - works fine, but feels sloppy :)


On 17/1/22 8:55 pm, Marc Weustink via lazarus wrote:
I'm afraid there is no easy solution for that. SVGs are rendered from the first element to the last, where ever element (atleast in theory) can be a part of a given pixel. SVG elements do have a x,y,width,height but they may also be part of one or more transformations. To give you an idea, the (browser)app I'm currently working on displays several object, where every object has an origin(x,y) of 0,0 and they are finally placed by translations. The easiest way (if you are in a browser context) is to add an onclick handler to your elements of interest.

Marc



On 16-1-2022 23:34, Steve Gatenby via lazarus wrote:
Not sure if this is the right place to ask about this one -

I am using the BCSVGViewer from bgra controls - for SVG viewing obviously :)

Would anybody know if there is a method to retrieve the object (within the svg) at specified x,y ?

or is it possible to use embedded links within the svg ?

I am looking to find which object has been clicked on within the svg to create a 'clickable' map

Any suggestions on a better place to post this also appreciated

Regards SteveG

--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to