summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkitfox2014-02-27 15:14:14 +0100
committerkitfox2014-02-27 15:14:14 +0100
commit275ef2c25289e161ccc86642fd0b31708f025409 (patch)
tree93af57bd1e206b44cddeef4836c3fd3402ed25e4 /src
parentFixing SVGSALAMANDER-33. User can now selectively remove documents from cache. (diff)
downloadsvg-salamander-core-275ef2c25289e161ccc86642fd0b31708f025409.tar.gz
svg-salamander-core-275ef2c25289e161ccc86642fd0b31708f025409.tar.xz
svg-salamander-core-275ef2c25289e161ccc86642fd0b31708f025409.zip
Picking now takes viewport transform into account.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@171 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/kitfox/svg/SVGRoot.java31
-rw-r--r--src/main/java/com/kitfox/svg/ShapeElement.java2
2 files changed, 32 insertions, 1 deletions
diff --git a/src/main/java/com/kitfox/svg/SVGRoot.java b/src/main/java/com/kitfox/svg/SVGRoot.java
index 5edc476..fdd5065 100644
--- a/src/main/java/com/kitfox/svg/SVGRoot.java
+++ b/src/main/java/com/kitfox/svg/SVGRoot.java
@@ -43,7 +43,10 @@ import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
+import java.util.List;
/**
* The root element of an SVG tree.
@@ -263,6 +266,34 @@ public class SVGRoot extends Group
g.setTransform(cachedXform);
}
+ public void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
+ {
+ if (viewXform != null)
+ {
+ ltw = new AffineTransform(ltw);
+ ltw.concatenate(viewXform);
+ }
+
+ super.pick(pickArea, ltw, boundingBox, retVec);
+ }
+
+ public void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
+ {
+ Point2D xPoint = new Point2D.Double(point.getX(), point.getY());
+ if (viewXform != null)
+ {
+ try
+ {
+ viewXform.inverseTransform(point, xPoint);
+ } catch (NoninvertibleTransformException ex)
+ {
+ throw new SVGException(ex);
+ }
+ }
+
+ super.pick(xPoint, boundingBox, retVec);
+ }
+
public Shape getShape()
{
Shape shape = super.getShape();
diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java
index 9a954fe..e3b7ac2 100644
--- a/src/main/java/com/kitfox/svg/ShapeElement.java
+++ b/src/main/java/com/kitfox/svg/ShapeElement.java
@@ -86,7 +86,7 @@ abstract public class ShapeElement extends RenderableElement
void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
{
- StyleAttribute styleAttrib = new StyleAttribute();
+// StyleAttribute styleAttrib = new StyleAttribute();
// if (getStyle(styleAttrib.setName("fill")) && getShape().contains(point))
if ((boundingBox ? getBoundingBox() : getShape()).contains(point))
{