Merged
Conversation
ambeeeeee
reviewed
Dec 3, 2020
| bevy_window::WindowCommand::SetCursorPosition { x, y } => { | ||
| bevy_window::WindowCommand::SetCursorPosition { position } => { | ||
| let window = winit_windows.get_window(id).unwrap(); | ||
| let inner_size = window.inner_size().to_logical::<f32>(window.scale_factor()); |
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
I tried but the compiler can't figure it out.
Member
There was a problem hiding this comment.
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
Contributor
There was a problem hiding this comment.
I am disappointed in the compiler ):
added 2 commits
December 3, 2020 11:55
this allows fractional coordinates to work correctly
in `CursorMoved` events
Member
|
Looks good to me! Resolve the conflict and I think we can merge this. |
7f08e41 to
bc9562b
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch alters the
Window::set_cursor_positionAPI to take a Vec2 in the same coordinate system as theCursorMovedevent.The change to floating point allows more precise positioning in high DPI contexts. The coordinate system change and use of
Vec2makes things consistent with theCursorMovedevent.