mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 23:23:14 -04:00
On Web, implement Send and Sync where appropriate (#2834)
This commit is contained in:
@@ -79,14 +79,17 @@ pub fn mouse_position_by_client(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mouse_scroll_delta(event: &WheelEvent) -> Option<MouseScrollDelta> {
|
||||
pub fn mouse_scroll_delta(
|
||||
window: &web_sys::Window,
|
||||
event: &WheelEvent,
|
||||
) -> Option<MouseScrollDelta> {
|
||||
let x = -event.delta_x();
|
||||
let y = -event.delta_y();
|
||||
|
||||
match event.delta_mode() {
|
||||
WheelEvent::DOM_DELTA_LINE => Some(MouseScrollDelta::LineDelta(x as f32, y as f32)),
|
||||
WheelEvent::DOM_DELTA_PIXEL => {
|
||||
let delta = LogicalPosition::new(x, y).to_physical(super::scale_factor());
|
||||
let delta = LogicalPosition::new(x, y).to_physical(super::scale_factor(window));
|
||||
Some(MouseScrollDelta::PixelDelta(delta))
|
||||
}
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user