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 Michał Piotrowski <ba...@3miasto.net> on 2001/10/22 14:06:57 UTC
Mouse hit detectors
How can I write own mouse hit detector for my extension without
rewriting org.apache.batik.gvt.ShapeNode? Is it possible or the only
way is to rewrite method 'contains()' in class ShapeNode?
--
Michal Piotrowski
===- mailto:bastian@3miasto.net -====
=- http://www.3miasto.net/~bastian -=
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Mouse hit detectors
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "MP" == Michał Piotrowski <ba...@3miasto.net> writes:
MP> How can I write own mouse hit detector for my extension without
MP> rewriting org.apache.batik.gvt.ShapeNode? Is it possible or the
MP> only way is to rewrite method 'contains()' in class ShapeNode?
Well I must admit that I haven't tried to write a hit detector for
an extension (and you aren't very clear on what the exact problem is)
so this response may be a bit abstract, but...
1) It isn't clear why ShapeNode's contains method is inappropriate, it
seems to return true when the click is inside the paintedArea.
This seems like a really reasonable implementation and as long as
you are interested in clicks in a particular geometric area should
suffice (I should also mention the 'isVisible' data member or
the 'visible=""false"' SVG attribute).
2) If you needed some 'whacked out' implementation of contains, Java is
an object oriented language so you can subclass ShapeNode and add
your new implementation:
return new ShapeNode(...) {
public boolean contains(Point2D p) {
// I get all clicks!!!
return true;
}
};
(Note, Using an anonymous subclass is probably not the best route
but it could be done).
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Mouse hit detectors
Posted by Thierry Kormann <tk...@ilog.fr>.
On Monday 22 October 2001 14:06, Micha? Piotrowski wrote:
> How can I write own mouse hit detector for my extension without
> rewriting org.apache.batik.gvt.ShapeNode? Is it possible or the only
> way is to rewrite method 'contains()' in class ShapeNode?
You have a setGraphicsNodeHitDetector method on GraphicsNode. Though this
part of the API has not been really tested (we don't support the
pointer-event property yet) - you should be able to do things by setting your
own GraphicsNodeHitDetector implementation.
Thierry.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org