xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Selva <selvakumar_...@yahoo.co.in>
Subject Finding ZoomedIn/ZoomedOut element’s ‘x’ and ‘y’ attribute
Date Tue, 03 Apr 2007 01:55:49 GMT

Hi All,

I am trying to find the ZoomedIn/ZoomedOut element’s ‘x’ and ‘y’ attributes
values. But I couldn’t get the exact position. It returns the normal
position without zoomin/zoomout. I am using the following way to get the ‘x’
and ‘y’ attributes.

.
.
.
DOMMouseEvent elEvt = (DOMMouseEvent)event;
String cName = “BG_Rectangle”;
Element cElement = canvas.getSVGDocument().getElementById(cName);
SVGPoint cRect = localPt(cElement, (int)elEvt.getClientX(),
(int)elEvt.getClientY());
.
.
.
private SVGPoint localPt(Element elem, int x, int y) {
 	SVGMatrix mat = ((SVGLocatable)elem).getScreenCTM();
          	SVGMatrix imat = mat.inverse();
                SVGPoint cPt =
_svgGraphView.getSVGDocument().getRootElement().createSVGPoint();
          	cPt.setX(x);
          	cPt.setY(y);
          	cPt = cPt.matrixTransform(imat);
          	return cPt;
   }

Please let me know, if there is any problem in my code to get the attributes
values after ZoomIn/ZoomedOut?

Thanks,
Selva
-- 
View this message in context: http://www.nabble.com/Finding-ZoomedIn-ZoomedOut-element%E2%80%99s-%E2%80%98x%E2%80%99-and-%E2%80%98y%E2%80%99-attribute-tf3509394.html#a9802422
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Mime
View raw message