-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 mouse position not being scaled when window size is changed #57082
Conversation
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.
Good catch! Thanks!
Is there a possible workaround available until this gets backported? |
@kinesivan This PR won't be backported. The issues that this PR fixed only affected the master branch. If you have a separate issue that affects the 3.x branch that hasn't already been raised then you should raise a new issue. |
@kinesivan you have to manipulate the mouse coordinates, here is how I did it in Godot 3.x func _unhandled_input(event):
if event is InputEventMouseButton:
event.position = event.position * scale_factor |
@madmiraal Well, on the first issue on the matter #52295 the version of the OP may have been 4.0, though there is more than one comment mentioning different versions of 3.x where the problem persists. To be honest could have been handled in the same swoop. @Calinou Should I open a new Issue for 3.5 onwards? Just ran into the same problem while working on my project on 3.x versions of the engine. |
Yes, please open a separate issue with a minimal reproduction project attached. |
Currently, when the window size is changed, the
Viewport
'sto_screen_rect
variable is not updated. Furthermore, when it is updated, the ratio of windows size to viewport size is calculated using integer division, which generally results in a value of 0 or 1 for each dimension. This PR fixes both issues.Fixes #44915
Fixes #50802
Fixes #52295