feat(renderer): fix drawing logic in CustomSlider
This commit is contained in:
@@ -206,11 +206,16 @@ public class CustomSlider extends Component {
|
|||||||
// Main line
|
// Main line
|
||||||
if (this.horizontal) {
|
if (this.horizontal) {
|
||||||
this.drawLine(g2d, h, s, b, 0, this.getHeight() / 2, this.getWidth(), this.getHeight() / 2, 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
|
// Small lines
|
||||||
b -= 0.20F;
|
b -= 0.20F;
|
||||||
final var length = this.horizontal ? this.getWidth() : this.getHeight();
|
final int length = this.horizontal ? this.getWidth() : this.getHeight();
|
||||||
for (var i = 1; i < 10; i++) {
|
for (int i = 1; i < 10; i++) {
|
||||||
final var pos = (int) ((double) length / 10.0 * i);
|
final int pos = (int) ((double) length / 10.0 * i);
|
||||||
if (this.horizontal) {
|
if (this.horizontal) {
|
||||||
this.drawLine(g2d, h, s, b, pos, this.getHeight() / 4, pos, this.getHeight() / 4 * 3, !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);
|
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) {
|
private void applyColor(final Graphics2D g2d, float h, float s, float b) {
|
||||||
h = Math.max(0.0f, Math.min(1.0f, h));
|
h = Math.max(0.0f, Math.min(1.0f, h));
|
||||||
|
|||||||
Reference in New Issue
Block a user