Add Graphic Attributes palette toggle and persistence

This commit is contained in:
Marcel committed 2026-09-29 21:34:31 +02:00
1 parent 3b74c7e7ea
commit 3e45331de1
14 files changed
+220 -71

No files matched your search

+37
View File
@@ -4229,6 +4229,19 @@ impl OpenCADStudio {
self.ribbon.set_properties(self.show_properties);
Task::none()
}
Message::ToggleGraphicAttributes => {
self.show_graphic_attributes ^= true;
self.ribbon
.set_graphic_attributes(self.show_graphic_attributes);
if !self.show_graphic_attributes {
self.graphic_attributes_header_menu_open = false;
self.graphic_attribute_menu_open = false;
self.gradient_editor = None;
self.hatch_editor_handles = None;
}
self.save_config();
Task::none()
}
Message::ToggleFileTabs => {
self.show_file_tabs ^= true;
self.ribbon.set_file_tabs(self.show_file_tabs);
@@ -11220,6 +11233,30 @@ mod prop_pointer_tests {
}
}
#[cfg(test)]
mod graphic_attributes_visibility_tests {
use super::Message;
use crate::app::OpenCADStudio;
#[test]
fn graphic_attributes_starts_hidden_and_toggle_is_persisted() {
let mut app = OpenCADStudio::new_for_test();
app.apply_config(crate::app::config::AppConfig::default());
assert!(!app.show_graphic_attributes);
assert!(!app.ribbon.show_graphic_attributes);
let _ = app.update(Message::ToggleGraphicAttributes);
assert!(app.show_graphic_attributes);
assert!(app.ribbon.show_graphic_attributes);
assert!(app.current_config().show_graphic_attributes);
let _ = app.update(Message::ToggleGraphicAttributes);
assert!(!app.show_graphic_attributes);
assert!(!app.ribbon.show_graphic_attributes);
assert!(!app.current_config().show_graphic_attributes);
}
}
#[cfg(test)]
mod free_text_entry_tests {
//! The free-form text prompts (table cell content, TEXT / MTEXT bodies)