anchor grab

This commit is contained in:
galister
2025-11-19 15:48:06 +09:00
parent 127cb5c8d0
commit 5b40032bc3
6 changed files with 177 additions and 131 deletions

View File

@@ -3,8 +3,8 @@ use std::sync::{Arc, LazyLock};
use crate::gui::panel::GuiPanel;
use crate::state::AppState;
use crate::windowing::Z_ORDER_ANCHOR;
use crate::windowing::window::{OverlayWindowConfig, OverlayWindowState, Positioning};
use crate::windowing::Z_ORDER_ANCHOR;
pub static ANCHOR_NAME: LazyLock<Arc<str>> = LazyLock::new(|| Arc::from("anchor"));
@@ -18,11 +18,11 @@ pub fn create_anchor(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig>
default_state: OverlayWindowState {
interactable: false,
grabbable: false,
positioning: Positioning::Static,
positioning: Positioning::Anchored,
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * 0.1,
Quat::IDENTITY,
Vec3::NEG_Z * 0.5,
Vec3::ZERO, // Vec3::NEG_Z * 0.5,
),
..OverlayWindowState::default()
},

View File

@@ -19,16 +19,16 @@ use wgui::{
use crate::{backend::task::TaskType, windowing::OverlaySelector};
use crate::{
backend::{input::HoverResult, task::TaskContainer},
gui::panel::{GuiPanel, NewGuiPanelParams, OnCustomAttribFunc, button::BUTTON_EVENTS},
gui::panel::{button::BUTTON_EVENTS, GuiPanel, NewGuiPanelParams, OnCustomAttribFunc},
overlays::edit::{
lock::InteractLockHandler, pos::PositioningHandler, tab::ButtonPaneTabSwitcher,
},
state::AppState,
subsystem::hid::WheelDelta,
windowing::{
OverlayID,
backend::{DummyBackend, OverlayBackend, RenderResources, ShouldRender},
window::OverlayWindowConfig,
OverlayID,
},
};

View File

@@ -131,7 +131,7 @@ fn key_to_pos(key: &str) -> Positioning {
const fn pos_to_key(pos: Positioning) -> &'static str {
match pos {
Positioning::Static => "static",
Positioning::Anchored => "anchored",
Positioning::Anchored | Positioning::AnchoredPaused => "anchored",
Positioning::Floating => "floating",
Positioning::FollowHead { .. } | Positioning::FollowHeadPaused { .. } => "hmd",
Positioning::FollowHand {