fix: use floats for pointer events (#4708)

* fix: use f64 for PointerInteraction

* make clippy happy on beta

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Timur GainullinandJonathan Kelley authored and GitHub committed 2025-10-03 19:39:00 -07:00
1 parent 12fab0f9f7
commit f48aec7eff
11 files changed
+51 -91

No files matched your search

+8 -8
View File
@@ -75,10 +75,10 @@ pub trait HasPointerData: PointerInteraction {
fn pointer_id(&self) -> i32;
/// Gets the width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.
fn width(&self) -> i32;
fn width(&self) -> f64;
/// Gets the height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
fn height(&self) -> i32;
fn height(&self) -> f64;
/// Gets the normalized pressure of the pointer input in the range of 0 to 1,
fn pressure(&self) -> f32;
@@ -145,12 +145,12 @@ impl PointerData {
}
/// Gets the width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.
pub fn width(&self) -> i32 {
pub fn width(&self) -> f64 {
self.inner.width()
}
/// Gets the height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
pub fn height(&self) -> i32 {
pub fn height(&self) -> f64 {
self.inner.height()
}
@@ -238,10 +238,10 @@ pub struct SerializedPointerData {
pointer_id: i32,
/// The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.
width: i32,
width: f64,
/// The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
height: i32,
height: f64,
/// The normalized pressure of the pointer input in the range of 0 to 1,
pressure: f32,
@@ -271,11 +271,11 @@ impl HasPointerData for SerializedPointerData {
self.pointer_id
}
fn width(&self) -> i32 {
fn width(&self) -> f64 {
self.width
}
fn height(&self) -> i32 {
fn height(&self) -> f64 {
self.height
}
+8 -8
View File
@@ -26,11 +26,11 @@ impl ScrollData {
self.inner.as_any().downcast_ref::<T>()
}
pub fn scroll_top(&self) -> i32 {
pub fn scroll_top(&self) -> f64 {
self.inner.scroll_top()
}
pub fn scroll_left(&self) -> i32 {
pub fn scroll_left(&self) -> f64 {
self.inner.scroll_left()
}
@@ -79,8 +79,8 @@ impl PartialEq for ScrollData {
/// A serialized version of ScrollData
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
pub struct SerializedScrollData {
pub scroll_top: i32,
pub scroll_left: i32,
pub scroll_top: f64,
pub scroll_left: f64,
pub scroll_width: i32,
pub scroll_height: i32,
pub client_width: i32,
@@ -107,11 +107,11 @@ impl HasScrollData for SerializedScrollData {
self
}
fn scroll_top(&self) -> i32 {
fn scroll_top(&self) -> f64 {
self.scroll_top
}
fn scroll_left(&self) -> i32 {
fn scroll_left(&self) -> f64 {
self.scroll_left
}
@@ -154,10 +154,10 @@ pub trait HasScrollData: std::any::Any {
fn as_any(&self) -> &dyn std::any::Any;
/// Get the vertical scroll position
fn scroll_top(&self) -> i32;
fn scroll_top(&self) -> f64;
/// Get the horizontal scroll position
fn scroll_left(&self) -> i32;
fn scroll_left(&self) -> f64;
/// Get the total scrollable width
fn scroll_width(&self) -> i32;