feat(ribbon): Block Palette button reflects panel open state

The Insert tab's Block Palette button now behaves like the View tab toggles
(UCS Icon, View Cube, Ortho, Properties, File Tabs, Layout Tabs): it stays
highlighted while the block palette panel is open and clears when closed.

The Ribbon gains a show_block_palette flag with a set_block_palette setter,
fed into ToggleState and mapped in is_active_tool for the BLOCKPALETTE tool
id. show_block_palette on the app remains the single source of truth; both
mutation paths now mirror it onto the ribbon:

- BLOCKPALETTE / BLOCKSPALETTE command toggles ribbon state alongside the
  panel (src/app/commands/blocks.rs).
- Closing the panel via the dock rail close button clears the ribbon state,
  matching how Close(Properties) already syncs (src/app/update/dialog.rs).
This commit is contained in:
Karim Jerbi committed 2026-08-14 23:33:45 +01:00
1 parent 28e5deb222
commit fbab4c4934
4 files changed
+12

No files matched your search

+1
View File
@@ -486,6 +486,7 @@ 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.
+1
View File
@@ -597,6 +597,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
match id {
PanelId::BlockPalette => {
self.show_block_palette = false;
self.ribbon.set_block_palette(false);
self.block_palette.placing = None;
}
PanelId::Properties => {