reverted modification at the generic shape

This commit is contained in:
hneemann 2019-08-28 16:58:02 +02:00
parent c40cddd32c
commit be2d228cb3
2 changed files with 10 additions and 11 deletions

View File

@ -206,15 +206,9 @@ public class GenericShape implements Shape {
if (symmetric && inputs.size() > 0 && ((inputs.size() & 1) == 0)) yBottom += SIZE; 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) Polygon polygon = new Polygon(true)
.add(1, -top) .add(1, -topBottomBorder)
.add(SIZE * width - 1, -top) .add(SIZE * width - 1, -topBottomBorder)
.add(SIZE * width - 1, yBottom) .add(SIZE * width - 1, yBottom)
.add(1, yBottom); .add(1, yBottom);
@ -231,7 +225,7 @@ public class GenericShape implements Shape {
} }
if (label != null) { 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); 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() > 0) {
if (name.length() <= 3 && !showPinLabels) { 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); graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.NORMAL);
} else { } else {
Vector pos = new Vector(SIZE2 * width, yBottom + 4); Vector pos = new Vector(SIZE2 * width, yBottom + 4);

View File

@ -19,6 +19,7 @@ import de.neemann.digital.core.switching.*;
import de.neemann.digital.core.wiring.*; import de.neemann.digital.core.wiring.*;
import de.neemann.digital.draw.elements.PinException; import de.neemann.digital.draw.elements.PinException;
import de.neemann.digital.draw.elements.Tunnel; 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.ElementLibrary;
import de.neemann.digital.draw.library.ElementTypeDescriptionCustom; import de.neemann.digital.draw.library.ElementTypeDescriptionCustom;
import de.neemann.digital.draw.library.JarComponentManager; import de.neemann.digital.draw.library.JarComponentManager;
@ -34,6 +35,9 @@ import de.neemann.digital.testing.TestCaseElement;
import java.util.HashMap; 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 * Used to create a shape matching a given name
*/ */
@ -79,7 +83,7 @@ public final class ShapeFactory {
(attributes, inputs, outputs) -> { (attributes, inputs, outputs) -> {
final boolean ws = attributes.get(Keys.WIDE_SHAPE); final boolean ws = attributes.get(Keys.WIDE_SHAPE);
return new GenericShape(ws ? "1" : "", inputs, outputs) return new GenericShape(ws ? "1" : "", inputs, outputs)
.setTopBottomBorder(ws ? GenericShape.SIZE : GenericShape.SIZE2) .setTopBottomBorder(ws ? SIZE : SIZE2)
.invert(true) .invert(true)
.setWide(ws); .setWide(ws);
}); });
@ -224,6 +228,7 @@ public final class ShapeFactory {
elementAttributes.getLabel(), elementAttributes.getLabel(),
true, true,
customDescr.getAttributes().get(Keys.WIDTH)) customDescr.getAttributes().get(Keys.WIDTH))
.setTopBottomBorder(SIZE2 + Style.MAXLINETHICK)
.setColor(customDescr.getAttributes().get(Keys.BACKGROUND_COLOR)); .setColor(customDescr.getAttributes().get(Keys.BACKGROUND_COLOR));
} }
} else { } else {