From 71e0abe4e4d70e111957b7a8e21bdd74c02e2850 Mon Sep 17 00:00:00 2001 From: Fabien JUIF Date: Thu, 8 May 2025 16:52:14 +0200 Subject: [PATCH] S,M,L connected to SpinButton --- src/configuration.rs | 2 +- src/sketch_board.rs | 6 - src/style.rs | 90 +++-------- src/tools/arrow.rs | 10 +- src/tools/blur.rs | 4 +- src/tools/highlight.rs | 6 +- src/tools/marker.rs | 15 +- src/ui/toolbars.rs | 345 +++++++++++++---------------------------- 8 files changed, 133 insertions(+), 345 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index f7c9ac9..e3af9a2 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -348,7 +348,7 @@ impl Default for Configuration { corner_roundness: 12.0, initial_tool: Tools::Pointer, copy_command: None, - annotation_size_factor: 1.0, + annotation_size_factor: 100.0, /* 100% ~ medium | 33% ~ small | 300% ~ large */ action_on_enter: Action::SaveToClipboard, action_on_escape: Action::Exit, save_after_copy: false, diff --git a/src/sketch_board.rs b/src/sketch_board.rs index df26416..d2b10c0 100644 --- a/src/sketch_board.rs +++ b/src/sketch_board.rs @@ -430,12 +430,6 @@ impl SketchBoard { .borrow_mut() .handle_event(ToolEvent::StyleChanged(self.style)) } - ToolbarEvent::AnnotationSizeChanged(value) => { - self.style.annotation_size_factor = value; - self.active_tool - .borrow_mut() - .handle_event(ToolEvent::StyleChanged(self.style)) - } } } } diff --git a/src/style.rs b/src/style.rs index 31a9375..2a50674 100644 --- a/src/style.rs +++ b/src/style.rs @@ -16,7 +16,6 @@ pub struct Style { pub color: Color, pub size: Size, pub fill: bool, - pub annotation_size_factor: f32, } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] @@ -27,21 +26,19 @@ pub struct Color { pub a: u8, } -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default)] -pub enum Size { - Small = 0, - #[default] - Medium = 1, - Large = 2, +#[derive(Debug, PartialEq, PartialOrd, Clone, Copy)] +pub struct Size { + pub value: f32, } impl Default for Style { fn default() -> Self { Self { color: Color::default(), - size: Size::default(), fill: bool::default(), - annotation_size_factor: APP_CONFIG.read().annotation_size_factor(), + size: Size { + value: APP_CONFIG.read().annotation_size_factor(), + }, } } } @@ -165,81 +162,34 @@ impl From