xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas E Deweese <thomas.dewe...@kodak.com>
Subject Mouse hit detectors
Date Mon, 22 Oct 2001 12:19:00 GMT
>>>>> "MP" == MichaƂ Piotrowski <bastian@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


Mime
View raw message