Skip to content

Commit d8ac876

Browse files
committed
fix: cast mouse coordinates in use_draggable to f64
Also fixes all client_x() and client_y() usages in use_draggable.rs to cast from i32 to f64 for compatibility with wasm-bindgen 0.2.113.
1 parent 3885aaa commit d8ac876

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/use_draggable.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ where
119119
}
120120

121121
let position = Position {
122-
x: event.client_x() - x,
123-
y: event.client_y() - y,
122+
x: event.client_x() as f64 - x,
123+
y: event.client_y() as f64 - y,
124124
};
125125

126126
#[cfg(debug_assertions)]
@@ -153,8 +153,8 @@ where
153153
}
154154
if let Some(start_position) = start_position.get_untracked() {
155155
let position = Position {
156-
x: event.client_x() - start_position.x,
157-
y: event.client_y() - start_position.y,
156+
x: event.client_x() as f64 - start_position.x,
157+
y: event.client_y() as f64 - start_position.y,
158158
};
159159
set_position.set(position);
160160

0 commit comments

Comments
 (0)