I have 3 SVG elements, One contains the other two, like this:
<svg id="main" width="100%" height="100%">
<svg id="output" width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="xMinyMin">(content)</svg>
<svg id="gui" width="100%" height="100%">(content)</svg>
</svg>
The 'output' SVG has a ViewBox set and scales proportionally.
The 'gui' SVG element and doesn't scale.
In the contents of the 'output' I want the user to click on them, and show another element on the 'gui' SVG, in the same position of the clicked element.
When I use the element.getBBox() from the 'output' SVG, the coordinates it gives me are correct for the 'output' SVG, but I need them translated for the 'gui' SVG.
Right now, I calculate the size of the SVG based on the div that contains it, retrieve the viewBox of the 'output' SVG and calculate the correct values based on those two things (difference between the viewBox size and the SVG size).
I would like to know if it's possible to get the SVG size directly, or if there's a way to translate SVG coordinates to screen coordinates.
Thank you,