From 23e6853f0bc490918500351c45eebd494b800945 Mon Sep 17 00:00:00 2001 From: miettinen Date: Tue, 24 Jun 2014 10:52:49 +0000 Subject: [PATCH] Sysdyn Loop symbol to appear under mouse instead of somewhere southwest of it (refs #4950). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29717 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.sysdyn.ontology/graph.tg | Bin 182687 -> 182684 bytes .../graph/svg/loop.svg | 12 +++++------ .../sysdyn/ui/elements/LoopFactory.java | 19 +++++++++++------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/org.simantics.sysdyn.ontology/graph.tg b/org.simantics.sysdyn.ontology/graph.tg index 98d3e2d9d3c08048e17df94d6c693b6727ff0474..cde7423cbcea2477c7c58042b99fff81ce0618bd 100644 GIT binary patch delta 123 zcmbO~nS0J;?uHh|EldKd7`JT~T*dU4SIt<@#MH>l$jCy8O92Ej^RkPR6AMzUk}GYM zEcDEbEzONhO{bgfU|Py-YG^S1;0`8nR-lxL@%G<4m>5}kEc6V`%?*sqbPNrQw{z@c ZVrSwu(lawOF*LEzF*DyTb%3dr69D1pB69!$ delta 126 zcmbO;nS1_Z?uHh|EldKd7 + transform="matrix(0.00747689,-0.00472065,0.00249533,0.01414476,8.177026,1038.1856)" /> diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java index 473ee7a1..2498e4a4 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java @@ -62,10 +62,14 @@ import org.simantics.g2d.svg.SVGImage; import org.simantics.g2d.utils.Alignment; import org.simantics.modeling.ModelingResources; import org.simantics.scenegraph.g2d.G2DParentNode; +import org.simantics.scenegraph.g2d.events.MouseEvent; +import org.simantics.scenegraph.g2d.events.MouseEvent.MouseEnterEvent; +import org.simantics.scenegraph.g2d.events.MouseEvent.MouseExitEvent; import org.simantics.scenegraph.g2d.nodes.SVGNode; import org.simantics.scenegraph.g2d.nodes.ShapeNode; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.LoopTab; +import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils; import org.simantics.sysdyn.utils.LoopUtils; import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.Callback; @@ -116,13 +120,14 @@ public class LoopFactory extends SysdynElementFactory { static Shape getLoopShape() { // Used in shortcut. + double x0 = 5, y0 = 2; Path2D loop = new Path2D.Double(); - loop.moveTo(1, 2); - loop.lineTo(0, 0); - loop.lineTo(-1, 2); + loop.moveTo(x0 + 1, y0 + 2); + loop.lineTo(x0 + 0, y0 + 0); + loop.lineTo(x0 -1, y0 + 2); loop.closePath(); - loop.append(new Arc2D.Double(-10, -3, 10, 10, 0, -270, Arc2D.OPEN), false); + loop.append(new Arc2D.Double(x0 -10, y0 -3, 10, 10, 0, -270, Arc2D.OPEN), false); return loop; } @@ -201,7 +206,7 @@ public class LoopFactory extends SysdynElementFactory { SVGNode image = e.getHint(getNodeKey()); if (clockwise != null && clockwise) { Point2D imageParent = (Point2D) image.localToParent(new Point2D.Double(0.0,0.0)).clone(); - AffineTransform at = new AffineTransform(-1.0, 0.0, 0.0, 1.0, imageParent.getX(), imageParent.getY()); + AffineTransform at = new AffineTransform(-1.0, 0.0, 0.0, 1.0, imageParent.getX()+12.34, imageParent.getY()); image.setTransform(at); } @@ -292,12 +297,12 @@ public class LoopFactory extends SysdynElementFactory { private static double getXCoordShift(IElement e) { //String location = e.getHint(SysdynElementHints.KEY_LOCATION); - return 0; + return 6.3; } private static double getYCoordShift(IElement e) { //String location = e.getHint(SysdynElementHints.KEY_LOCATION); - return 9.7; + return -0.3; } @Override -- 2.47.1