feat(ribbon): shrink large tools to compact icons when the ribbon is narrow

Add a DensitySwap widget that renders the widest variant of the tool
area that fits the current width. The ribbon builds two variants via the
new build_tool_row(compact) helper: full-size panels, and a compact one
where LargeTool/LargeDropdown collapse to small icon columns (the
layer/properties/style combos always stay full). render_small now also
matches the Large* variants so they can be drawn small.

First stage of the adaptive tool area (shrink -> wrap -> collapse).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-05 16:44:44 +03:00
1 parent a065dc939f
commit 65dfd4e462
3 files changed
+330 -99

No files matched your search

+10 -1
View File
@@ -344,7 +344,9 @@ pub(super) fn render_small<'a>(
ortho_mode: bool,
) -> Element<'a, Message> {
match item {
RibbonItem::Tool(t) => {
// Large variants render small too, so the ribbon can shrink a panel of
// large buttons to icon-only columns when the width is tight.
RibbonItem::Tool(t) | RibbonItem::LargeTool(t) => {
let active = is_active_tool(t.id, active_tool, wireframe, ortho_mode);
let event = t.event.clone();
let tool_id = t.id.to_string();
@@ -368,6 +370,13 @@ pub(super) fn render_small<'a>(
items,
default,
..
}
| RibbonItem::LargeDropdown {
id,
icon,
items,
default,
..
} => {
let active = active_tool.as_deref() == Some(*id)
|| items