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=66f8cbab0c292761a8a34f5c5e2d5e4434672d44;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 241a3bb4..e5a6347a 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