feat(layers): alphabetical default order + scroll to a new layer

The Layer Manager table and the ribbon's quick layer dropdown both
showed layers in document (insertion) order. Default the panel sort to
Name so both list layers alphabetically; a header click still re-sorts
by any other column. `apply_sort` reorders the panel's layer vector in
place, which the ribbon dropdown reads, so one default covers both.

With alphabetical ordering a freshly created layer can land anywhere in
a long list, so give the table scrollable an id and scroll its row into
view after creation, keeping the rename prompt visible.

Closes #270, closes #271

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-04 22:28:07 +03:00
1 parent 450dbf79ac
commit d644a85c72
2 files changed
+27 -3

No files matched your search

+17 -1
View File
@@ -635,7 +635,23 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
self.tabs[i].layers.edit_buf = new_name.clone();
}
self.sync_ribbon_layers();
Task::none()
// With alphabetical ordering (#270) the new layer can land
// anywhere in a long list; scroll its row into view so the
// rename prompt is visible (#271). Offset is layout-independent
// (idx × fixed row height), so it holds even before the freshly
// added row is measured.
match new_idx {
Some(idx) => iced::widget::operation::scroll_to(
iced::advanced::widget::Id::new(
crate::ui::window::layers::LAYER_TABLE_SCROLL_ID,
),
iced::widget::scrollable::AbsoluteOffset {
x: 0.0,
y: idx as f32 * crate::ui::ROW_H,
},
),
None => Task::none(),
}
}
pub(super) fn on_layer_delete(&mut self) -> Task<Message> {