-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #2327 Mouse pointer moves to centre of canvas on click in OpenGL3 with Swing #2328
base: master
Are you sure you want to change the base?
Fix for #2327 Mouse pointer moves to centre of canvas on click in OpenGL3 with Swing #2328
Conversation
… click in OpenGL3 with Swing Modify FlyByCamera to only hide the mouse cursor when the user actually rotates the camera, rather than when the user first presses the left mouse button. When the mouse is clicked, instead of immediately hiding the cursor, a flag (hideCursorOnNextRotate) is set. If and when a rotate is detected, the flag is checked and if true the cursor is hidden and the flag is cleared.
I tested the behavior of While this isn’t overly inconvenient and you can get used to it, it’s worth noting that If your goal is to develop an editor with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these changes introduce functionally different behaviors (particularly on glfw applications), I'd suggest adding an option to disable or enable the changes, with it disabled by default.
Also, I don't foresee there being any problems, but it would be good to make sure nothing unexpected happens when using glfw with any opengl versions along with these changes.
if(value) { | ||
hideCursorOnNextRotate = true; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to } else {
(one line)
if(hideCursorOnNextRotate) { | ||
inputManager.setCursorVisible(false); | ||
hideCursorOnNextRotate = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be changed to
if (!canRotate) {
return;
} else if (hideCursorOnNextRotate) {
inputManager.setCursorVisible(false);
hideCursorOnNextRotate = false;
}
Modify FlyByCamera to only hide the mouse cursor when the user actually rotates the camera, rather than when the user first presses the left mouse button. When the mouse is clicked, instead of immediately hiding the cursor, a flag (hideCursorOnNextRotate) is set. If and when a rotate is detected, the flag is checked and if true the cursor is hidden and the flag is cleared.