You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The position value received with WindowEvent::CursorMoved { position, .. }, ... is incorrect when a mouse button is being held and the pointer crosses over the left or top edge of the window.
Instead of the proper negative value, position contains 65536.0 - offset to window edge, this is obviously the result of some intermediate conversion to u16 before position is turned into PhysicalPosition<f64> and given to the event. I believe this problem was introduced in the last update to winit, but I am not positive.
For now, I have worked around the problem as follows:
Event::WindowEvent {
event: WindowEvent::CursorMoved { position, .. },
..
} => {
let px = if position.x > 32767.0 {
(position.x - 65536.0)
} else {
position.x
};
let py = if position.y > 32767.0 {
(position.y - 65536.0)
} else {
position.y
};
// ... use `vec2(px, py)` instead of `position`...
I have only tried this on Windows, I am not sure the problem exists on other platforms.
A=
The text was updated successfully, but these errors were encountered:
apessino
changed the title
Incorrect position with CursorMoved even when dragging out of window left/top with mouse button pressed
Incorrect position with CursorMoved when dragging out of window left/top with mouse button pressed
May 30, 2022
The
position
value received withWindowEvent::CursorMoved { position, .. }, ...
is incorrect when a mouse button is being held and the pointer crosses over the left or top edge of the window.Instead of the proper negative value,
position
contains65536.0 - offset to window edge
, this is obviously the result of some intermediate conversion tou16
beforeposition
is turned intoPhysicalPosition<f64>
and given to the event. I believe this problem was introduced in the last update towinit
, but I am not positive.For now, I have worked around the problem as follows:
I have only tried this on Windows, I am not sure the problem exists on other platforms.
A=
The text was updated successfully, but these errors were encountered: