Hi Peppe,

Peppe <[EMAIL PROTECTED]> wrote on 01/08/2007 08:41:06 AM:

> i would to update bbox position when i move the element (it's called 
"shape"
> in my code; instead "actionNode" is actionNode = elEvt.getTarget()) that 
i
> selected...
> 
> you say that i have to map 4 points... in this way?:

   Yes, these are the 4 points...

> 
>                                 shape = (Element)actionNode;

   I think you should add:

                      SVGRect shapeBound = 
((SVGLocatable)shape).getBBox();

>                      SVGMatrix mat = 
((SVGLocatable)shape).getScreenCTM();
>                      SVGMatrix imat = mat.inverse();
>                      bPt1 = doc.getRootElement().createSVGPoint();
>                      bPt1.setX(shapeBound.getX());
>                      bPt1.setY(shapeBound.getY());
>                      bPt1 = bPt1.matrixTransform(imat); 
>                      bPt2 = doc.getRootElement().createSVGPoint();
>                      bPt2.setX(shapeBound.getX()+shapeBound.getWidth());
>                      bPt2.setY(shapeBound.getY());
>                      bPt2 = bPt2.matrixTransform(imat); 
>                      bPt3 = doc.getRootElement().createSVGPoint();
>                      bPt3.setX(shapeBound.getX());
> bPt3.setY(shapeBound.getY()+shapeBound.getHeight());
>                      bPt3 = bPt3.matrixTransform(imat); 
>                      bPt4 = doc.getRootElement().createSVGPoint();
>                      bPt4.setX(shapeBound.getX()+shapeBound.getWidth());
> bPt4.setY(shapeBound.getY()+shapeBound.getHeight());
>                      bPt4 = bPt4.matrixTransform(imat); 
> 
> but i don't understand how to update these points to the new 
positions... 

  Add print statements for bPt1-4 to the above, then run this code before 
the move and after, the result should be the screen pixel coords of
the shape before and after the move.

Reply via email to