fix back button being clickthrough in option overlay

This commit is contained in:
yugecin 2018-10-02 22:55:52 +02:00
parent 8e272df5fc
commit 226944b658
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44

View File

@ -655,6 +655,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
searchField.setFocused(false); searchField.setFocused(false);
hideAnimationTime = animationtime; hideAnimationTime = animationtime;
hideAnimationStartProgress = (float) animationtime / SHOWANIMATIONTIME; hideAnimationStartProgress = (float) animationtime / SHOWANIMATIONTIME;
hoverOption = null;
} }
public void show() { public void show() {
@ -862,6 +863,15 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
} }
sliderOptionLength = 0; sliderOptionLength = 0;
if (backButton.contains(x, y)){
SoundController.playSound(SoundEffect.MENUBACK);
hide();
if (listener != null) {
listener.onLeaveOptionsMenu();
}
return true;
}
if (x > navWidth) { if (x > navWidth) {
if (openDropdownMenu != null) { if (openDropdownMenu != null) {
openDropdownMenu.mouseReleased(button); openDropdownMenu.mouseReleased(button);
@ -925,14 +935,6 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
sectionPosition = Utils.clamp(sectionPosition, (int) scrollHandler.min, (int) scrollHandler.max); sectionPosition = Utils.clamp(sectionPosition, (int) scrollHandler.min, (int) scrollHandler.max);
scrollHandler.scrollToPosition(sectionPosition); scrollHandler.scrollToPosition(sectionPosition);
} }
if (backButton.contains(x, y)){
SoundController.playSound(SoundEffect.MENUBACK);
hide();
if (listener != null) {
listener.onLeaveOptionsMenu();
}
}
return true; return true;
} }