forked from 1b-agent/opencadstudio-upstream
feat(ribbon): collapse overflowing panels to flyout buttons, anchor dropdowns to their widget
Third stage of the adaptive tool area (shrink -> compact -> collapse). When even the compact panels don't fit, DensitySwap picks a new CollapsePanels widget that keeps a left prefix of panels inline and collapses the rest to buttons; clicking a button opens the full panel as an overlay flyout anchored below it (closes on outside press, mirroring color_select's Floating). A collapsed panel's button shows a live representative tool — the panel's last-used tool (tracked per panel in Ribbon::note_panel_tool on every tool click), defaulting to its first — rendered as a large icon. To support this, render_small now also renders Large* items small and render_large now renders plain Tool/Dropdown items large. Large dropdowns render as icon + label + a bottom arrow strip via a shared render_large_dropdown helper, used in both the full ribbon and collapsed panels. Ribbon dropdowns (tool dropdowns + undo/redo history) now anchor their overlay directly below their widget at any size: a transparent PosReport wrapper records each dropdown button's screen bounds into a thread-local map on draw, and the overlays read it via Ribbon::dd_anchor instead of the layout-estimating compute_*_left helpers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff36a1bdac
commit
56e48b8d0f
7 files changed
+1024
-194
No files matched your search
@@ -96,6 +96,10 @@ impl OpenCADStudio {
|
||||
|
||||
|
||||
pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEvent) -> Task<Message> {
|
||||
// Dismiss any open dropdown / collapsed-panel flyout on tool use,
|
||||
// and remember this tool as its panel's last-used one.
|
||||
self.ribbon.close_dropdown();
|
||||
self.ribbon.note_panel_tool(&tool_id);
|
||||
self.ribbon.activate_tool(&tool_id);
|
||||
match event {
|
||||
ModuleEvent::Command(cmd) => return self.dispatch_command(&cmd),
|
||||
|
||||
@@ -1655,6 +1655,10 @@ impl OpenCADStudio {
|
||||
self.ribbon.toggle_dropdown(&id);
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleRibbonPanel(id) => {
|
||||
self.ribbon.toggle_collapsed_panel(&id);
|
||||
Task::none()
|
||||
}
|
||||
Message::CloseRibbonDropdown => {
|
||||
self.ribbon.close_dropdown();
|
||||
Task::none()
|
||||
|
||||
Reference in new issue
Block a user