xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Jolif <cjo...@ilog.fr>
Subject Re: how to get real coordinates
Date Tue, 27 Mar 2001 14:06:34 GMT
Hello Carlos,

The screen coordinates are according to your screen, the client
coordiantes are according to the client area i.e. the SVG Canvas in the
Batik viewer. If there is no transformation, the client coordinates
should match the coordinates of the object. But in most cases you have
transformations and in this case, to get local coordinates to the SVG
graphic object you will need to transform the client coordinates with
the CTM. Unfortunately for the time being, the Batik SVG DOM doesn't yet
implement the useful methods (getCTM()...) to do this transformation.

Carlos Sanchez wrote:
> 
> I have an SVG file with the following attributes..
> 
> <svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
> 
> inside of it I have a path defined as <path id="pathGraph"
> cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
> stroke-width:0.2" onmouseover="annotationon(evt)"
> onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35 703.22
> L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
> L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
> 
> As I move the mouse I want to get the X and Y coordinate to and match it
> with the values in the path. However, in the java script the
> evt.getClientX() does not return the expected value. (it changes as I a
> resize the browser) I also tried evt.screenX, but it did not work either.
> 
> Can any one tell me how I can get the real coordinates (path) regardless of
> the size and viewBox
> 
> Thx.
> 
> Carlos
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org

-- 
Christophe

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message