On Tue, 2008-01-08 at 16:32 +0100, massimo citterio wrote:
> On Sat, 2008-01-05 at 13:25 +0100, Luca Piccarreta wrote:
> > Actually here I'm using SVG 1.2, so perhaps this is not possible in
> > SVG 1.1
> 
> > In the following code getElementCoords and getClientCoords (definitely these
> > names are not so clear) convert from OS coordinates to SVG scene 
> > coordinates.
> 
> ciao (see you're italian ...)
> do you know how can I do the same with a 
> 
> org.w3c.dom.Document document;
> instead of an editor which I suppose is a svg 1.2 element
> ?
> thanks
> 

ok, found out, thanks 


public void handleEvent(Event evt) {                    
        MouseEvent uiEvt = (MouseEvent) evt;
        SVGDocument doc = (SVGDocument) document;
        SVGSVGElement SVGRoot = doc.getRootElement();
                        
        SVGMatrix mat  = SVGRoot.getScreenCTM();
        SVGMatrix imat = mat.inverse();
        SVGPoint  cPt  = doc.getRootElement().createSVGPoint();
        cPt.setX(uiEvt.getClientX());
        cPt.setY(uiEvt.getClientY());
        cPt = cPt.matrixTransform(imat);
        //trans coords is: x:  cPt.getX()
....



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to