From: miettinen Date: Tue, 24 Jun 2014 10:52:49 +0000 (+0000) Subject: Sysdyn Loop symbol to appear under mouse instead of somewhere southwest of it (refs... X-Git-Tag: v1.29.0~260 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=23e6853f0bc490918500351c45eebd494b800945;p=simantics%2Fsysdyn.git 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 --- diff --git a/org.simantics.sysdyn.ontology/graph.tg b/org.simantics.sysdyn.ontology/graph.tg index 98d3e2d9..cde7423c 100644 Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ diff --git a/org.simantics.sysdyn.ontology/graph/svg/loop.svg b/org.simantics.sysdyn.ontology/graph/svg/loop.svg index aaa11b1f..39433ba2 100644 --- a/org.simantics.sysdyn.ontology/graph/svg/loop.svg +++ b/org.simantics.sysdyn.ontology/graph/svg/loop.svg @@ -111,14 +111,14 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="32" - inkscape:cx="-1.9642866" - inkscape:cy="-2.7672376" + inkscape:cx="3.4526228" + inkscape:cy="8.6397355" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="1006" inkscape:window-height="739" - inkscape:window-x="1428" - inkscape:window-y="52" + inkscape:window-x="510" + inkscape:window-y="43" showgrid="false" inkscape:window-maximized="0" fit-margin-top="0" @@ -158,7 +158,7 @@ inkscape:randomized="0" d="m 148.57144,345.21932 230.49908,-204.50728 61.85896,301.8717 z" inkscape:transform-center-y="-0.37884722" - transform="matrix(0.00747689,-0.00472065,0.00249533,0.01414476,2.177026,1048.1856)" /> + 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