From 19392ef2d0b668b2bd052e96e04c5750c64bfd4e Mon Sep 17 00:00:00 2001 From: yugecin Date: Wed, 3 Oct 2018 23:12:50 +0200 Subject: [PATCH] fix scrolling in option menu by dragging mouse when it's not hovering the menu --- src/yugecin/opsudance/ui/OptionsOverlay.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index 1638a336..8c847b23 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -150,6 +150,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis private int mousePressY; + private boolean isDraggingFromOutside; private boolean wasPressed; private boolean keyEntryLeft; @@ -830,7 +831,11 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis } public boolean mousePressed(int button, int x, int y) { - if (!this.active || x > this.currentWidth) { + if (!this.active) { + return false; + } + if (x > this.currentWidth) { + this.isDraggingFromOutside = true; return false; } @@ -862,6 +867,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis } public boolean mouseReleased(int button, int x, int y) { + this.isDraggingFromOutside = false; if (!this.active || (!wasPressed && x > this.currentWidth)) { return false; } @@ -954,7 +960,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis } public boolean mouseDragged(int oldx, int oldy, int newx, int newy) { - if (!this.active) { + if (!this.active || this.isDraggingFromOutside) { return false; }