refactor(ribbon): derive the Block Palette button highlight from app state

The ribbon kept its own \show_block_palette\ copy that the app had to
manually sync at every mutation point (the BLOCKPALETTE command and the
dock Close handler). Drop the copy and thread the app's authoritative
\show_block_palette\ into \Ribbon::view\ at render time, so the button
highlight can't drift from the panel's true visibility — those two
handlers are now mutate-points only and the ribbon view is the single
place that reads the state back.
This commit is contained in:
Karim Jerbi committed 2026-08-15 14:42:08 +01:00
1 parent c3e3132b39
commit b4da342f0e
4 files changed
+27 -12

No files matched your search

-1
View File
@@ -486,7 +486,6 @@ impl OpenCADStudio {
// BLOCKPALETTE / BLOCKSPALETTE — toggle the docked Insert Block panel.
"BLOCKPALETTE" | "BLOCKSPALETTE" => {
self.show_block_palette ^= true;
self.ribbon.set_block_palette(self.show_block_palette);
if self.show_block_palette {
// Always open expanded so the panel is immediately usable;
// the user can still collapse it via the pin (Auto) button.