fix sliders
This commit is contained in:
parent
498c2a61ff
commit
a021901ad7
2 changed files with 8 additions and 8 deletions
|
@ -39,9 +39,9 @@ public class IntSlider extends Component {
|
|||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
Gui.drawRect(x, y + 13, x + 151, y + 14, GUIManager.sliderBackground);
|
||||
Gui.drawRect((int) Math.floor(x + f * 150), y + 11, (int) Math.floor(x + f * 150) + 1, y + 16, GUIManager.sliderColor);
|
||||
fontRenderer.drawString(sliderText.apply(Math.round(f * mapper + adder)), x + 150 + 4, y + 10, GUIManager.sliderColor);
|
||||
Gui.drawRect(x, y + 13, x + 141, y + 14, GUIManager.sliderBackground);
|
||||
Gui.drawRect((int) Math.floor(x + f * 140), y + 11, (int) Math.floor(x + f * 140) + 1, y + 16, GUIManager.sliderColor);
|
||||
fontRenderer.drawString(sliderText.apply(Math.round(f * mapper + adder)), x + 140 + 4, y + 10, GUIManager.sliderColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +94,7 @@ public class IntSlider extends Component {
|
|||
return;
|
||||
}
|
||||
if(mouseButton == 0) {
|
||||
f = Math.max(Math.min(x, 100), 0) / 100f;
|
||||
f = Math.max(Math.min(x, 140), 0) / 140f;
|
||||
|
||||
handle.getContent().set(field, Math.round(f * mapper + adder));
|
||||
handle.updated(field);
|
||||
|
|
|
@ -39,9 +39,9 @@ public class Slider extends Component {
|
|||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
Gui.drawRect(x, y + 13, x + 151, y + 14, GUIManager.sliderBackground);
|
||||
Gui.drawRect((int) Math.floor(x + f * 150), y + 11, (int) Math.floor(x + f * 150) + 1, y + 16, GUIManager.sliderColor);
|
||||
fontRenderer.drawString(sliderText.apply(f * mapper + adder), x + 150 + 4, y + 10, GUIManager.sliderColor);
|
||||
Gui.drawRect(x, y + 13, x + 141, y + 14, GUIManager.sliderBackground);
|
||||
Gui.drawRect((int) Math.floor(x + f * 140), y + 11, (int) Math.floor(x + f * 140) + 1, y + 16, GUIManager.sliderColor);
|
||||
fontRenderer.drawString(sliderText.apply(f * mapper + adder), x + 140 + 4, y + 10, GUIManager.sliderColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,7 +92,7 @@ public class Slider extends Component {
|
|||
return;
|
||||
}
|
||||
if(mouseButton == 0) {
|
||||
f = Math.max(Math.min(x, 100), 0) / 100f;
|
||||
f = Math.max(Math.min(x, 140), 0) / 140f;
|
||||
|
||||
handle.getContent().set(field, f * mapper + adder);
|
||||
handle.updated(field);
|
||||
|
|
Loading…
Add table
Reference in a new issue