From 098beed9542976b206dc3f874656f2a2c3f037d4 Mon Sep 17 00:00:00 2001 From: jplaine Date: Mon, 13 Dec 2010 09:27:21 +0000 Subject: [PATCH] Improvements to sg event handling implementation (a bit slower, but more robust). Also some thread utils copied from o.s.utils.thread (needs some refactoring later on). refs #1942 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@19131 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../ui/elements2/connections/DependencyNode.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyNode.java index 1577b1bc..8a6f3625 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyNode.java @@ -27,6 +27,7 @@ import java.beans.PropertyChangeListener; import org.simantics.scenegraph.ISelectionPainterNode; import org.simantics.scenegraph.g2d.G2DNode; +import org.simantics.scenegraph.g2d.events.ISGMouseEvent; import org.simantics.scenegraph.utils.NodeUtil; import org.simantics.utils.datastructures.Pair; @@ -162,11 +163,10 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode, Mo boolean pressHit = false; private boolean hitTest(MouseEvent event, double tolerance) { - Point2D mp = NodeUtil.sgEventLocations.get(event); - if(mp != null) { + if(event instanceof ISGMouseEvent) { if(beginBounds == null || endBounds == null) return false; - return Arcs.hitTest(beginBounds, endBounds, angle, mp.getX(), mp.getY(), tolerance); + return Arcs.hitTest(beginBounds, endBounds, angle, ((ISGMouseEvent)event).getDoubleX(), ((ISGMouseEvent)event).getDoubleY(), tolerance); } else { return false; } @@ -179,11 +179,10 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode, Mo @Override public void mouseDragged(MouseEvent e) { - Point2D mp = NodeUtil.sgEventLocations.get(e); - if(pressHit && mp != null) { + if(pressHit && e instanceof ISGMouseEvent) { setAngle(Arcs.angleOfArc( beginBounds.getCenterX(), beginBounds.getCenterY(), - mp.getX(), mp.getY(), + ((ISGMouseEvent)e).getDoubleX(), ((ISGMouseEvent)e).getDoubleY(), endBounds.getCenterX(), endBounds.getCenterY())); } } -- 2.47.1