fix scrolling in option menu by dragging mouse when it's not hovering the menu

This commit is contained in:
yugecin 2018-10-03 23:12:50 +02:00
parent 2b954f6c7c
commit 19392ef2d0
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44

View File

@ -150,6 +150,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
private int mousePressY; private int mousePressY;
private boolean isDraggingFromOutside;
private boolean wasPressed; private boolean wasPressed;
private boolean keyEntryLeft; private boolean keyEntryLeft;
@ -830,7 +831,11 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
} }
public boolean mousePressed(int button, int x, int y) { 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; return false;
} }
@ -862,6 +867,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
} }
public boolean mouseReleased(int button, int x, int y) { public boolean mouseReleased(int button, int x, int y) {
this.isDraggingFromOutside = false;
if (!this.active || (!wasPressed && x > this.currentWidth)) { if (!this.active || (!wasPressed && x > this.currentWidth)) {
return false; return false;
} }
@ -954,7 +960,7 @@ public class OptionsOverlay implements ResolutionChangedListener, SkinChangedLis
} }
public boolean mouseDragged(int oldx, int oldy, int newx, int newy) { public boolean mouseDragged(int oldx, int oldy, int newx, int newy) {
if (!this.active) { if (!this.active || this.isDraggingFromOutside) {
return false; return false;
} }