grab-help panel, FollowHand align_to_hmd

This commit is contained in:
galister
2025-12-21 16:00:45 +09:00
parent 8e62e11d65
commit 1c6ebc745d
23 changed files with 578 additions and 66 deletions

View File

@@ -13,9 +13,18 @@ pub enum Positioning {
/// Stays in place, no recentering
Static,
/// Following HMD
FollowHead { lerp: f32 },
FollowHead {
#[serde(default)]
lerp: f32,
},
/// Following hand
FollowHand { hand: LeftRight, lerp: f32 },
FollowHand {
hand: LeftRight,
#[serde(default)]
lerp: f32,
#[serde(default)]
align_to_hmd: bool,
},
}
impl Positioning {
@@ -37,6 +46,21 @@ impl Positioning {
}
self
}
pub const fn get_align(self) -> Option<bool> {
match self {
Self::FollowHand { align_to_hmd, .. } => Some(align_to_hmd),
Self::FollowHead { .. } | Self::Floating | Self::Anchored | Self::Static => None,
}
}
pub const fn with_align(mut self, value: bool) -> Self {
match self {
Self::FollowHand {
ref mut align_to_hmd, ..
} => *align_to_hmd = value,
Self::FollowHead { .. } | Self::Floating | Self::Anchored | Self::Static => {}
}
self
}
}
// Contains the window state for a given set