watch: save fade settings

This commit is contained in:
galister
2024-03-06 18:16:34 +01:00
parent 97fd6c1fc0
commit c73a01fb7f
2 changed files with 13 additions and 3 deletions

View File

@@ -42,11 +42,11 @@ fn def_one() -> f32 {
1.0 1.0
} }
fn def_half() -> f32 { pub fn def_half() -> f32 {
0.5 0.5
} }
fn def_point7() -> f32 { pub fn def_point7() -> f32 {
0.7 0.7
} }

View File

@@ -4,7 +4,9 @@ use std::path::PathBuf;
use crate::{ use crate::{
backend::overlay::{ui_transform, OverlayData, OverlayState, RelativeTo}, backend::overlay::{ui_transform, OverlayData, OverlayState, RelativeTo},
config::{def_left, def_watch_pos, def_watch_rot, load_known_yaml, ConfigType}, config::{
def_half, def_left, def_point7, def_watch_pos, def_watch_rot, load_known_yaml, ConfigType,
},
config_io, config_io,
gui::modular::{modular_canvas, ModularUiConfig}, gui::modular::{modular_canvas, ModularUiConfig},
state::{AppState, LeftRight}, state::{AppState, LeftRight},
@@ -78,6 +80,12 @@ pub struct WatchConf {
#[serde(default = "def_left")] #[serde(default = "def_left")]
pub watch_hand: LeftRight, pub watch_hand: LeftRight,
#[serde(default = "def_half")]
pub watch_view_angle_min: f32,
#[serde(default = "def_point7")]
pub watch_view_angle_max: f32,
} }
fn get_config_path() -> PathBuf { fn get_config_path() -> PathBuf {
@@ -90,6 +98,8 @@ pub fn save_watch(app: &mut AppState) -> anyhow::Result<()> {
watch_pos: app.session.config.watch_pos.clone(), watch_pos: app.session.config.watch_pos.clone(),
watch_rot: app.session.config.watch_rot.clone(), watch_rot: app.session.config.watch_rot.clone(),
watch_hand: app.session.config.watch_hand, watch_hand: app.session.config.watch_hand,
watch_view_angle_min: app.session.config.watch_view_angle_min,
watch_view_angle_max: app.session.config.watch_view_angle_max,
}; };
let yaml = serde_yaml::to_string(&conf)?; let yaml = serde_yaml::to_string(&conf)?;