Fixed TextComponent having two different positions:
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 30 Jun 2019 15:45:29 +0000 (17:45 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 30 Jun 2019 15:46:51 +0000 (17:46 +0200)
getPosX/Y() reported a different position than getBounds().x/y, which
could cause problems

net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/TextComponent.java

index 339d4f5..542b7f0 100644 (file)
@@ -28,7 +28,7 @@ public class TextComponent extends GUIComponent
                Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text");\r
                if (textColor != null)\r
                        gc.setForeground(textColor);\r
-               gc.drawText(text, getPosX() - textExtent.x / 2, getPosY() - textExtent.y / 2, true);\r
+               gc.drawText(text, getPosX(), getPosY(), true);\r
        }\r
 \r
        @Override\r
@@ -36,7 +36,7 @@ public class TextComponent extends GUIComponent
        {\r
                if (textExtent == null)\r
                        return super.getBounds();\r
-               return new Rectangle(getPosX() - textExtent.x / 2, getPosY() - textExtent.y / 2, textExtent.x, textExtent.y);\r
+               return new Rectangle(getPosX(), getPosY(), textExtent.x, textExtent.y);\r
        }\r
 \r
        static\r