Improved the label text position in the layout shape to match the other components; see #432

This commit is contained in:
hneemann 2020-04-02 09:09:45 +02:00
parent 3cdf4ff2e3
commit f3e3927677

View File

@ -145,12 +145,12 @@ public class LayoutShape implements Shape {
graphic.drawPolygon(poly, Style.NORMAL.deriveFillStyle(color)); graphic.drawPolygon(poly, Style.NORMAL.deriveFillStyle(color));
graphic.drawPolygon(poly, Style.NORMAL); graphic.drawPolygon(poly, Style.NORMAL);
if (top.size() == 0) if (bottom.size() == 0)
graphic.drawText(new Vector(width * SIZE / 2, -4), name, Orientation.CENTERBOTTOM, Style.NORMAL); graphic.drawText(new Vector(width * SIZE / 2, height * SIZE + 4), name, Orientation.CENTERTOP, Style.SHAPE_PIN);
else if (bottom.size() == 0) else if (top.size() == 0)
graphic.drawText(new Vector(width * SIZE / 2, height * SIZE + 4), name, Orientation.CENTERTOP, Style.NORMAL); graphic.drawText(new Vector(width * SIZE / 2, -4), name, Orientation.CENTERBOTTOM, Style.SHAPE_PIN);
else else
graphic.drawText(new Vector(width * SIZE / 2, height * SIZE / 2), name, Orientation.CENTERCENTER, Style.NORMAL); graphic.drawText(new Vector(width * SIZE / 2, height * SIZE / 2), name, Orientation.CENTERCENTER, Style.SHAPE_PIN);
for (PinPos p : left) for (PinPos p : left)
graphic.drawText(p.pos.add(4, 0), p.label, Orientation.LEFTCENTER, Style.SHAPE_PIN); graphic.drawText(p.pos.add(4, 0), p.label, Orientation.LEFTCENTER, Style.SHAPE_PIN);