mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 15:26:52 -04:00
optimized text output
This commit is contained in:
parent
31eb76ceca
commit
a88e38a616
@ -23,7 +23,7 @@ import static de.neemann.digital.draw.shapes.PullDownShape.HEIGHT;
|
|||||||
import static de.neemann.digital.draw.shapes.PullDownShape.WIDTH2;
|
import static de.neemann.digital.draw.shapes.PullDownShape.WIDTH2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The light bulb shape
|
* The real LED shape
|
||||||
*/
|
*/
|
||||||
public class RealLEDShape implements Shape {
|
public class RealLEDShape implements Shape {
|
||||||
private static final int RAD = SIZE * 3 / 4;
|
private static final int RAD = SIZE * 3 / 4;
|
||||||
@ -45,7 +45,11 @@ public class RealLEDShape implements Shape {
|
|||||||
public RealLEDShape(ElementAttributes attr, PinDescriptions inputs, PinDescriptions outputs) {
|
public RealLEDShape(ElementAttributes attr, PinDescriptions inputs, PinDescriptions outputs) {
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
style = Style.NORMAL.deriveFillStyle(attr.get(Keys.COLOR));
|
style = Style.NORMAL.deriveFillStyle(attr.get(Keys.COLOR));
|
||||||
label = attr.getLabel();
|
String l = attr.getLabel();
|
||||||
|
if (l == null || l.trim().length() == 0)
|
||||||
|
label = null;
|
||||||
|
else
|
||||||
|
label = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,8 +86,10 @@ public class RealLEDShape implements Shape {
|
|||||||
Style.NORMAL
|
Style.NORMAL
|
||||||
);
|
);
|
||||||
graphic.drawLine(new Vector(0, SIZE * 4 - SIZE2), new Vector(0, SIZE * 4), Style.NORMAL);
|
graphic.drawLine(new Vector(0, SIZE * 4 - SIZE2), new Vector(0, SIZE * 4), Style.NORMAL);
|
||||||
Vector textPos = new Vector(SIZE + SIZE2, SIZE);
|
if (label != null) {
|
||||||
graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL);
|
Vector textPos = new Vector(SIZE + SIZE2, SIZE);
|
||||||
|
graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (a == null || c == null) {
|
if (a == null || c == null) {
|
||||||
graphic.drawPolygon(
|
graphic.drawPolygon(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user