fix(ribbon): make command icons inert on the Start page

On the Start page there is no drawing to act on, but ribbon panel
command icons still dispatched into the empty welcome tab. Guard
on_ribbon_tool_click: when the active tab is the Start page, close any
open flyout, show a "use New or Open first" hint, and do nothing. The
quick-access New / Open / Save buttons use a separate path and stay
available, as do the welcome page's own actions.

The icons are not yet visually greyed out (that needs an enabled flag
threaded through the ribbon render) — this stops them from running.

Refs #299

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-11 10:11:28 +03:00
1 parent 438cbd17b1
commit cf4074b0f2
1 file changed
+11
+11
View File
@@ -91,6 +91,17 @@ impl OpenCADStudio {
pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEvent) -> Task<Message> {
// On the Start page there is no drawing to act on — ribbon
// commands are inert. Point the user at New / Open instead of
// running a command into the empty welcome tab (#299). The
// quick-access New / Open / Save buttons use a separate path and
// stay available.
if self.tabs[self.active_tab].is_start {
self.ribbon.close_dropdown();
self.command_line
.push_info("No drawing open — use New or Open first.");
return Task::none();
}
// 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();