feat(renderer): fix drawing logic in CustomSlider

This commit is contained in:
extio-de
2025-12-29 13:08:36 +01:00
parent 2ebb8aafda
commit 0941cf21cc

View File

@@ -206,11 +206,16 @@ public class CustomSlider extends Component {
// Main line
if (this.horizontal) {
this.drawLine(g2d, h, s, b, 0, this.getHeight() / 2, this.getWidth(), this.getHeight() / 2, this.horizontal);
}
else {
this.drawLine(g2d, h, s, b, this.getWidth() / 2, 0, this.getWidth() / 2, this.getHeight(), this.horizontal);
}
// Small lines
b -= 0.20F;
final var length = this.horizontal ? this.getWidth() : this.getHeight();
for (var i = 1; i < 10; i++) {
final var pos = (int) ((double) length / 10.0 * i);
final int length = this.horizontal ? this.getWidth() : this.getHeight();
for (int i = 1; i < 10; i++) {
final int pos = (int) ((double) length / 10.0 * i);
if (this.horizontal) {
this.drawLine(g2d, h, s, b, pos, this.getHeight() / 4, pos, this.getHeight() / 4 * 3, !this.horizontal);
}
@@ -254,7 +259,6 @@ public class CustomSlider extends Component {
this.drawLine(g2d, h, s, b, 0, (int) (this.getHeight() * (1.0 - this.value)), this.getWidth(), (int) (this.getHeight() * (1.0 - this.value)), !this.horizontal);
}
}
}
private void applyColor(final Graphics2D g2d, float h, float s, float b) {
h = Math.max(0.0f, Math.min(1.0f, h));