]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13204 ac1ea38d-2e2b...
authorniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 1 Dec 2009 15:45:46 +0000 (15:45 +0000)
committerniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 1 Dec 2009 15:45:46 +0000 (15:45 +0000)
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/TextElement.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/ValveElement.java

index 59725bd21a2c7465947bc991cb136021cd61827e..e820dad2bd6b64d9f577c25ceeb67f645e07d0aa 100644 (file)
@@ -44,6 +44,14 @@ public class TextElement extends RectangularElement implements Movable, Connecta
        public TextElement() {  \r
        }\r
        \r
+       public double getTextDeltaX() {\r
+               return 0.0;\r
+       }\r
+       \r
+       public double getTextDeltaY() {\r
+               return 0.0;\r
+       }\r
+       \r
        public TextElement(String label, double x, double y) {\r
                this.label = label;\r
                this.posX = x;\r
@@ -71,11 +79,11 @@ public class TextElement extends RectangularElement implements Movable, Connecta
                                textBounds.getHeight()*FONT_SCALE\r
                                );\r
                \r
-               textX = posX-textBounds.getCenterX();\r
-               textY = posY-textBounds.getCenterY();\r
+               textX = posX+getTextDeltaX()-textBounds.getCenterX();\r
+               textY = posY+getTextDeltaY()-textBounds.getCenterY();\r
                bounds.setFrame(\r
-                               posX-textBounds.getWidth()*0.5-XPADDING,\r
-                               posY-textBounds.getHeight()*0.5-YPADDING,\r
+                               posX+getTextDeltaX()-textBounds.getWidth()*0.5-XPADDING,\r
+                               posY+getTextDeltaY()-textBounds.getHeight()*0.5-YPADDING,\r
                                textBounds.getWidth()+XPADDING*2,\r
                                textBounds.getHeight()+YPADDING*2\r
                                );              \r
index e93751c063bb2a8c77989e1d9303d2b8b61bddcf..ad3a4cd2fc3a43389853242aa6646c824aa48560 100644 (file)
@@ -25,6 +25,11 @@ public class ValveElement extends TextElement implements Rotatable {
            this.posX = x;\r
            this.posY = y; \r
        }\r
+       \r
+       @Override\r
+       public double getTextDeltaY() {\r
+               return 8.0;\r
+       }\r
 \r
        @Override\r
        public void init(G2DParentNode parent) {\r