Index: sources/org/apache/batik/gvt/CompositeGraphicsNode.java =================================================================== --- sources/org/apache/batik/gvt/CompositeGraphicsNode.java (revision 718310) +++ sources/org/apache/batik/gvt/CompositeGraphicsNode.java (working copy) @@ -458,24 +458,32 @@ * @param p the specified Point2D in the user space */ public boolean contains(Point2D p) { + if (count == 0) return false; + Rectangle2D bounds = getSensitiveBounds(); - if (count > 0 && bounds != null && bounds.contains(p)) { - Point2D pt = null; - Point2D cp = null; // Propagated to children - for (int i=0; i < count; ++i) { - AffineTransform t = children[i].getInverseTransform(); - if(t != null){ - pt = t.transform(p, pt); - cp = pt; - } else { - cp = p; - } - if (children[i].contains(cp)) { - return true; - } + if ((bounds == null) || !bounds.contains(p)) + return false; + + if (clip != null) { + Shape clipP = clip.getClipPath(); + if ((clipP != null) && !clipP.contains(p)) + return false; + } + + Point2D pt = null; + Point2D cp = null; // Propagated to children + for (int i=0; i < count; ++i) { + AffineTransform t = children[i].getInverseTransform(); + if(t != null){ + pt = t.transform(p, pt); + cp = pt; + } else { + cp = p; } + if (children[i].contains(cp)) { + return true; + } } - return false; } @@ -489,6 +497,11 @@ public GraphicsNode nodeHitAt(Point2D p) { Rectangle2D bounds = getSensitiveBounds(); if (count > 0 && bounds != null && bounds.contains(p)) { + if (clip != null) { + Shape clipP = clip.getClipPath(); + if ((clipP != null) && !clipP.contains(p)) + return null; + } // Go backward because the children are in rendering order Point2D pt = null; Point2D cp = null; // Propagated to children Index: sources/org/apache/batik/gvt/AbstractGraphicsNode.java =================================================================== --- sources/org/apache/batik/gvt/AbstractGraphicsNode.java (revision 718310) +++ sources/org/apache/batik/gvt/AbstractGraphicsNode.java (working copy) @@ -923,6 +923,11 @@ if (b == null || !b.contains(p)) { return false; } + if (clip != null) { + Shape clipP = clip.getClipPath(); + if ((clipP != null) && !clipP.contains(p)) + return false; + } switch(pointerEventType) { case VISIBLE_PAINTED: case VISIBLE_FILL: Index: sources/org/apache/batik/gvt/ShapeNode.java =================================================================== --- sources/org/apache/batik/gvt/ShapeNode.java (revision 718310) +++ sources/org/apache/batik/gvt/ShapeNode.java (working copy) @@ -198,7 +198,11 @@ Rectangle2D b = getSensitiveBounds(); if (b == null || !b.contains(p)) return false; - + if (clip != null) { + Shape clipP = clip.getClipPath(); + if ((clipP != null) && !clipP.contains(p)) + return false; + } return inSensitiveArea(p); } case NONE: