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 Daniel Meyer <da...@pt.lu> on 2007/05/24 16:08:23 UTC
nodeHitAt()
Hi,
I want to call
canvas.getGraphicsNode().nodeHitAt(p);
which transformations have to be applied to p in order for nodeHitAt to
work?
This is what I got so far:
Point p = [MouseEventInstance].getPoint();
AffineTransform af = canvas.getRenderingTransform().createInverse();
if (af != null)
af.deltaTransform(p, p);
af = canvas.getGraphicsNode().getGlobalTransform().createInverse();
if (af != null)
af.deltaTransform(p, p);
// check for selection:
GraphicsNode newSelection = canvas.getGraphicsNode().nodeHitAt(p);
I know that I have to map p to the root graphicsnode's coordinate space,
but the way I do it, doesn't work.
Any suggestions greatly appreciated!!!
Yours,
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: nodeHitAt()
Posted by Daniel Meyer <da...@pt.lu>.
Problem solved ;)
[use transform() instead of deltaTransform() ]
Daniel Meyer wrote:
> Hi,
>
> I want to call
> canvas.getGraphicsNode().nodeHitAt(p);
> which transformations have to be applied to p in order for nodeHitAt
> to work?
>
>
> This is what I got so far:
>
>
> Point p = [MouseEventInstance].getPoint();
> AffineTransform af = canvas.getRenderingTransform().createInverse();
> if (af != null)
> af.deltaTransform(p, p);
> af = canvas.getGraphicsNode().getGlobalTransform().createInverse();
> if (af != null)
> af.deltaTransform(p, p);
>
> // check for selection:
> GraphicsNode newSelection = canvas.getGraphicsNode().nodeHitAt(p);
>
>
> I know that I have to map p to the root graphicsnode's coordinate space,
> but the way I do it, doesn't work.
>
> Any suggestions greatly appreciated!!!
>
> Yours,
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org