X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FSimpleRectangularSubmodelComponent.java;h=7a7bb9d52b569bd810a1d96d71d0d532abfed8ee;hb=c223a9de7b0ef783bcb4f7612da350583ca29abd;hp=0c0bf301e61bf408666f2ae326e31a87bf2f533b;hpb=7de4f2b3d61f8801459645d4bd337a91405e107a;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java index 0c0bf301..7a7bb9d5 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java @@ -93,25 +93,22 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent @Override protected void renderSymbol(GeneralGC gc, Rectangle visibleRegion) { - double posX = getBounds().x; - double posY = getBounds().y; - Font oldFont = gc.getFont(); gc.setFont(new Font(oldFont.getName(), labelFontHeight, oldFont.getStyle())); Point textExtent = gc.textExtent(label); - gc.drawText(label, posX + (getBounds().width - textExtent.x) / 2, posY + (getBounds().height - textExtent.y) / 2, true); + gc.drawText(label, getPosX() + (getWidth() - textExtent.x) / 2, getPosY() + (getHeight() - textExtent.y) / 2, true); gc.setFont(new Font(oldFont.getName(), pinNameFontHeight, oldFont.getStyle())); for (int i = 0; i < inputPinNames.size(); i++) { String pinName = inputPinNames.get(i); textExtent = gc.textExtent(pinName); - gc.drawText(pinName, posX + pinNameMargin, posY + i * pinDistance + (pinDistance - textExtent.y) / 2, true); + gc.drawText(pinName, getPosX() + pinNameMargin, getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true); } for (int i = 0; i < outputPinNames.size(); i++) { String pinName = outputPinNames.get(i); textExtent = gc.textExtent(pinName); - gc.drawText(pinName, posX + width - textExtent.x - pinNameMargin, posY + i * pinDistance + (pinDistance - textExtent.y) / 2, + gc.drawText(pinName, getPosX() + width - textExtent.x - pinNameMargin, getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true); } gc.setFont(oldFont);