« Return to Thread: a few questions..

Re: a few questions..

by thomas.deweese :: Rate this Message:

Reply to Author | View in Thread

Hi ShyDisturbedBoy,

shydisturbedboy <shydisturbedboy@...> wrote on 05/17/2007 01:25:49
AM:

>
> 1. how do i convert the coordinates of a rotated rect? when i drag the
> rotated rect, it does not follow the mouse.. what should i do?

shydisturbedboy <shydisturbedboy@...> wrote on 05/17/2007 09:06:22
AM:

>     private class OnMoveAction implements EventListener {
>        public void handleEvent(Event evt) {
>             Element ee = null;
>             DOMMouseEvent elEvt = (DOMMouseEvent)evt;
   [...]

>                     SVGPoint pt = convertPt((Element)ee.getParentNode(),
>                                             elEvt.getClientX(),
elEvt.getClientY());
>                     moveElement(ee, pt.getX(), pt.getY());

    By passing ee.getParentNode() you will be 'bypassing' the transform on
'ee'.  So if the rectangle is rotated by setting it's transform attribute
(as opposed to a parent's transform attribute) then your mapping of
ClientX/Y will be to the wrong coordinate system.  The 'x'/'cx' & 'y'/'cy'

attributes are in the local coordinate system of the element (after it's
transform has been applied).


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

 « Return to Thread: a few questions..