mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
@@ -111,3 +111,4 @@ fabric.properties
|
|||||||
# Resource Metadata
|
# Resource Metadata
|
||||||
*.meta
|
*.meta
|
||||||
*.registry
|
*.registry
|
||||||
|
.DS_Store
|
||||||
|
|||||||
@@ -529,8 +529,22 @@ pub fn translate_event(event: &WindowEvent) -> Option<OsEvent> {
|
|||||||
WindowEvent::MouseWheel { delta, .. } => match delta {
|
WindowEvent::MouseWheel { delta, .. } => match delta {
|
||||||
MouseScrollDelta::LineDelta(x, y) => Some(OsEvent::MouseWheel(*x, *y)),
|
MouseScrollDelta::LineDelta(x, y) => Some(OsEvent::MouseWheel(*x, *y)),
|
||||||
MouseScrollDelta::PixelDelta(pos) => {
|
MouseScrollDelta::PixelDelta(pos) => {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
// macOS trackpads emits pixel deltas; scale to line-like units to avoid excessive scroll speed.
|
||||||
|
const PIXELS_PER_LINE: f32 = 100.0;
|
||||||
|
|
||||||
|
Some(OsEvent::MouseWheel(
|
||||||
|
pos.x as f32 / PIXELS_PER_LINE,
|
||||||
|
pos.y as f32 / PIXELS_PER_LINE,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
{
|
||||||
Some(OsEvent::MouseWheel(pos.x as f32, pos.y as f32))
|
Some(OsEvent::MouseWheel(pos.x as f32, pos.y as f32))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
WindowEvent::MouseInput { state, button, .. } => Some(OsEvent::MouseInput {
|
WindowEvent::MouseInput { state, button, .. } => Some(OsEvent::MouseInput {
|
||||||
button: translate_button(*button),
|
button: translate_button(*button),
|
||||||
|
|||||||
Reference in New Issue
Block a user