Don't discard high-precision cursor position data (#1375)
* Don't discard high-precision cursor position data Most platforms (X11, wayland, macos, stdweb, ...) provide physical positions in f64 units, which can contain meaningful fractional data. For example, this can be empirically observed on modern X11 using a typical laptop touchpad. This is useful for e.g. content creation tools, where cursor motion might map to brush strokes on a canvas with higher-than-screen resolution, or positioning of an object in a vector space. * Update CHANGELOG.md Co-Authored-By: Murarth <murarth@gmail.com> Co-authored-by: Murarth <murarth@gmail.com>
This commit is contained in:
parent
09c4ed0694
commit
4b618bd6a6
6 changed files with 9 additions and 11 deletions
|
|
@ -723,8 +723,7 @@ impl<T: 'static> EventProcessor<T> {
|
|||
util::maybe_change(&mut shared_state_lock.cursor_pos, new_cursor_pos)
|
||||
});
|
||||
if cursor_moved == Some(true) {
|
||||
let position =
|
||||
PhysicalPosition::new(xev.event_x as i32, xev.event_y as i32);
|
||||
let position = PhysicalPosition::new(xev.event_x, xev.event_y);
|
||||
|
||||
callback(Event::WindowEvent {
|
||||
window_id,
|
||||
|
|
@ -830,8 +829,7 @@ impl<T: 'static> EventProcessor<T> {
|
|||
event: CursorEntered { device_id },
|
||||
});
|
||||
|
||||
let position =
|
||||
PhysicalPosition::new(xev.event_x as i32, xev.event_y as i32);
|
||||
let position = PhysicalPosition::new(xev.event_x, xev.event_y);
|
||||
|
||||
// The mods field on this event isn't actually populated, so query the
|
||||
// pointer device. In the future, we can likely remove this round-trip by
|
||||
|
|
@ -899,8 +897,7 @@ impl<T: 'static> EventProcessor<T> {
|
|||
.map(|device| device.attachment)
|
||||
.unwrap_or(2);
|
||||
|
||||
let position =
|
||||
PhysicalPosition::new(xev.event_x as i32, xev.event_y as i32);
|
||||
let position = PhysicalPosition::new(xev.event_x, xev.event_y);
|
||||
|
||||
callback(Event::WindowEvent {
|
||||
window_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue