]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Sysdyn Loop symbol to appear under mouse instead of somewhere southwest of it (refs...
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Jun 2014 10:52:49 +0000 (10:52 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Jun 2014 10:52:49 +0000 (10:52 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29717 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/svg/loop.svg
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java

index 98d3e2d9d3c08048e17df94d6c693b6727ff0474..cde7423cbcea2477c7c58042b99fff81ce0618bd 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index aaa11b1f0dbf176caae0f76d2d422a7e1c3fc629..39433ba256c5e11c507ae6bea89586ca31edacee 100644 (file)
      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"
        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)" />
     <path
        sodipodi:type="arc"
        style="fill:none;stroke:#000000;stroke-width:0.88339353;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:none;marker-mid:none;marker-end:none"
        sodipodi:rx="21.785715"
        sodipodi:ry="13.121153"
        d="m 59.821428,1014.4158 a 21.785715,13.121153 0 1 1 -22.182754,-13.119"
-       transform="matrix(0.23486318,0,0,0.36599586,-8.614148,680.86439)"
+       transform="matrix(0.23486318,0,0,0.36599586,-2.614148,670.86439)"
        sodipodi:start="0"
        sodipodi:end="4.6941632"
        sodipodi:open="true" />
index 473ee7a17b769b1867a521335245630e13bdae90..2498e4a487f49de12f24ab61dea204fbfea9cd87 100644 (file)
@@ -62,10 +62,14 @@ import org.simantics.g2d.svg.SVGImage;
 import org.simantics.g2d.utils.Alignment;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.scenegraph.g2d.events.MouseEvent;\r
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseEnterEvent;\r
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseExitEvent;\r
 import org.simantics.scenegraph.g2d.nodes.SVGNode;\r
 import org.simantics.scenegraph.g2d.nodes.ShapeNode;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.LoopTab;\r
+import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils;\r
 import org.simantics.sysdyn.utils.LoopUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.datastructures.Callback;\r
@@ -116,13 +120,14 @@ public class LoopFactory extends SysdynElementFactory {
 \r
        static Shape getLoopShape() {\r
                // Used in shortcut.\r
+               double x0 = 5, y0 = 2;\r
                Path2D loop = new Path2D.Double();\r
-               loop.moveTo(1, 2);\r
-               loop.lineTo(0, 0);\r
-               loop.lineTo(-1, 2);\r
+               loop.moveTo(x0 + 1, y0 + 2);\r
+               loop.lineTo(x0 + 0, y0 + 0);\r
+               loop.lineTo(x0  -1, y0 + 2);\r
                loop.closePath();\r
 \r
-               loop.append(new Arc2D.Double(-10, -3, 10, 10, 0, -270, Arc2D.OPEN), false);\r
+               loop.append(new Arc2D.Double(x0 -10, y0 -3, 10, 10, 0, -270, Arc2D.OPEN), false);\r
                return loop;\r
        }\r
 \r
@@ -201,7 +206,7 @@ public class LoopFactory extends SysdynElementFactory {
                        SVGNode image = e.getHint(getNodeKey());\r
                        if (clockwise != null && clockwise) {\r
                Point2D imageParent = (Point2D) image.localToParent(new Point2D.Double(0.0,0.0)).clone();\r
-               AffineTransform at = new AffineTransform(-1.0, 0.0, 0.0, 1.0, imageParent.getX(), imageParent.getY());\r
+               AffineTransform at = new AffineTransform(-1.0, 0.0, 0.0, 1.0, imageParent.getX()+12.34, imageParent.getY());\r
                image.setTransform(at);\r
                        }\r
                        \r
@@ -292,12 +297,12 @@ public class LoopFactory extends SysdynElementFactory {
 \r
                private static double getXCoordShift(IElement e) {\r
                        //String location = e.getHint(SysdynElementHints.KEY_LOCATION);\r
-                       return 0;\r
+                       return 6.3;\r
                }\r
 \r
                private static double getYCoordShift(IElement e) {\r
                        //String location = e.getHint(SysdynElementHints.KEY_LOCATION);\r
-                       return 9.7;\r
+                       return -0.3;\r
                }\r
 \r
                @Override\r