diff --git a/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java b/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java index a8bde5b6e..8a5f55623 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java @@ -206,15 +206,9 @@ public class GenericShape implements Shape { if (symmetric && inputs.size() > 0 && ((inputs.size() & 1) == 0)) yBottom += SIZE; - int top = topBottomBorder; - if (outputs.size() > 1) { - top += 3; - yBottom += 3; - } - Polygon polygon = new Polygon(true) - .add(1, -top) - .add(SIZE * width - 1, -top) + .add(1, -topBottomBorder) + .add(SIZE * width - 1, -topBottomBorder) .add(SIZE * width - 1, yBottom) .add(1, yBottom); @@ -231,7 +225,7 @@ public class GenericShape implements Shape { } if (label != null) { - Vector pos = new Vector(SIZE2 * width, -top - 8); + Vector pos = new Vector(SIZE2 * width, -topBottomBorder - 8); graphic.drawText(pos, pos.add(1, 0), label, Orientation.CENTERBOTTOM, Style.NORMAL); } @@ -256,7 +250,7 @@ public class GenericShape implements Shape { } if (name.length() > 0) { if (name.length() <= 3 && !showPinLabels) { - Vector pos = new Vector(SIZE2 * width, -top + 4); + Vector pos = new Vector(SIZE2 * width, -topBottomBorder + 4); graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.NORMAL); } else { Vector pos = new Vector(SIZE2 * width, yBottom + 4); diff --git a/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java b/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java index be12a28fb..448f3d1f2 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java +++ b/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java @@ -19,6 +19,7 @@ import de.neemann.digital.core.switching.*; import de.neemann.digital.core.wiring.*; import de.neemann.digital.draw.elements.PinException; import de.neemann.digital.draw.elements.Tunnel; +import de.neemann.digital.draw.graphics.Style; import de.neemann.digital.draw.library.ElementLibrary; import de.neemann.digital.draw.library.ElementTypeDescriptionCustom; import de.neemann.digital.draw.library.JarComponentManager; @@ -34,6 +35,9 @@ import de.neemann.digital.testing.TestCaseElement; import java.util.HashMap; +import static de.neemann.digital.draw.shapes.GenericShape.SIZE; +import static de.neemann.digital.draw.shapes.GenericShape.SIZE2; + /** * Used to create a shape matching a given name */ @@ -79,7 +83,7 @@ public final class ShapeFactory { (attributes, inputs, outputs) -> { final boolean ws = attributes.get(Keys.WIDE_SHAPE); return new GenericShape(ws ? "1" : "", inputs, outputs) - .setTopBottomBorder(ws ? GenericShape.SIZE : GenericShape.SIZE2) + .setTopBottomBorder(ws ? SIZE : SIZE2) .invert(true) .setWide(ws); }); @@ -224,6 +228,7 @@ public final class ShapeFactory { elementAttributes.getLabel(), true, customDescr.getAttributes().get(Keys.WIDTH)) + .setTopBottomBorder(SIZE2 + Style.MAXLINETHICK) .setColor(customDescr.getAttributes().get(Keys.BACKGROUND_COLOR)); } } else {