-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Set cursor updates #993
Set cursor updates #993
Conversation
let window = winit_windows.get_window(id).unwrap(); | ||
let inner_size = window.inner_size().to_logical::<f32>(window.scale_factor()); |
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.
You might be able to get rid of the type hint here since you have subtraction below which assigns to an f32
, which should hint the compiler enough to figure it out, I haven't tested that but it feels like it would be the case.
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.
I tried but the compiler can't figure it out.
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.
I'm also very cool with explicit types in cases like this, even if they can be inferred. Helps convey intent / protects against implict behavior changes when types change
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.
I am disappointed in the compiler ):
this allows fractional coordinates to work correctly
in `CursorMoved` events
Looks good to me! Resolve the conflict and I think we can merge this. |
7f08e41
to
bc9562b
Compare
This patch alters the
Window::set_cursor_position
API to take a Vec2 in the same coordinate system as theCursorMoved
event.The change to floating point allows more precise positioning in high DPI contexts. The coordinate system change and use of
Vec2
makes things consistent with theCursorMoved
event.