optionoverlay: fix crash when hovering over navigation while adjusting
slider
This commit is contained in:
parent
4046cfaca4
commit
b540be8736
|
@ -842,8 +842,8 @@ public class OptionsOverlay implements ResolutionChangedListener {
|
||||||
listener.onSaveOption(hoverOption);
|
listener.onSaveOption(hoverOption);
|
||||||
}
|
}
|
||||||
updateHoverOption(x, y);
|
updateHoverOption(x, y);
|
||||||
}
|
|
||||||
isAdjustingSlider = false;
|
isAdjustingSlider = false;
|
||||||
|
}
|
||||||
sliderOptionLength = 0;
|
sliderOptionLength = 0;
|
||||||
|
|
||||||
if (x > navWidth) {
|
if (x > navWidth) {
|
||||||
|
@ -968,9 +968,7 @@ public class OptionsOverlay implements ResolutionChangedListener {
|
||||||
|
|
||||||
if (key == Keyboard.KEY_ESCAPE) {
|
if (key == Keyboard.KEY_ESCAPE) {
|
||||||
if (isAdjustingSlider) {
|
if (isAdjustingSlider) {
|
||||||
isAdjustingSlider = false;
|
cancelAdjustingSlider();
|
||||||
((NumericOption) hoverOption).setValue(unchangedSliderValue);
|
|
||||||
//updateHoverOption(mouseX, mouseY);
|
|
||||||
}
|
}
|
||||||
if (openDropdownMenu != null) {
|
if (openDropdownMenu != null) {
|
||||||
openDropdownMenu.keyPressed(key, c);
|
openDropdownMenu.keyPressed(key, c);
|
||||||
|
@ -1017,6 +1015,13 @@ public class OptionsOverlay implements ResolutionChangedListener {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelAdjustingSlider() {
|
||||||
|
if (isAdjustingSlider) {
|
||||||
|
isAdjustingSlider = false;
|
||||||
|
((NumericOption) hoverOption).setValue(unchangedSliderValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSliderOption() {
|
private void updateSliderOption() {
|
||||||
NumericOption o = (NumericOption) hoverOption;
|
NumericOption o = (NumericOption) hoverOption;
|
||||||
int value = o.min + Math.round((float) (o.max - o.min) * (mouseX - sliderOptionStartX) / (sliderOptionLength));
|
int value = o.min + Math.round((float) (o.max - o.min) * (mouseX - sliderOptionStartX) / (sliderOptionLength));
|
||||||
|
@ -1051,6 +1056,7 @@ public class OptionsOverlay implements ResolutionChangedListener {
|
||||||
|
|
||||||
private void updateHoverOption(int mouseX, int mouseY) {
|
private void updateHoverOption(int mouseX, int mouseY) {
|
||||||
if (mouseX < navWidth) {
|
if (mouseX < navWidth) {
|
||||||
|
cancelAdjustingSlider();
|
||||||
hoverOption = null;
|
hoverOption = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user