fix(ribbon): highlight toggle buttons by their actual state
The UCS Icon, Properties, File Tabs, and Layout Tabs buttons were highlighted unconditionally because their ids fell through to an active_tool equality check in is_active_tool, which activate_tool sets on every click and never clears. Each id is now mapped to its corresponding visibility flag (show_ucs_icon, show_properties, show_file_tabs, show_layout_tabs), and those flags are kept in sync from their toggle handlers so the highlight reflects live state. The per-toggle booleans previously threaded through the render path are consolidated into a single ToggleState struct read from one place, so introducing a further toggle no longer requires changing every render-function signature and call site.
This commit is contained in:
parent
15d1bdbdfe
commit
8ef65f59f8
4 changed files with 88 additions and 54 deletions
|
|
@ -81,6 +81,7 @@ impl OpenCADStudio {
|
|||
let at_origin = sub == "ORIGIN";
|
||||
// Update model-space icon flags.
|
||||
self.show_ucs_icon = visible;
|
||||
self.ribbon.set_ucs_icon(visible);
|
||||
if sub == "NOORIGIN" || sub == "ORIGIN" {
|
||||
self.ucs_icon_at_origin = at_origin;
|
||||
}
|
||||
|
|
@ -104,6 +105,7 @@ impl OpenCADStudio {
|
|||
self.push_undo_snapshot(i, "UCSICON");
|
||||
let visible = !self.show_ucs_icon;
|
||||
self.show_ucs_icon = visible;
|
||||
self.ribbon.set_ucs_icon(visible);
|
||||
for entity in self.tabs[i].scene.document.entities_mut() {
|
||||
if let acadrust::EntityType::Viewport(vp) = entity {
|
||||
vp.status.ucs_icon_visible = visible;
|
||||
|
|
|
|||
Loading…
Reference in a new issue