fix(layers): freeze toggle in ribbon dropdown + sortable manager columns

Ribbon layer dropdown rows were a single button, so a click on the
visible/freeze/lock icon fell through to the make-active handler instead
of toggling that state. Split the row: each icon is its own toggle
button, only the swatch+label selects the active layer. Toggle handlers
now resync the ribbon so the icon updates while the dropdown stays open.

Layer Manager columns are now sortable: clicking a header sorts by that
column, clicking again flips direction (SVG arrow indicator). Sort is
reapplied on every panel sync so it survives edits, preserves the
selection by name, and keeps the ribbon dropdown order in step.

Fixes #133

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-19 20:39:09 +03:00
1 parent caafb9b99d
commit 36d5891572
4 files changed
+205 -48

No files matched your search

+2
View File
@@ -889,6 +889,8 @@ pub enum Message {
LayerToggleVisible(usize),
LayerToggleLock(usize),
LayerToggleFreeze(usize),
/// Sort the Layer Manager table by a clicked column header.
LayerSort(crate::ui::layers::LayerSortCol),
/// Toggle per-viewport freeze: (layer_index, vp_col_index)
LayerToggleVpFreeze(usize, usize),
LayerNew,
+12
View File
@@ -1894,10 +1894,20 @@ impl OpenCADStudio {
name,
if on { "on" } else { "off" }
));
self.sync_ribbon_layers();
}
Task::none()
}
Message::LayerSort(col) => {
let i = self.active_tab;
self.tabs[i].layers.sort_by(col);
// Keep the ribbon dropdown's order (and its toggle indices) in
// step with the re-sorted manager table.
self.sync_ribbon_layers();
Task::none()
}
Message::LayerToggleLock(idx) => {
let i = self.active_tab;
if idx < self.tabs[i].layers.layers.len() {
@@ -1912,6 +1922,7 @@ impl OpenCADStudio {
name,
if locked { "locked" } else { "unlocked" }
));
self.sync_ribbon_layers();
}
Task::none()
}
@@ -1933,6 +1944,7 @@ impl OpenCADStudio {
}
self.tabs[i].scene.bump_geometry();
self.tabs[i].dirty = true;
self.sync_ribbon_layers();
}
Task::none()
}