mirror of https://github.com/wayvr-org/wayvr.git
Space gravity UI improvements
This commit is contained in:
parent
f6d6ff067f
commit
51f3126cae
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="gravity.svg"
|
||||
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="23.234375"
|
||||
inkscape:cx="17.861466"
|
||||
inkscape:cy="22.488231"
|
||||
inkscape:window-width="1582"
|
||||
inkscape:window-height="1302"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg1" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE -->
|
||||
<!-- Modified it a little bit, there's no "space gravity" icon available. -->
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="m 15.76786,18.274928 -1.391472,0.295932 -0.674684,-2.9751 -3.051267,-0.735557 -2.4062791,-3.292082 -0.8846145,1.824345 1.561484,2.213127 -1.1706157,0.808349 -1.9932655,-2.862487 1.752944,-3.7745856 Q 7.740355,9.2978686 8.2693798,9.1366908 8.7984057,8.9755132 9.3446883,8.9671549 9.9537305,8.9704882 10.547911,8.8283107 11.142091,8.6861403 11.667399,8.364791 12.192707,8.0434408 12.541821,7.5511898 12.890935,7.0589389 13.170167,6.5208564 l 1.228561,0.6477209 q -0.321651,0.575352 -0.696034,1.1164692 -0.374382,0.5411172 -0.890945,0.9726251 -0.466314,0.3718768 -0.998843,0.6112737 -0.532529,0.2393967 -1.117089,0.3386867 L 12,12 l 2.176682,-1.469824 4.352172,0.934365 -0.326914,1.35612 -3.582453,-0.734464 -2.11263,1.442217 2.281549,0.535655 z M 7.5517982,8.9044443 Q 7.0233673,9.1322023 6.4853273,8.9182692 5.9472884,8.7043353 5.7186139,8.1755407 5.4899403,7.6467461 5.7054294,7.108795 5.9209195,6.5708439 6.4475175,6.3423563 6.9741154,6.1138698 7.5149037,6.3288971 8.0556931,6.5439235 8.2807018,7.07126 8.5057095,7.5985974 8.2948017,8.1383704 8.0838948,8.6781445 7.5517982,8.9044443"
|
||||
id="path1"
|
||||
style="stroke-width:0.697484" />
|
||||
<path
|
||||
id="path2"
|
||||
style="fill:none;stroke:currentColor;stroke-width:2.43525;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:0, 7.30575"
|
||||
d="M 22.480952,12 C 22.480952,17.78847 17.78847,22.480952 12,22.480952 6.2115299,22.480952 1.5190477,17.78847 1.5190477,12 1.5190475,6.2115298 6.2115298,1.5190477 12,1.5190477 c 0.653263,0 1.292568,0.059766 1.912744,0.1741274 C 18.787854,2.5921561 22.480952,6.8647934 22.480952,12 Z"
|
||||
sodipodi:nodetypes="ssssss" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
|
|
@ -0,0 +1,14 @@
|
|||
<layout>
|
||||
<include src="../t_group_box.xml" />
|
||||
|
||||
<elements>
|
||||
<div id="common_options_parent" flex_direction="column" gap="8"/>
|
||||
<rectangle macro="group_box">
|
||||
<GroupBoxTitle src_builtin="dashboard/gravity.svg" translation="APP_SETTINGS.SPACE_GRAVITY_GRAVITY" />
|
||||
<div id="gravity_enabled_parent"/>
|
||||
<div id="space_gravity_parent" flex_direction="column" gap="8">
|
||||
<!-- filled-in at runtime -->
|
||||
</div>
|
||||
</rectangle>
|
||||
</elements>
|
||||
</layout>
|
||||
|
|
@ -55,6 +55,7 @@
|
|||
"DELETE_ALL_CONFIGS_HELP": "Remove all configuration files from conf.d",
|
||||
"DOUBLE_CURSOR_FIX": "Double cursor fix",
|
||||
"DOUBLE_CURSOR_FIX_HELP": "Enable this if you see 2 cursors",
|
||||
"ENABLED": "Enabled",
|
||||
"FEATURES": "Features",
|
||||
"FOCUS_FOLLOWS_MOUSE_MODE": "Mouse move on trigger touch",
|
||||
"HANDSFREE_POINTER": "Handsfree mode",
|
||||
|
|
@ -104,12 +105,16 @@
|
|||
"SKYBOX": "Skybox",
|
||||
"SKYMAP_ALREADY_DOWNLOADED": "This skymap is already downloaded. Select desired action.",
|
||||
"SPACE_DRAG": "Space drag",
|
||||
"SPACE_DRAG_FLING_STRENGTH": "Fling strength",
|
||||
"SPACE_DRAG_DAMPING": "Damping",
|
||||
"SPACE_DRAG_GRAVITY": "Gravity",
|
||||
"SPACE_DRAG_MULTIPLIER": "Space drag multiplier",
|
||||
"SPACE_DRAG_GROUND_FRICTION": "Ground friction",
|
||||
"SPACE_DRAG_UNLOCKED": "Allow space drag on all axes",
|
||||
"SPACE_GRAVITY_DAMPING": "Damping",
|
||||
"SPACE_GRAVITY_DAMPING_HELP": "Artificial drag to slow down movement. 0.1 - high drag, 1.0 - no drag",
|
||||
"SPACE_GRAVITY_FLING_STRENGTH": "Fling strength",
|
||||
"SPACE_GRAVITY_FLING_STRENGTH_HELP": "Intensity multiplier of gravitational launch force after space-drag.\n0.0 - no movement at all, 2.0 - double intensity",
|
||||
"SPACE_GRAVITY_GRAVITY": "Gravity",
|
||||
"SPACE_GRAVITY_GRAVITY_HELP": "Amount of downwards force. 0.0 - no gravity",
|
||||
"SPACE_GRAVITY_GROUND_FRICTION": "Ground friction",
|
||||
"SPACE_GRAVITY_GROUND_FRICTION_HELP": "Amount of friction slowing you down if you're touching the ground.\n0.0 - no friction (just like on ice), 1.0 - rough surface",
|
||||
"SPACE_ROTATE_UNLOCKED": "Allow space rotate on all axes",
|
||||
"TROUBLESHOOTING": "Troubleshooting",
|
||||
"UI_GRADIENT_INTENSITY": "UI Gradient intensity",
|
||||
|
|
|
|||
|
|
@ -44,27 +44,27 @@ mod tab_troubleshooting;
|
|||
|
||||
#[derive(Clone)]
|
||||
enum TabNameEnum {
|
||||
LookAndFeel,
|
||||
Features,
|
||||
SpaceDrag,
|
||||
Controls,
|
||||
Misc,
|
||||
AutostartApps,
|
||||
Troubleshooting,
|
||||
Controls,
|
||||
Features,
|
||||
LookAndFeel,
|
||||
Misc,
|
||||
Skybox,
|
||||
SpaceDrag,
|
||||
Troubleshooting,
|
||||
}
|
||||
|
||||
impl TabNameEnum {
|
||||
fn from_string(s: &str) -> Option<Self> {
|
||||
match s {
|
||||
"look_and_feel" => Some(TabNameEnum::LookAndFeel),
|
||||
"features" => Some(TabNameEnum::Features),
|
||||
"controls" => Some(TabNameEnum::Controls),
|
||||
"space_drag" => Some(TabNameEnum::SpaceDrag),
|
||||
"misc" => Some(TabNameEnum::Misc),
|
||||
"autostart_apps" => Some(TabNameEnum::AutostartApps),
|
||||
"troubleshooting" => Some(TabNameEnum::Troubleshooting),
|
||||
"controls" => Some(TabNameEnum::Controls),
|
||||
"features" => Some(TabNameEnum::Features),
|
||||
"look_and_feel" => Some(TabNameEnum::LookAndFeel),
|
||||
"misc" => Some(TabNameEnum::Misc),
|
||||
"skybox" => Some(TabNameEnum::Skybox),
|
||||
"space_drag" => Some(TabNameEnum::SpaceDrag),
|
||||
"troubleshooting" => Some(TabNameEnum::Troubleshooting),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -72,18 +72,18 @@ impl TabNameEnum {
|
|||
|
||||
#[derive(Clone)]
|
||||
enum Task {
|
||||
UpdateBool(SettingType, bool),
|
||||
UpdateFloat(SettingType, f32),
|
||||
UpdateInt(SettingType, i32),
|
||||
SettingUpdated(SettingType),
|
||||
OpenContextMenu(Vec2, Vec<context_menu::Cell>),
|
||||
ClearPipewireTokens,
|
||||
ClearSavedState,
|
||||
DeleteAllConfigs,
|
||||
OpenContextMenu(Vec2, Vec<context_menu::Cell>),
|
||||
RemoveAutostartApp(Rc<str>),
|
||||
ResetPlayspace,
|
||||
RestartSoftware,
|
||||
RemoveAutostartApp(Rc<str>),
|
||||
SetTab(TabNameEnum),
|
||||
SettingUpdated(SettingType),
|
||||
UpdateBool(SettingType, bool),
|
||||
UpdateFloat(SettingType, f32),
|
||||
UpdateInt(SettingType, i32),
|
||||
}
|
||||
|
||||
struct SettingsMountParams<'a> {
|
||||
|
|
@ -93,10 +93,20 @@ struct SettingsMountParams<'a> {
|
|||
feats: InterfaceFeats,
|
||||
}
|
||||
|
||||
struct SettingUpdatedParams<'a> {
|
||||
layout: &'a mut Layout,
|
||||
config: &'a GeneralConfig,
|
||||
setting_type: SettingType,
|
||||
}
|
||||
|
||||
trait SettingsTab {
|
||||
fn update(&mut self, _par: &mut ViewUpdateParams) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn setting_updated(&mut self, _sup: &mut SettingUpdatedParams) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TabSettings<T> {
|
||||
|
|
@ -206,12 +216,21 @@ impl<T> Tab<T> for TabSettings<T> {
|
|||
changed = Some(ConfigChangeKind::OverlayConfig);
|
||||
}
|
||||
}
|
||||
Task::SettingUpdated(setting) => match setting {
|
||||
SettingType::UiAnimationSpeed | SettingType::UiGradientIntensity | SettingType::UiRoundMultiplier => {
|
||||
// todo: currently, wayvr restart is required to apply these changes (WguiTheme is Rc)
|
||||
Task::SettingUpdated(setting) => {
|
||||
if let Some(tab) = &mut self.current_tab {
|
||||
tab.setting_updated(&mut SettingUpdatedParams {
|
||||
layout: &mut frontend.layout,
|
||||
config: frontend.interface.general_config(data),
|
||||
setting_type: setting,
|
||||
})?;
|
||||
}
|
||||
_ => { /* do nothing */ }
|
||||
},
|
||||
match setting {
|
||||
SettingType::UiAnimationSpeed | SettingType::UiGradientIntensity | SettingType::UiRoundMultiplier => {
|
||||
// todo: currently, wayvr restart is required to apply these changes (WguiTheme is Rc)
|
||||
}
|
||||
_ => { /* do nothing */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +269,7 @@ impl<T> Tab<T> for TabSettings<T> {
|
|||
|
||||
// Sorted alphabetically
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Clone, Copy, AsRefStr, EnumString)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, AsRefStr, EnumString)]
|
||||
enum SettingType {
|
||||
AllowSliding,
|
||||
BlockGameInput,
|
||||
|
|
@ -261,6 +280,7 @@ enum SettingType {
|
|||
Clock12h,
|
||||
DoubleCursorFix,
|
||||
FocusFollowsMouseMode,
|
||||
GridOpacity,
|
||||
HandsfreePointer,
|
||||
HideGrabHelp,
|
||||
HideUsername,
|
||||
|
|
@ -278,12 +298,13 @@ enum SettingType {
|
|||
ScreenRenderDown,
|
||||
ScrollSpeed,
|
||||
SetsOnWatch,
|
||||
SpaceDragFlingStrength,
|
||||
SpaceDragDamping,
|
||||
SpaceDragGravity,
|
||||
SpaceDragMultiplier,
|
||||
SpaceDragGroundFriction,
|
||||
SpaceDragUnlocked,
|
||||
SpaceGravityDamping,
|
||||
SpaceGravityEnabled,
|
||||
SpaceGravityFlingStrength,
|
||||
SpaceGravityGravity,
|
||||
SpaceGravityGroundFriction,
|
||||
SpaceRotateUnlocked,
|
||||
UiAnimationSpeed,
|
||||
UiGradientIntensity,
|
||||
|
|
@ -291,7 +312,6 @@ enum SettingType {
|
|||
UprightScreenFix,
|
||||
UsePassthrough,
|
||||
UseSkybox,
|
||||
GridOpacity,
|
||||
WatchViewAngleMax,
|
||||
WatchViewAngleMin,
|
||||
XrClickSensitivity,
|
||||
|
|
@ -309,29 +329,30 @@ impl SettingType {
|
|||
|
||||
pub fn mut_bool(self, config: &mut GeneralConfig) -> &mut bool {
|
||||
match self {
|
||||
Self::InvertScrollDirectionX => &mut config.invert_scroll_direction_x,
|
||||
Self::InvertScrollDirectionY => &mut config.invert_scroll_direction_y,
|
||||
Self::NotificationsEnabled => &mut config.notifications_enabled,
|
||||
Self::NotificationsSoundEnabled => &mut config.notifications_sound_enabled,
|
||||
Self::KeyboardSoundEnabled => &mut config.keyboard_sound_enabled,
|
||||
Self::UprightScreenFix => &mut config.upright_screen_fix,
|
||||
Self::DoubleCursorFix => &mut config.double_cursor_fix,
|
||||
Self::SetsOnWatch => &mut config.sets_on_watch,
|
||||
Self::HideGrabHelp => &mut config.hide_grab_help,
|
||||
Self::AllowSliding => &mut config.allow_sliding,
|
||||
Self::FocusFollowsMouseMode => &mut config.focus_follows_mouse_mode,
|
||||
Self::LeftHandedMouse => &mut config.left_handed_mouse,
|
||||
Self::BlockGameInput => &mut config.block_game_input,
|
||||
Self::BlockGameInputIgnoreWatch => &mut config.block_game_input_ignore_watch,
|
||||
Self::BlockPosesOnKbdInteraction => &mut config.block_poses_on_kbd_interaction,
|
||||
Self::UseSkybox => &mut config.use_skybox,
|
||||
Self::UsePassthrough => &mut config.use_passthrough,
|
||||
Self::ScreenRenderDown => &mut config.screen_render_down,
|
||||
Self::SpaceDragUnlocked => &mut config.space_drag_unlocked,
|
||||
Self::SpaceRotateUnlocked => &mut config.space_rotate_unlocked,
|
||||
Self::Clock12h => &mut config.clock_12h,
|
||||
Self::DoubleCursorFix => &mut config.double_cursor_fix,
|
||||
Self::FocusFollowsMouseMode => &mut config.focus_follows_mouse_mode,
|
||||
Self::HideGrabHelp => &mut config.hide_grab_help,
|
||||
Self::HideUsername => &mut config.hide_username,
|
||||
Self::InvertScrollDirectionX => &mut config.invert_scroll_direction_x,
|
||||
Self::InvertScrollDirectionY => &mut config.invert_scroll_direction_y,
|
||||
Self::KeyboardSoundEnabled => &mut config.keyboard_sound_enabled,
|
||||
Self::LeftHandedMouse => &mut config.left_handed_mouse,
|
||||
Self::NotificationsEnabled => &mut config.notifications_enabled,
|
||||
Self::NotificationsSoundEnabled => &mut config.notifications_sound_enabled,
|
||||
Self::OpaqueBackground => &mut config.opaque_background,
|
||||
Self::ScreenRenderDown => &mut config.screen_render_down,
|
||||
Self::SetsOnWatch => &mut config.sets_on_watch,
|
||||
Self::SpaceDragUnlocked => &mut config.space_drag_unlocked,
|
||||
Self::SpaceGravityEnabled => &mut config.space_gravity_enabled,
|
||||
Self::SpaceRotateUnlocked => &mut config.space_rotate_unlocked,
|
||||
Self::UprightScreenFix => &mut config.upright_screen_fix,
|
||||
Self::UsePassthrough => &mut config.use_passthrough,
|
||||
Self::UseSkybox => &mut config.use_skybox,
|
||||
Self::XwaylandByDefault => &mut config.xwayland_by_default,
|
||||
_ => panic!("Requested bool for non-bool SettingType"),
|
||||
}
|
||||
|
|
@ -339,22 +360,22 @@ impl SettingType {
|
|||
|
||||
pub fn mut_f32(self, config: &mut GeneralConfig) -> &mut f32 {
|
||||
match self {
|
||||
Self::GridOpacity => &mut config.grid_opacity,
|
||||
Self::LongPressDuration => &mut config.long_press_duration,
|
||||
Self::PointerLerpFactor => &mut config.pointer_lerp_factor,
|
||||
Self::ScrollSpeed => &mut config.scroll_speed,
|
||||
Self::SpaceDragMultiplier => &mut config.space_drag_multiplier,
|
||||
Self::SpaceGravityDamping => &mut config.space_gravity_damping,
|
||||
Self::SpaceGravityFlingStrength => &mut config.space_gravity_fling_strength,
|
||||
Self::SpaceGravityGravity => &mut config.space_gravity_gravity,
|
||||
Self::SpaceGravityGroundFriction => &mut config.space_gravity_ground_friction,
|
||||
Self::UiAnimationSpeed => &mut config.ui_animation_speed,
|
||||
Self::UiGradientIntensity => &mut config.ui_gradient_intensity,
|
||||
Self::UiRoundMultiplier => &mut config.ui_round_multiplier,
|
||||
Self::ScrollSpeed => &mut config.scroll_speed,
|
||||
Self::LongPressDuration => &mut config.long_press_duration,
|
||||
Self::XrClickSensitivity => &mut config.xr_click_sensitivity,
|
||||
Self::XrClickSensitivityRelease => &mut config.xr_click_sensitivity_release,
|
||||
Self::SpaceDragFlingStrength => &mut config.space_drag_fling_strength,
|
||||
Self::SpaceDragDamping => &mut config.space_drag_damping,
|
||||
Self::SpaceDragGravity => &mut config.space_drag_gravity,
|
||||
Self::SpaceDragMultiplier => &mut config.space_drag_multiplier,
|
||||
Self::SpaceDragGroundFriction => &mut config.space_drag_ground_friction,
|
||||
Self::PointerLerpFactor => &mut config.pointer_lerp_factor,
|
||||
Self::GridOpacity => &mut config.grid_opacity,
|
||||
Self::WatchViewAngleMax => &mut config.watch_view_angle_max,
|
||||
Self::WatchViewAngleMin => &mut config.watch_view_angle_min,
|
||||
Self::XrClickSensitivity => &mut config.xr_click_sensitivity,
|
||||
Self::XrClickSensitivityRelease => &mut config.xr_click_sensitivity_release,
|
||||
_ => panic!("Requested f32 for non-f32 SettingType"),
|
||||
}
|
||||
}
|
||||
|
|
@ -447,12 +468,13 @@ impl SettingType {
|
|||
Self::ScreenRenderDown => Ok("APP_SETTINGS.SCREEN_RENDER_DOWN"),
|
||||
Self::ScrollSpeed => Ok("APP_SETTINGS.SCROLL_SPEED"),
|
||||
Self::SetsOnWatch => Ok("APP_SETTINGS.SETS_ON_WATCH"),
|
||||
Self::SpaceDragFlingStrength => Ok("APP_SETTINGS.SPACE_DRAG_FLING_STRENGTH"),
|
||||
Self::SpaceDragDamping => Ok("APP_SETTINGS.SPACE_DRAG_DAMPING"),
|
||||
Self::SpaceDragGravity => Ok("APP_SETTINGS.SPACE_DRAG_GRAVITY"),
|
||||
Self::SpaceDragMultiplier => Ok("APP_SETTINGS.SPACE_DRAG_MULTIPLIER"),
|
||||
Self::SpaceDragGroundFriction => Ok("APP_SETTINGS.SPACE_DRAG_GROUND_FRICTION"),
|
||||
Self::SpaceDragUnlocked => Ok("APP_SETTINGS.SPACE_DRAG_UNLOCKED"),
|
||||
Self::SpaceGravityDamping => Ok("APP_SETTINGS.SPACE_GRAVITY_DAMPING"),
|
||||
Self::SpaceGravityEnabled => Ok("APP_SETTINGS.ENABLED"),
|
||||
Self::SpaceGravityFlingStrength => Ok("APP_SETTINGS.SPACE_GRAVITY_FLING_STRENGTH"),
|
||||
Self::SpaceGravityGravity => Ok("APP_SETTINGS.SPACE_GRAVITY_GRAVITY"),
|
||||
Self::SpaceGravityGroundFriction => Ok("APP_SETTINGS.SPACE_GRAVITY_GROUND_FRICTION"),
|
||||
Self::SpaceRotateUnlocked => Ok("APP_SETTINGS.SPACE_ROTATE_UNLOCKED"),
|
||||
Self::UiAnimationSpeed => Ok("APP_SETTINGS.ANIMATION_SPEED"),
|
||||
Self::UiGradientIntensity => Ok("APP_SETTINGS.UI_GRADIENT_INTENSITY"),
|
||||
|
|
@ -481,13 +503,17 @@ impl SettingType {
|
|||
Self::KeyboardMiddleClick => Some("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK_HELP"),
|
||||
Self::LeftHandedMouse => Some("APP_SETTINGS.LEFT_HANDED_MOUSE_HELP"),
|
||||
Self::ScreenRenderDown => Some("APP_SETTINGS.SCREEN_RENDER_DOWN_HELP"),
|
||||
Self::SpaceGravityDamping => Some("APP_SETTINGS.SPACE_GRAVITY_DAMPING_HELP"),
|
||||
Self::SpaceGravityFlingStrength => Some("APP_SETTINGS.SPACE_GRAVITY_FLING_STRENGTH_HELP"),
|
||||
Self::SpaceGravityGravity => Some("APP_SETTINGS.SPACE_GRAVITY_GRAVITY_HELP"),
|
||||
Self::SpaceGravityGroundFriction => Some("APP_SETTINGS.SPACE_GRAVITY_GROUND_FRICTION_HELP"),
|
||||
Self::UprightScreenFix => Some("APP_SETTINGS.UPRIGHT_SCREEN_FIX_HELP"),
|
||||
Self::UsePassthrough => Some("APP_SETTINGS.USE_PASSTHROUGH_HELP"),
|
||||
Self::UseSkybox => Some("APP_SETTINGS.USE_SKYBOX_HELP"),
|
||||
Self::WatchViewAngleMax => Some("APP_SETTINGS.WATCH_VIEW_ANGLE_HELP"),
|
||||
Self::WatchViewAngleMin => Some("APP_SETTINGS.WATCH_VIEW_ANGLE_HELP"),
|
||||
Self::XrClickSensitivity => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_HELP"),
|
||||
Self::XrClickSensitivityRelease => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_HELP"),
|
||||
Self::WatchViewAngleMin => Some("APP_SETTINGS.WATCH_VIEW_ANGLE_HELP"),
|
||||
Self::WatchViewAngleMax => Some("APP_SETTINGS.WATCH_VIEW_ANGLE_HELP"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,118 @@
|
|||
use wgui::{
|
||||
assets::AssetPath,
|
||||
layout::{Layout, LayoutTask, WidgetID},
|
||||
parser::{Fetchable, ParseDocumentParams},
|
||||
};
|
||||
|
||||
use crate::tab::settings::{
|
||||
SettingType, SettingsMountParams, SettingsTab,
|
||||
macros::{options_category, options_checkbox, options_slider_f32},
|
||||
};
|
||||
|
||||
pub struct State {}
|
||||
pub struct State {
|
||||
id_space_gravity_parent: WidgetID,
|
||||
}
|
||||
|
||||
impl SettingsTab for State {}
|
||||
fn set_visible(parent: WidgetID, layout: &mut Layout, n: bool) {
|
||||
layout.tasks.push(LayoutTask::SetWidgetVisible(parent, n));
|
||||
}
|
||||
|
||||
impl SettingsTab for State {
|
||||
fn setting_updated(&mut self, sup: &mut super::SettingUpdatedParams) -> anyhow::Result<()> {
|
||||
if sup.setting_type == SettingType::SpaceGravityEnabled {
|
||||
set_visible(
|
||||
self.id_space_gravity_parent,
|
||||
sup.layout,
|
||||
sup.config.space_gravity_enabled,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn mount(par: SettingsMountParams) -> anyhow::Result<State> {
|
||||
let c = options_category(par.mp, par.id_parent, "APP_SETTINGS.SPACE_DRAG", "dashboard/drag.svg")?;
|
||||
|
||||
let globals = par.mp.layout.state.globals.clone();
|
||||
|
||||
let tab_state = wgui::parser::parse_from_assets(
|
||||
&ParseDocumentParams {
|
||||
globals,
|
||||
path: AssetPath::BuiltIn("gui/tab/settings_tab_space_drag.xml"),
|
||||
extra: Default::default(),
|
||||
},
|
||||
par.mp.layout,
|
||||
c,
|
||||
)?;
|
||||
|
||||
let id_common_options_parent = tab_state.get_widget_id("common_options_parent")?;
|
||||
let id_gravity_enabled_parent = tab_state.get_widget_id("gravity_enabled_parent")?;
|
||||
let id_space_gravity_parent = tab_state.get_widget_id("space_gravity_parent")?;
|
||||
|
||||
if !par.feats.openxr || par.feats.monado {
|
||||
// monado or openvr
|
||||
options_checkbox(par.mp, c, SettingType::SpaceDragUnlocked)?;
|
||||
options_slider_f32(par.mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5)?;
|
||||
options_slider_f32(par.mp, c, SettingType::SpaceDragGravity, 0.0, 10.0, 0.5)?;
|
||||
options_slider_f32(par.mp, c, SettingType::SpaceDragDamping, 0.1, 1.0, 0.01)?;
|
||||
options_slider_f32(par.mp, c, SettingType::SpaceDragFlingStrength, 0.0, 3.0, 0.1)?;
|
||||
options_slider_f32(par.mp, c, SettingType::SpaceDragGroundFriction, 0.0, 1.0, 0.01)?;
|
||||
options_checkbox(par.mp, id_common_options_parent, SettingType::SpaceDragUnlocked)?;
|
||||
|
||||
options_slider_f32(
|
||||
par.mp,
|
||||
id_common_options_parent,
|
||||
SettingType::SpaceDragMultiplier,
|
||||
-10.0,
|
||||
10.0,
|
||||
0.5,
|
||||
)?;
|
||||
|
||||
/* space gravity section */
|
||||
options_checkbox(par.mp, id_gravity_enabled_parent, SettingType::SpaceGravityEnabled)?;
|
||||
|
||||
options_slider_f32(
|
||||
par.mp,
|
||||
id_space_gravity_parent,
|
||||
SettingType::SpaceGravityGravity,
|
||||
0.0,
|
||||
10.0,
|
||||
0.5,
|
||||
)?;
|
||||
options_slider_f32(
|
||||
par.mp,
|
||||
id_space_gravity_parent,
|
||||
SettingType::SpaceGravityDamping,
|
||||
0.1,
|
||||
1.0,
|
||||
0.01,
|
||||
)?;
|
||||
options_slider_f32(
|
||||
par.mp,
|
||||
id_space_gravity_parent,
|
||||
SettingType::SpaceGravityFlingStrength,
|
||||
0.0,
|
||||
3.0,
|
||||
0.1,
|
||||
)?;
|
||||
options_slider_f32(
|
||||
par.mp,
|
||||
id_space_gravity_parent,
|
||||
SettingType::SpaceGravityGroundFriction,
|
||||
0.0,
|
||||
1.0,
|
||||
0.01,
|
||||
)?;
|
||||
}
|
||||
|
||||
if par.feats.monado {
|
||||
// openvr can only ever rotate yaw
|
||||
options_checkbox(par.mp, c, SettingType::SpaceRotateUnlocked)?;
|
||||
options_checkbox(par.mp, id_common_options_parent, SettingType::SpaceRotateUnlocked)?;
|
||||
}
|
||||
Ok(State {})
|
||||
|
||||
set_visible(
|
||||
id_space_gravity_parent,
|
||||
par.mp.layout,
|
||||
par.mp.config.space_gravity_enabled,
|
||||
);
|
||||
|
||||
Ok(State {
|
||||
id_space_gravity_parent,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ use std::{
|
|||
use wgui::{
|
||||
assets::AssetPath,
|
||||
components::button::ComponentButton,
|
||||
event::{EventAlterables, StyleSetRequest},
|
||||
event::EventAlterables,
|
||||
globals::WguiGlobals,
|
||||
i18n::Translation,
|
||||
layout::{Layout, LayoutTask, LayoutTasks, WidgetID},
|
||||
parser::{Fetchable, ParseDocumentParams, ParserState},
|
||||
taffy::Display,
|
||||
widget::label::WidgetLabel,
|
||||
};
|
||||
use wlx_common::config::GeneralConfig;
|
||||
|
|
@ -232,15 +231,7 @@ impl State {
|
|||
let popup = popup.upgrade().unwrap(); // safe
|
||||
let popup = popup.borrow_mut();
|
||||
let mounted_popup = popup.mounted_popup.as_ref().unwrap(); // safe;
|
||||
|
||||
alterables.set_style(
|
||||
mounted_popup.id_root,
|
||||
StyleSetRequest::Display(if idx == self.popup_stack.len() - 1 {
|
||||
Display::Flex
|
||||
} else {
|
||||
Display::None
|
||||
}),
|
||||
);
|
||||
alterables.set_widget_visible(mounted_popup.id_root, idx == self.popup_stack.len() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,10 +112,7 @@ impl View {
|
|||
fn fill_list(&mut self, layout: &mut Layout, games: Vec<steam_utils::RunningGame>) -> anyhow::Result<()> {
|
||||
if games.is_empty() {
|
||||
// hide self
|
||||
layout.tasks.push(LayoutTask::SetWidgetStyle(
|
||||
self.parent_id,
|
||||
StyleSetRequest::Display(Display::None),
|
||||
));
|
||||
layout.tasks.push(LayoutTask::SetWidgetVisible(self.parent_id, false));
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ use wgui::{
|
|||
checkbox::ComponentCheckbox,
|
||||
},
|
||||
drawing::Color,
|
||||
event::StyleSetRequest,
|
||||
font_config::WguiFontConfig,
|
||||
globals::WguiGlobals,
|
||||
i18n::Translation,
|
||||
|
|
@ -134,14 +133,9 @@ impl TestbedGeneric {
|
|||
let div_visibility = parser_state.fetch_widget(&layout.state, "div_visibility")?;
|
||||
|
||||
cb_visible.on_toggle(Box::new(move |common, evt| {
|
||||
common.alterables.set_style(
|
||||
div_visibility.id,
|
||||
StyleSetRequest::Display(if evt.checked {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
}),
|
||||
);
|
||||
common
|
||||
.alterables
|
||||
.set_widget_visible(div_visibility.id, evt.checked);
|
||||
Ok(())
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,12 @@ impl SpaceGravity {
|
|||
space_pos: Vec3A,
|
||||
dt: f32,
|
||||
) {
|
||||
self.velocity = hand_pos_diff * config.space_drag_fling_strength / dt;
|
||||
self.space_pos = space_pos;
|
||||
if config.space_gravity_enabled {
|
||||
self.velocity = hand_pos_diff * config.space_gravity_fling_strength / dt;
|
||||
self.space_pos = space_pos;
|
||||
} else {
|
||||
self.reset();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
|
|
@ -59,18 +63,18 @@ impl SpaceGravity {
|
|||
}
|
||||
|
||||
pub fn update(&mut self, par: SpaceGravityUpdateParams) -> Option<SpaceGravityUpdateResult> {
|
||||
if par.dragging {
|
||||
if par.dragging || !par.config.space_gravity_enabled {
|
||||
return None;
|
||||
}
|
||||
|
||||
let prev_pos = self.space_pos;
|
||||
|
||||
self.velocity.y += par.config.space_drag_gravity * par.dt;
|
||||
self.velocity.y += par.config.space_gravity_gravity * par.dt;
|
||||
|
||||
// terminal velocity
|
||||
self.velocity.y = self.velocity.y.min(200.0);
|
||||
|
||||
self.velocity *= (par.config.space_drag_damping).powf(par.dt * 10.0);
|
||||
self.velocity *= (par.config.space_gravity_damping).powf(par.dt * 10.0);
|
||||
|
||||
self.space_pos += self.velocity * par.dt;
|
||||
|
||||
|
|
@ -80,7 +84,7 @@ impl SpaceGravity {
|
|||
/* at zero or below ground level */
|
||||
{
|
||||
// apply ground friction
|
||||
self.velocity *= 1.0 - par.config.space_drag_ground_friction * par.dt * 10.0;
|
||||
self.velocity *= 1.0 - par.config.space_gravity_ground_friction * par.dt * 10.0;
|
||||
}
|
||||
|
||||
if self.velocity.length_squared() > 0.00003 {
|
||||
|
|
|
|||
|
|
@ -165,11 +165,12 @@ pub struct AutoSettings {
|
|||
pub screen_render_down: bool,
|
||||
pub pointer_lerp_factor: f32,
|
||||
pub space_drag_unlocked: bool,
|
||||
pub space_gravity_damping: f32,
|
||||
pub space_gravity_enabled: bool,
|
||||
pub space_gravity_fling_strength: f32,
|
||||
pub space_gravity_gravity: f32,
|
||||
pub space_gravity_ground_friction: f32,
|
||||
pub space_rotate_unlocked: bool,
|
||||
pub space_drag_gravity: f32,
|
||||
pub space_drag_damping: f32,
|
||||
pub space_drag_fling_strength: f32,
|
||||
pub space_drag_ground_friction: f32,
|
||||
pub clock_12h: bool,
|
||||
pub hide_username: bool,
|
||||
pub opaque_background: bool,
|
||||
|
|
@ -224,11 +225,12 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
|
|||
screen_render_down: config.screen_render_down,
|
||||
pointer_lerp_factor: config.pointer_lerp_factor,
|
||||
space_drag_unlocked: config.space_drag_unlocked,
|
||||
space_gravity_damping: config.space_gravity_damping,
|
||||
space_gravity_enabled: config.space_gravity_enabled,
|
||||
space_gravity_fling_strength: config.space_gravity_fling_strength,
|
||||
space_gravity_gravity: config.space_gravity_gravity,
|
||||
space_gravity_ground_friction: config.space_gravity_ground_friction,
|
||||
space_rotate_unlocked: config.space_rotate_unlocked,
|
||||
space_drag_gravity: config.space_drag_gravity,
|
||||
space_drag_damping: config.space_drag_damping,
|
||||
space_drag_fling_strength: config.space_drag_fling_strength,
|
||||
space_drag_ground_friction: config.space_drag_ground_friction,
|
||||
clock_12h: config.clock_12h,
|
||||
hide_username: config.hide_username,
|
||||
opaque_background: config.opaque_background,
|
||||
|
|
|
|||
|
|
@ -552,15 +552,7 @@ pub fn apply_custom_command<T>(
|
|||
.parser_state
|
||||
.get_widget_id(element)
|
||||
.context("No widget with such id.")?;
|
||||
|
||||
let display = if *visible {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
};
|
||||
|
||||
com.alterables
|
||||
.set_style(wid, wgui::event::StyleSetRequest::Display(display));
|
||||
com.alterables.set_widget_visible(wid, *visible);
|
||||
com.alterables.mark_redraw();
|
||||
}
|
||||
ModifyPanelCommand::SetValue(value_str) => {
|
||||
|
|
|
|||
|
|
@ -84,13 +84,7 @@ pub fn create_grab_help(app: &mut AppState) -> anyhow::Result<OverlayWindowConfi
|
|||
};
|
||||
|
||||
for id in &all {
|
||||
let display = if *id == show_id {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
};
|
||||
|
||||
alterables.set_style(*id, StyleSetRequest::Display(display));
|
||||
alterables.set_widget_visible(*id, *id == show_id);
|
||||
}
|
||||
|
||||
panel.layout.process_alterables(alterables)?;
|
||||
|
|
|
|||
|
|
@ -47,26 +47,12 @@ pub fn new_pos_tab_handler(
|
|||
})
|
||||
}),
|
||||
Some(Box::new(move |common, state| {
|
||||
let interpolation_disp = if state.has_lerp {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
};
|
||||
|
||||
common.alterables.set_style(
|
||||
interpolation_id,
|
||||
StyleSetRequest::Display(interpolation_disp),
|
||||
);
|
||||
|
||||
let align_to_hmd_disp = if state.has_align {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
};
|
||||
|
||||
common
|
||||
.alterables
|
||||
.set_style(align_to_hmd_id, StyleSetRequest::Display(align_to_hmd_disp));
|
||||
.set_widget_visible(interpolation_id, state.has_lerp);
|
||||
common
|
||||
.alterables
|
||||
.set_widget_visible(align_to_hmd_id, state.has_align);
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,15 +72,9 @@ impl ButtonPaneTabSwitcher {
|
|||
return;
|
||||
};
|
||||
|
||||
let display = if visible {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
};
|
||||
|
||||
common
|
||||
.alterables
|
||||
.set_style(data.get_rect(), StyleSetRequest::Display(display));
|
||||
.set_widget_visible(data.get_rect(), visible);
|
||||
}
|
||||
|
||||
pub fn reset(&mut self, common: &mut CallbackDataCommon) {
|
||||
|
|
|
|||
|
|
@ -163,10 +163,10 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
|
|||
}
|
||||
|
||||
fn sets_or_overlays(panel: &mut GuiPanel<WatchState>, app: &mut AppState) {
|
||||
let display = if app.session.config.sets_on_watch {
|
||||
[taffy::Display::None, taffy::Display::Flex]
|
||||
let visible = if app.session.config.sets_on_watch {
|
||||
[false, true]
|
||||
} else {
|
||||
[taffy::Display::Flex, taffy::Display::None]
|
||||
[true, false]
|
||||
};
|
||||
|
||||
let widget = [
|
||||
|
|
@ -184,6 +184,6 @@ fn sets_or_overlays(panel: &mut GuiPanel<WatchState>, app: &mut AppState) {
|
|||
panel
|
||||
.layout
|
||||
.alterables
|
||||
.set_style(widget[i], StyleSetRequest::Display(display[i]));
|
||||
.set_widget_visible(widget[i], visible[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,14 +123,7 @@ fn refresh_all(common: &mut CallbackDataCommon, data: &Data, state: &mut State)
|
|||
}
|
||||
|
||||
// Cursor
|
||||
common.alterables.set_style(
|
||||
data.id_rect_cursor,
|
||||
StyleSetRequest::Display(if state.focused {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
}),
|
||||
);
|
||||
common.alterables.set_widget_visible(data.id_rect_cursor, state.focused);
|
||||
|
||||
state.first_refresh = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,17 @@ impl EventAlterables {
|
|||
self.style_set_requests.push((widget_id, request));
|
||||
}
|
||||
|
||||
pub fn set_widget_visible(&mut self, widget_id: WidgetID, visible: bool) {
|
||||
self.style_set_requests.push((
|
||||
widget_id,
|
||||
StyleSetRequest::Display(if visible {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
pub fn mark_dirty(&mut self, widget_id: WidgetID) {
|
||||
self.dirty_widgets.push(widget_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
drawing::{
|
||||
self, ANSI_BOLD_CODE, ANSI_RESET_CODE, Boundary, PushScissorStackResult, push_scissor_stack, push_transform_stack,
|
||||
},
|
||||
event::{self, CallbackDataCommon, Event, EventAlterables},
|
||||
event::{self, CallbackDataCommon, Event, EventAlterables, StyleSetRequest},
|
||||
globals::WguiGlobals,
|
||||
sound::WguiSoundType,
|
||||
task::Tasks,
|
||||
|
|
@ -149,6 +149,7 @@ pub type LayoutDispatchFunc = Box<dyn FnOnce(&mut CallbackDataCommon) -> anyhow:
|
|||
pub enum LayoutTask {
|
||||
RemoveWidget(WidgetID),
|
||||
SetWidgetStyle(WidgetID, event::StyleSetRequest),
|
||||
SetWidgetVisible(WidgetID, bool), // if true, sets Display to Flex; None, otherwise
|
||||
ModifyLayoutState(LayoutModifyStateFunc),
|
||||
PlaySound(WguiSoundType),
|
||||
Dispatch(LayoutDispatchFunc),
|
||||
|
|
@ -746,6 +747,16 @@ impl Layout {
|
|||
LayoutTask::SetWidgetStyle(widget_id, style_request) => {
|
||||
self.set_style_request(widget_id, &style_request);
|
||||
}
|
||||
LayoutTask::SetWidgetVisible(widget_id, visible) => {
|
||||
self.set_style_request(
|
||||
widget_id,
|
||||
&StyleSetRequest::Display(if visible {
|
||||
taffy::Display::Flex
|
||||
} else {
|
||||
taffy::Display::None
|
||||
}),
|
||||
);
|
||||
}
|
||||
LayoutTask::SetFocus(weak) => {
|
||||
if let Some(c) = weak.upgrade() {
|
||||
self.set_focus(Some(&components::Component(c)))?;
|
||||
|
|
|
|||
|
|
@ -36,10 +36,8 @@ pub fn parse_widget_label<'a>(
|
|||
params.content = Translation::from_raw_text(value);
|
||||
}
|
||||
}
|
||||
"translation" => {
|
||||
if !value.is_empty() {
|
||||
params.content = Translation::from_translation_key(value);
|
||||
}
|
||||
"translation" if !value.is_empty() => {
|
||||
params.content = Translation::from_translation_key(value);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,17 +336,20 @@ pub struct GeneralConfig {
|
|||
#[serde(default = "def_false")]
|
||||
pub space_rotate_unlocked: bool,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub space_drag_gravity: f32,
|
||||
#[serde(default = "def_false")]
|
||||
pub space_gravity_enabled: bool,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub space_drag_damping: f32,
|
||||
pub space_gravity_gravity: f32,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub space_drag_fling_strength: f32,
|
||||
pub space_gravity_damping: f32,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub space_drag_ground_friction: f32,
|
||||
pub space_gravity_fling_strength: f32,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub space_gravity_ground_friction: f32,
|
||||
|
||||
#[serde(default)]
|
||||
pub alt_click_down: Vec<String>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue