mirror of
https://github.com/GTNewHorizons/lwjgl3ify.git
synced 2026-11-26 23:13:01 +00:00
Ignore one mouse movement event after cursor ungrabbing to prevent a stale cursor position in GUIs.
This commit is contained in:
1 parent
c47e58af4c
commit
7aa1195f1e
1 file changed
+7
@@ -47,8 +47,13 @@ public class Mouse {
|
||||
|
||||
private static boolean clipPostionToDisplay = true;
|
||||
private static boolean ignoreNextDelta = false;
|
||||
private static boolean ignoreNextMove = false;
|
||||
|
||||
public static void addMoveEvent(double mouseX, double mouseY) {
|
||||
if (ignoreNextMove) {
|
||||
ignoreNextMove = false;
|
||||
return;
|
||||
}
|
||||
latestX = (int) mouseX;
|
||||
latestY = Display.getHeight() - (int) mouseY;
|
||||
if (ignoreNextDelta) {
|
||||
@@ -241,6 +246,8 @@ public class Mouse {
|
||||
return;
|
||||
}
|
||||
GLFW.glfwSetCursorPos(Display.getWindow(), new_x, new_y);
|
||||
addMoveEvent(new_x, new_y);
|
||||
ignoreNextMove = true;
|
||||
}
|
||||
|
||||
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
|
||||
|
||||
Reference in new issue
Block a user