SVG - From Window coordinates to ViewBox coordinates

Posted by user353072 on Stack Overflow See other posts from Stack Overflow or by user353072
Published on 2010-05-28T16:10:50Z Indexed on 2010/05/28 16:11 UTC
Read the original article Hit count: 307

Filed under:
|
|

Hi,

Basically I have an svg "SecondSVG" into an svg "FirstSVG" into an svg "MainSVG".Every svg has its own ViewBox. This page can be loaded anywhere on the screen by another page.
So basically how can i find the screen x for viewBox for"SecondSVG" knowing that this svg can be loaded basically anywhere based on the calling page? event.clientX gives myself the x coordinate for the screen. If I don't know the coordinate for ViewBox of "SecondSVG" then how can I find out the x coordinate inside the ViewBox of "SecondSVG"?

I am using Firefox 3.6.3 and I do have an event object from which I can extract clientX, clientY and other coordinates that are relative to the screen. However what I need are the coordinates inside the ViewBox.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox