variable consistency

This commit is contained in:
yugecin 2016-12-12 18:46:32 +01:00
parent 53278409fa
commit 4f995c4eb8

View File

@ -382,12 +382,11 @@ public class OptionsOverlay {
} }
mousePressY = y; mousePressY = y;
selectedOption = hoverOption;
if (selectedOption != null) { if (hoverOption != null) {
if (selectedOption.getListItems() != null) { if (hoverOption.getListItems() != null) {
isListOptionOpen = true; isListOptionOpen = true;
} else if (selectedOption.getType() == OptionType.NUMERIC) { } else if (hoverOption.getType() == OptionType.NUMERIC) {
isAdjustingSlider = sliderOptionStartX <= x && x < sliderOptionStartX + sliderOptionLength; isAdjustingSlider = sliderOptionStartX <= x && x < sliderOptionStartX + sliderOptionLength;
if (isAdjustingSlider) { if (isAdjustingSlider) {
updateSliderOption(x, y); updateSliderOption(x, y);
@ -478,10 +477,10 @@ public class OptionsOverlay {
} }
private void updateSliderOption(int mouseX, int mouseY) { private void updateSliderOption(int mouseX, int mouseY) {
int min = selectedOption.getMinValue(); int min = hoverOption.getMinValue();
int max = selectedOption.getMaxValue(); int max = hoverOption.getMaxValue();
int value = min + Math.round((float) (max - min) * (mouseX - sliderOptionStartX) / (sliderOptionLength)); int value = min + Math.round((float) (max - min) * (mouseX - sliderOptionStartX) / (sliderOptionLength));
selectedOption.setValue(Utils.clamp(value, min, max)); hoverOption.setValue(Utils.clamp(value, min, max));
} }
private void updateHoverOption(int mouseX, int mouseY) { private void updateHoverOption(int mouseX, int mouseY) {