clippy
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
use anyhow::Context;
|
|
||||||
use glam::{vec2, Vec2};
|
use glam::{vec2, Vec2};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use testbed::{testbed_any::TestbedAny, Testbed};
|
use testbed::{testbed_any::TestbedAny, Testbed};
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ impl Pointer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hand(&self) -> Option<LeftRight> {
|
pub const fn hand(&self) -> Option<LeftRight> {
|
||||||
match self.idx {
|
match self.idx {
|
||||||
0 => Some(LeftRight::Left),
|
0 => Some(LeftRight::Left),
|
||||||
1 => Some(LeftRight::Right),
|
1 => Some(LeftRight::Right),
|
||||||
@@ -679,12 +679,12 @@ where
|
|||||||
// single grab push/pull
|
// single grab push/pull
|
||||||
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
||||||
}
|
}
|
||||||
if !pointer.now.click_modifier_right {
|
if pointer.now.click_modifier_right {
|
||||||
|
app.anchor = pointer.pose * grab_data.offset;
|
||||||
|
} else {
|
||||||
app.anchor.translation =
|
app.anchor.translation =
|
||||||
pointer.pose.transform_point3a(grab_data.offset.translation);
|
pointer.pose.transform_point3a(grab_data.offset.translation);
|
||||||
realign(&mut app.anchor, &app.input_state.hmd);
|
realign(&mut app.anchor, &app.input_state.hmd);
|
||||||
} else {
|
|
||||||
app.anchor = pointer.pose * grab_data.offset;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// single grab resize
|
// single grab resize
|
||||||
@@ -695,12 +695,12 @@ where
|
|||||||
// single grab push/pull
|
// single grab push/pull
|
||||||
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
||||||
}
|
}
|
||||||
if !pointer.now.click_modifier_right {
|
if pointer.now.click_modifier_right {
|
||||||
|
overlay_state.transform = pointer.pose * grab_data.offset;
|
||||||
|
} else {
|
||||||
overlay_state.transform.translation =
|
overlay_state.transform.translation =
|
||||||
pointer.pose.transform_point3a(grab_data.offset.translation);
|
pointer.pose.transform_point3a(grab_data.offset.translation);
|
||||||
realign(&mut overlay_state.transform, &app.input_state.hmd);
|
realign(&mut overlay_state.transform, &app.input_state.hmd);
|
||||||
} else {
|
|
||||||
overlay_state.transform = pointer.pose * grab_data.offset;
|
|
||||||
}
|
}
|
||||||
overlay.config.pause_movement = true;
|
overlay.config.pause_movement = true;
|
||||||
overlay.config.dirty = true;
|
overlay.config.dirty = true;
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ impl PositioningHandler {
|
|||||||
buttons.insert(
|
buttons.insert(
|
||||||
*name,
|
*name,
|
||||||
Rc::new(PosButtonState {
|
Rc::new(PosButtonState {
|
||||||
component,
|
|
||||||
name,
|
name,
|
||||||
sprite,
|
sprite,
|
||||||
|
component,
|
||||||
positioning,
|
positioning,
|
||||||
has_interpolation,
|
has_interpolation,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ impl OverlayBackend for ScreenBackend {
|
|||||||
MOUSE_RIGHT => MOUSE_LEFT,
|
MOUSE_RIGHT => MOUSE_LEFT,
|
||||||
other => other,
|
other => other,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
if pressed {
|
if pressed {
|
||||||
set_next_move(u64::from(app.session.config.click_freeze_time_ms));
|
set_next_move(u64::from(app.session.config.click_freeze_time_ms));
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ pub const WATCH_NAME: &str = "watch";
|
|||||||
const MAX_TOOLBOX_BUTTONS: usize = 16;
|
const MAX_TOOLBOX_BUTTONS: usize = 16;
|
||||||
const MAX_DEVICES: usize = 9;
|
const MAX_DEVICES: usize = 9;
|
||||||
|
|
||||||
pub(crate) const WATCH_POS: Vec3 = vec3(-0.03, -0.01, 0.125);
|
pub const WATCH_POS: Vec3 = vec3(-0.03, -0.01, 0.125);
|
||||||
pub(crate) const WATCH_ROT: Quat = Quat::from_xyzw(-0.707_106_6, 0.000_796_361_8, 0.707_106_6, 0.0);
|
pub const WATCH_ROT: Quat = Quat::from_xyzw(-0.707_106_6, 0.000_796_361_8, 0.707_106_6, 0.0);
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct WatchState {
|
struct WatchState {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl AppState {
|
|||||||
Box::new(gui::asset::GuiAsset {}),
|
Box::new(gui::asset::GuiAsset {}),
|
||||||
wgui::globals::Defaults::default(),
|
wgui::globals::Defaults::default(),
|
||||||
&WguiFontConfig::default(),
|
&WguiFontConfig::default(),
|
||||||
get_config_file_path(&*theme),
|
get_config_file_path(&theme),
|
||||||
)?,
|
)?,
|
||||||
|
|
||||||
#[cfg(feature = "osc")]
|
#[cfg(feature = "osc")]
|
||||||
|
|||||||
@@ -216,14 +216,12 @@ where
|
|||||||
OverlayTask::Drop(sel) => {
|
OverlayTask::Drop(sel) => {
|
||||||
if let Some(o) = self.mut_by_selector(&sel)
|
if let Some(o) = self.mut_by_selector(&sel)
|
||||||
&& o.birthframe < FRAME_COUNTER.load(Ordering::Relaxed)
|
&& o.birthframe < FRAME_COUNTER.load(Ordering::Relaxed)
|
||||||
{
|
&& let Some(o) = self.remove_by_selector(&sel, app) {
|
||||||
if let Some(o) = self.remove_by_selector(&sel, app) {
|
|
||||||
log::debug!("Dropping overlay {}", o.config.name);
|
log::debug!("Dropping overlay {}", o.config.name);
|
||||||
self.dropped_overlays.push_back(o);
|
self.dropped_overlays.push_back(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +256,7 @@ impl<T> OverlayWindowManager<T> {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// overlays that we haven't seen since startup (e.g. wayvr apps)
|
// overlays that we haven't seen since startup (e.g. wayvr apps)
|
||||||
for (k, o) in set.inactive_overlays.iter() {
|
for (k, o) in &set.inactive_overlays {
|
||||||
if !overlays.contains_key(k) {
|
if !overlays.contains_key(k) {
|
||||||
overlays.insert(k.clone(), o.clone());
|
overlays.insert(k.clone(), o.clone());
|
||||||
}
|
}
|
||||||
@@ -311,8 +309,8 @@ impl<T> OverlayWindowManager<T> {
|
|||||||
let mut overlays = SecondaryMap::new();
|
let mut overlays = SecondaryMap::new();
|
||||||
let mut inactive_overlays = AStrMap::new();
|
let mut inactive_overlays = AStrMap::new();
|
||||||
|
|
||||||
for (name, o) in s.overlays.iter() {
|
for (name, o) in &s.overlays {
|
||||||
if let Some(id) = self.lookup(&*name) {
|
if let Some(id) = self.lookup(name) {
|
||||||
log::debug!("set {i}: loaded state for {name}");
|
log::debug!("set {i}: loaded state for {name}");
|
||||||
overlays.insert(id, o.clone());
|
overlays.insert(id, o.clone());
|
||||||
} else {
|
} else {
|
||||||
@@ -477,7 +475,7 @@ impl<T> OverlayWindowManager<T> {
|
|||||||
|
|
||||||
if !global {
|
if !global {
|
||||||
for (i, set) in self.sets.iter_mut().enumerate() {
|
for (i, set) in self.sets.iter_mut().enumerate() {
|
||||||
let Some(mut state) = set.inactive_overlays.arc_rm(&*name) else {
|
let Some(mut state) = set.inactive_overlays.arc_rm(&name) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if self.current_set == Some(i) {
|
if self.current_set == Some(i) {
|
||||||
@@ -495,7 +493,7 @@ impl<T> OverlayWindowManager<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !shown && show_on_spawn {
|
if !shown && show_on_spawn {
|
||||||
log::debug!("activating {} due to show_on_spawn", name);
|
log::debug!("activating {name} due to show_on_spawn");
|
||||||
self.overlays[oid].config.activate(app);
|
self.overlays[oid].config.activate(app);
|
||||||
}
|
}
|
||||||
if !internal && let Err(e) = self.overlays_changed(app) {
|
if !internal && let Err(e) = self.overlays_changed(app) {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl OverlayWindowConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_active(&self) -> bool {
|
pub const fn is_active(&self) -> bool {
|
||||||
self.active_state.is_some()
|
self.active_state.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user