mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 06:10:07 -04:00
Fix vertical scroll being inverted on web targets (#1665)
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
- On iOS and Android, `set_inner_size` is now a no-op instead of a runtime crash.
|
- On iOS and Android, `set_inner_size` is now a no-op instead of a runtime crash.
|
||||||
- On Android, fix `ControlFlow::Poll` not polling the Android event queue.
|
- On Android, fix `ControlFlow::Poll` not polling the Android event queue.
|
||||||
- On macOS, add `NSWindow.hasShadow` support.
|
- On macOS, add `NSWindow.hasShadow` support.
|
||||||
|
- On Web, fix vertical mouse wheel scrolling being inverted.
|
||||||
- **Breaking:** On Web, `set_cursor_position` and `set_cursor_grab` will now always return an error.
|
- **Breaking:** On Web, `set_cursor_position` and `set_cursor_grab` will now always return an error.
|
||||||
- **Breaking:** `PixelDelta` scroll events now return a `PhysicalPosition`.
|
- **Breaking:** `PixelDelta` scroll events now return a `PhysicalPosition`.
|
||||||
- On NetBSD, fixed crash due to incorrect detection of the main thread.
|
- On NetBSD, fixed crash due to incorrect detection of the main thread.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ pub fn mouse_position(event: &impl IMouseEvent) -> LogicalPosition<f64> {
|
|||||||
|
|
||||||
pub fn mouse_scroll_delta(event: &MouseWheelEvent) -> Option<MouseScrollDelta> {
|
pub fn mouse_scroll_delta(event: &MouseWheelEvent) -> Option<MouseScrollDelta> {
|
||||||
let x = event.delta_x();
|
let x = event.delta_x();
|
||||||
let y = event.delta_y();
|
let y = -event.delta_y();
|
||||||
|
|
||||||
match event.delta_mode() {
|
match event.delta_mode() {
|
||||||
MouseWheelDeltaMode::Line => Some(MouseScrollDelta::LineDelta(x as f32, y as f32)),
|
MouseWheelDeltaMode::Line => Some(MouseScrollDelta::LineDelta(x as f32, y as f32)),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub fn mouse_position(event: &MouseEvent) -> LogicalPosition<f64> {
|
|||||||
|
|
||||||
pub fn mouse_scroll_delta(event: &WheelEvent) -> Option<MouseScrollDelta> {
|
pub fn mouse_scroll_delta(event: &WheelEvent) -> Option<MouseScrollDelta> {
|
||||||
let x = event.delta_x();
|
let x = event.delta_x();
|
||||||
let y = event.delta_y();
|
let y = -event.delta_y();
|
||||||
|
|
||||||
match event.delta_mode() {
|
match event.delta_mode() {
|
||||||
WheelEvent::DOM_DELTA_LINE => Some(MouseScrollDelta::LineDelta(x as f32, y as f32)),
|
WheelEvent::DOM_DELTA_LINE => Some(MouseScrollDelta::LineDelta(x as f32, y as f32)),
|
||||||
|
|||||||
Reference in New Issue
Block a user