diff --git a/rvimage/src/rvlib/menu/tools_menus.rs b/rvimage/src/rvlib/menu/tools_menus.rs index 6ff10a6..33624f3 100644 --- a/rvimage/src/rvlib/menu/tools_menus.rs +++ b/rvimage/src/rvlib/menu/tools_menus.rs @@ -17,8 +17,8 @@ use crate::{ }, }; use egui::Ui; -use rvimage_domain::{to_rv, RvResult}; -use rvimage_domain::{TPtF, TPtI}; +use rvimage_domain::TPtF; +use rvimage_domain::{to_rv, RvResult, TPtS}; use tracing::{info, warn}; use super::ui_util::{slider, text_edit_singleline}; @@ -504,7 +504,7 @@ pub fn attributes_menu( ); ui.selectable_value( &mut data.new_attr_val, - AttrVal::Int(TPtI::default()), + AttrVal::Int(TPtS::default()), INT_LABEL, ); ui.selectable_value( @@ -539,7 +539,7 @@ pub fn attributes_menu( } } Some(AttrVal::Float(x)) => { - let (lost_focus, new_val) = process_number( + let (input_changed, new_val) = process_number( ui, are_tools_active, FLOAT_LABEL, @@ -548,7 +548,7 @@ pub fn attributes_menu( if let Some(new_val) = new_val { *x = new_val; } - if lost_focus || ui.button("OK").clicked() { + if input_changed { data.options.is_update_triggered = true; } } @@ -562,7 +562,7 @@ pub fn attributes_menu( if let Some(new_val) = new_val { *x = new_val; } - if lost_focus || ui.button("OK").clicked() { + if lost_focus { data.options.is_update_triggered = true; } } @@ -570,7 +570,7 @@ pub fn attributes_menu( let lost_focus = text_edit_singleline(ui, s, are_tools_active) .on_hover_text(TEXT_LABEL) .lost_focus(); - if lost_focus || ui.button("OK").clicked() { + if lost_focus { data.options.is_update_triggered = true; } } diff --git a/rvimage/src/rvlib/menu/ui_util.rs b/rvimage/src/rvlib/menu/ui_util.rs index 9701b38..bf69575 100644 --- a/rvimage/src/rvlib/menu/ui_util.rs +++ b/rvimage/src/rvlib/menu/ui_util.rs @@ -64,14 +64,14 @@ where let new_val = text_edit_singleline(ui, buffer, are_tools_active).on_hover_text(label); if new_val.changed() { match buffer.parse::() { - Ok(val) => (new_val.lost_focus(), Some(val)), + Ok(val) => (true, Some(val)), Err(_) => { warn!("could not parse {buffer} as number"); - (new_val.lost_focus(), None) + (false, None) } } } else { - (new_val.lost_focus(), None) + (false, None) } } pub fn button_triggerable_number( diff --git a/rvimage/src/rvlib/tools_data/attributes_data.rs b/rvimage/src/rvlib/tools_data/attributes_data.rs index 3dcaed8..db88531 100644 --- a/rvimage/src/rvlib/tools_data/attributes_data.rs +++ b/rvimage/src/rvlib/tools_data/attributes_data.rs @@ -6,7 +6,7 @@ use std::{ }; use crate::{cfg::ExportPath, implement_annotate, implement_annotations_getters, ShapeI}; -use rvimage_domain::{rverr, to_rv, RvResult, TPtF, TPtI}; +use rvimage_domain::{rverr, to_rv, RvResult, TPtF, TPtS}; use super::label_map::LabelMap; @@ -25,7 +25,7 @@ pub const ATTR_INTERVAL_SEPARATOR: &str = "-"; #[derive(Deserialize, Serialize, Clone, PartialEq, Debug)] pub enum AttrVal { Float(TPtF), - Int(TPtI), + Int(TPtS), Str(String), Bool(bool), } @@ -55,7 +55,7 @@ impl AttrVal { x == &attr_val } AttrVal::Int(x) => { - let attr_val = attr_val.parse::().map_err(to_rv)?; + let attr_val = attr_val.parse::().map_err(to_rv)?; x == &attr_val } AttrVal::Str(s) => {