label rotation fix

This commit is contained in:
Patrick Haßel 2024-05-17 10:10:02 +02:00
parent 0bd947a27b
commit 3e7f0b5e73
2 changed files with 14 additions and 5 deletions

View File

@ -78,11 +78,11 @@ public class PartBattery extends Part {
final int y0; final int y0;
final int y1; final int y1;
if (getOrientation() == Orientation.R180) { if (getOrientation() == Orientation.R180) {
y0 = P05;
y1 = P95 - LABEL_FONT.getSize();
} else {
y0 = P95 - LABEL_FONT.getSize(); y0 = P95 - LABEL_FONT.getSize();
y1 = P05; y1 = P05;
} else {
y0 = P05;
y1 = P95 - LABEL_FONT.getSize();
} }
textCenter(g, LABEL_FONT, "%.1fV".formatted(voltage), y0, Color.BLACK); textCenter(g, LABEL_FONT, "%.1fV".formatted(voltage), y0, Color.BLACK);
if (shortCircuit != null) { if (shortCircuit != null) {

View File

@ -102,9 +102,18 @@ public class PartLight extends PartOther {
@Override @Override
protected void _labels(final Graphics2D g) { protected void _labels(final Graphics2D g) {
textCenter(g, LABEL_FONT, "%.1fV (max)".formatted(maxVoltage), P05, Color.BLACK); final int y0;
final int y1;
if (getOrientation() == Orientation.R180) {
y0 = P95 - LABEL_FONT.getSize();
y1 = P05;
} else {
y0 = P05;
y1 = P95 - LABEL_FONT.getSize();
}
textCenter(g, LABEL_FONT, "%.1fV (max)".formatted(maxVoltage), y0, Color.BLACK);
if (defect) { if (defect) {
textCenter(g, LABEL_FONT, "DEFEKT", P95 - LABEL_FONT.getSize(), Color.RED); textCenter(g, LABEL_FONT, "DEFEKT", y1, Color.RED);
} }
} }