fix keyboard scaling, fix openvr spawn

This commit is contained in:
galister
2024-01-28 20:01:17 +01:00
parent 328ef3cfde
commit 220b87659e
4 changed files with 23 additions and 21 deletions

View File

@@ -63,7 +63,6 @@ impl LinePool {
state: OverlayState {
name: Arc::from(format!("wlx-line{}", id)),
show_hide: true,
spawn_scale: 0.002,
size: (0, 0),
..Default::default()
},
@@ -73,6 +72,10 @@ impl LinePool {
}),
..Default::default()
}),
data: OpenVrOverlayData {
width: 0.002,
..Default::default()
},
..Default::default()
};
data.data.sort_order = 69;

View File

@@ -12,16 +12,15 @@ use crate::{
state::AppState,
};
const WIDTH: f32 = 1.0;
#[derive(Default)]
pub(super) struct OpenVrOverlayData {
handle: Option<OverlayHandle>,
last_image: Option<u64>,
pub(super) handle: Option<OverlayHandle>,
pub(super) last_image: Option<u64>,
pub(super) visible: bool,
pub(super) color: Vec4,
pub(super) curvature: f32,
pub(super) sort_order: u32,
pub(crate) width: f32,
pub(super) relative_to: RelativeTo,
}
@@ -49,6 +48,11 @@ impl OverlayData<OpenVrOverlayData> {
self.data.color = Vec4::ONE;
self.init(app);
self.upload_transform(overlay);
if self.data.width < f32::EPSILON {
self.data.width = 1.0;
}
self.upload_width(overlay);
self.upload_color(overlay);
@@ -125,7 +129,7 @@ impl OverlayData<OpenVrOverlayData> {
log::debug!("{}: No overlay handle", self.state.name);
return;
};
if let Err(e) = overlay.set_width(handle, WIDTH) {
if let Err(e) = overlay.set_width(handle, self.data.width) {
panic!("Failed to set overlay width: {}", e);
}
}