From 4f995c4eb816cd1182f52ed360c9b3e70c7279be Mon Sep 17 00:00:00 2001 From: yugecin Date: Mon, 12 Dec 2016 18:46:32 +0100 Subject: [PATCH] variable consistency --- src/yugecin/opsudance/ui/OptionsOverlay.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index ceddac0d..6537f597 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -382,12 +382,11 @@ public class OptionsOverlay { } mousePressY = y; - selectedOption = hoverOption; - if (selectedOption != null) { - if (selectedOption.getListItems() != null) { + if (hoverOption != null) { + if (hoverOption.getListItems() != null) { isListOptionOpen = true; - } else if (selectedOption.getType() == OptionType.NUMERIC) { + } else if (hoverOption.getType() == OptionType.NUMERIC) { isAdjustingSlider = sliderOptionStartX <= x && x < sliderOptionStartX + sliderOptionLength; if (isAdjustingSlider) { updateSliderOption(x, y); @@ -478,10 +477,10 @@ public class OptionsOverlay { } private void updateSliderOption(int mouseX, int mouseY) { - int min = selectedOption.getMinValue(); - int max = selectedOption.getMaxValue(); + int min = hoverOption.getMinValue(); + int max = hoverOption.getMaxValue(); 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) {