You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by jonathan wood <jo...@gmail.com> on 2010/03/01 04:03:02 UTC

Re: coordinate conversion

Most of what you need can be found in SVGLocatable.  The below is not
tested, but should be close:

Point awtPoint = ...;
Element myEl = document.getElementById("my-el");
SVGPoint svgPoint = document.getRootElement.createSVGPoint();
svgPoint.setX(awtPoint.getX());
svgPoint.setY(awtPoint.getY());
SVGMatrix m = ((SVGLocatable)myEl).getScreenCTM();
m = m.inverse();
svgPoint = svgPoint.matrixTransform(m);


On Fri, Feb 26, 2010 at 8:34 AM, dao <da...@gmail.com> wrote:

> hello,
>
> Sorry for this stupid question: how do I transform coordinates from a AWT
> mouse event to the coordinates in the svg file the canvas represents?
>
> I mean, I have a panel with the canvas (rotated, zoomed, panned in the
> worst case) and I want to know the coordinates of the svg point my mouse
> cursor is pointing.
>
>
>
> --
> Dao Hodac
>