From: Daniel Kirschten Date: Sun, 30 Jun 2019 15:45:29 +0000 (+0200) Subject: Fixed TextComponent having two different positions: X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=6cc67a41ad5cee725f1578f8a35e17cdffc6b642;p=Mograsim.git Fixed TextComponent having two different positions: getPosX/Y() reported a different position than getBounds().x/y, which could cause problems --- diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/TextComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/TextComponent.java index 339d4f57..542b7f0e 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/TextComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/TextComponent.java @@ -28,7 +28,7 @@ public class TextComponent extends GUIComponent Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text"); if (textColor != null) gc.setForeground(textColor); - gc.drawText(text, getPosX() - textExtent.x / 2, getPosY() - textExtent.y / 2, true); + gc.drawText(text, getPosX(), getPosY(), true); } @Override @@ -36,7 +36,7 @@ public class TextComponent extends GUIComponent { if (textExtent == null) return super.getBounds(); - return new Rectangle(getPosX() - textExtent.x / 2, getPosY() - textExtent.y / 2, textExtent.x, textExtent.y); + return new Rectangle(getPosX(), getPosY(), textExtent.x, textExtent.y); } static