Switch to WheelHiRes. Add horizontal scrolling (#171)

* Switch to HiResScroll. Add horizontal scrolling

* Fix OpenVR compilation for horizontal scrolling

* fix OpenXR scroll using x axis for both scroll axes
This commit is contained in:
AdiMCS
2025-03-09 10:20:10 -07:00
committed by GitHub
parent 36074307b7
commit b0883e81bf
14 changed files with 77 additions and 60 deletions
+7 -4
View File
@@ -6,7 +6,7 @@ use std::{
use glam::{bool, Affine3A, Quat, Vec3};
use libmonado as mnd;
use openxr::{self as xr, Quaternionf, Vector3f};
use openxr::{self as xr, Quaternionf, Vector2f, Vector3f};
use serde::{Deserialize, Serialize};
use crate::{
@@ -161,7 +161,7 @@ pub(super) struct OpenXrHandSource {
action_modifier_right: CustomClickAction,
action_modifier_middle: CustomClickAction,
action_move_mouse: CustomClickAction,
action_scroll: xr::Action<f32>,
action_scroll: xr::Action<Vector2f>,
action_haptics: xr::Action<xr::Haptic>,
}
@@ -350,12 +350,15 @@ impl OpenXrHand {
.action_grab
.state(pointer.before.grab, xr, session)?;
pointer.now.scroll = self
let scroll = self
.source
.action_scroll
.state(&xr.session, xr::Path::NULL)?
.current_state;
pointer.now.scroll_x = scroll.x;
pointer.now.scroll_y = scroll.y;
pointer.now.alt_click =
self.source
.action_alt_click
@@ -417,7 +420,7 @@ impl OpenXrHandSource {
&[],
)?;
let action_scroll = action_set.create_action::<f32>(
let action_scroll = action_set.create_action::<Vector2f>(
&format!("{}_scroll", side),
&format!("{} hand scroll", side),
&[],
+20
View File
@@ -81,6 +81,10 @@
left: "/user/hand/left/input/thumbstick/y",
right: "/user/hand/right/input/thumbstick/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/thumbstick/x",
right: "/user/hand/right/input/thumbstick/x"
},
show_hide: {
double_click: true,
left: "/user/hand/left/input/y/click",
@@ -129,6 +133,10 @@
scroll: {
left: "/user/hand/left/input/thumbstick/y",
right: "/user/hand/right/input/thumbstick/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/thumbstick/x",
right: "/user/hand/right/input/thumbstick/x"
},
toggle_dashboard: {
double_click: false,
@@ -180,6 +188,10 @@
left: "/user/hand/left/input/trackpad/y",
right: "/user/hand/right/input/trackpad/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/trackpad/x",
right: "/user/hand/right/input/trackpad/x"
},
show_hide: {
left: "/user/hand/left/input/menu/click",
},
@@ -215,6 +227,10 @@
left: "/user/hand/left/input/thumbstick/y",
right: "/user/hand/right/input/thumbstick/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/thumbstick/x",
right: "/user/hand/right/input/thumbstick/x"
},
show_hide: {
left: "/user/hand/left/input/menu/click",
},
@@ -246,6 +262,10 @@
left: "/user/hand/left/input/thumbstick/y",
right: "/user/hand/right/input/thumbstick/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/thumbstick/x",
right: "/user/hand/right/input/thumbstick/x"
},
show_hide: {
left: "/user/hand/left/input/menu/click",
},