mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 15:26:52 -04:00
minor modification on the "Button with LED" shape
This commit is contained in:
parent
76e744afb2
commit
594f0ee2f3
@ -72,17 +72,17 @@ public class ButtonLEDShape extends ButtonShape {
|
|||||||
public void drawTo(Graphic graphic, Style heighLight) {
|
public void drawTo(Graphic graphic, Style heighLight) {
|
||||||
super.drawTo(graphic, heighLight);
|
super.drawTo(graphic, heighLight);
|
||||||
|
|
||||||
if (ledValue == null || ledValue.getBool()) {
|
boolean ledOn = ledValue == null || ledValue.getBool();
|
||||||
|
boolean pressed = button != null && button.isPressed();
|
||||||
|
|
||||||
Vector center;
|
Vector center;
|
||||||
if (button != null && button.isPressed()) {
|
if (pressed) {
|
||||||
center = new Vector(-OUT_SIZE - 1, 0);
|
center = new Vector(-OUT_SIZE - 1, 0);
|
||||||
} else
|
} else
|
||||||
center = new Vector(-OUT_SIZE - 1 - ButtonShape.HEIGHT, -ButtonShape.HEIGHT);
|
center = new Vector(-OUT_SIZE - 1 - ButtonShape.HEIGHT, -ButtonShape.HEIGHT);
|
||||||
|
|
||||||
|
if (ledOn)
|
||||||
graphic.drawCircle(center.add(-SIZE2, -SIZE2), center.add(SIZE2, SIZE2), color);
|
graphic.drawCircle(center.add(-SIZE2, -SIZE2), center.add(SIZE2, SIZE2), color);
|
||||||
graphic.drawCircle(center.add(-SIZE2, -SIZE2), center.add(SIZE2, SIZE2), Style.THIN);
|
graphic.drawCircle(center.add(-SIZE2, -SIZE2), center.add(SIZE2, SIZE2), Style.THIN);
|
||||||
} else {
|
|
||||||
Vector center = new Vector(-OUT_SIZE - 1 - ButtonShape.HEIGHT, -ButtonShape.HEIGHT);
|
|
||||||
graphic.drawCircle(center.add(-SIZE2, -SIZE2), center.add(SIZE2, SIZE2), Style.THIN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user