Design: clicking empty space lets go of the selection, and the status line follows its tab

Two things a click on nothing should already have done.

snaporca-od0. A click that hit no geometry left the solid selection standing. A
rubber band swept over empty space has always cleared it (pick_bodies_in_rectangle),
and the two gestures cannot disagree about the same outcome. The visible cost was in
the escalation that landed last commit: "click the face, click away, click the face
again" arrived as the SECOND click on the same face and took the whole body, when the
click away was the user letting go of it. Now the miss clears and says so.

This gives up something real, deliberately: Thicken / Shell / Draft hold their input
face in the panel's selection, so a stray click on empty canvas with one of those
cards open hands that face back. Their handlers already write the "(pick a solid
face)" placeholder and rebuild the ghost when the selection empties, so the card SAYS
it lost the pick rather than confirming against a face the viewport has stopped
highlighting. An orbit drag never reaches this branch — it exits at the 8px budget —
so panning the view still does not deselect.

snaporca-dlj. The status line is a wxPopupWindow, which is a TOP-LEVEL window: hiding
the Design page does not hide it. Select a face, switch to Prepare, and the chip was
still there reading "selected (whole body) — right-click for what applies to it" on a
tab with no such selection and no such menu. Same cause, second symptom: a status
update arriving while the page is hidden anchored against a client size that is not
the size the page will have, and parked the chip on the tab bar. So: an
IsShownOnScreen guard in place_status_hud, show_status_hud(bool) to take it down and
bring it back with its text intact, driven from the page-changed handler.

Verified on both rigs, not by reasoning about it: face 5 selected -> click bed ->
"Nothing selected", tint gone -> click the same face -> face 5 again, NOT the body ->
click it again with no click away -> whole body, so snaporca-gem is intact. Prepare ->
chip gone; back to Design -> chip returns. KEYTRACE across the round trip shows
shift+S then R still reaching the canvas (ui_mode 0 -> 1, Rectangle armed), which is
the focus theft this popup replaced a wxFrame to avoid.

Fork parity unchanged: DesignPanel.cpp 30, DesignCanvas.cpp 16, headers and
DesignSketchTool.cpp 0. MainFrame.cpp is outside that set and was edited per fork.
This commit is contained in:
Tommaso Bianchi
2026-08-03 11:05:45 +02:00
parent c32aa3f8ba
commit 9c3ce9b45e
6 changed files with 54 additions and 0 deletions
+11
View File
@@ -970,6 +970,10 @@ void DesignCanvas::set_status_text(const wxString& text, const wxColour& colour)
void DesignCanvas::place_status_hud()
{
if (!m_status_hud || !m_canvas_widget || m_status_hud_last.IsEmpty()) return;
// The canvas has a client size even while its page is hidden, and it is not the size the
// page will have when shown — anchoring against it put the chip up on the tab bar, where it
// then stayed until the next status change moved it. Nothing to anchor to: stay down.
if (!m_canvas_widget->IsShownOnScreen()) { m_status_hud->Hide(); return; }
const wxSize cs = m_canvas_widget->GetClientSize();
const wxSize hs = m_status_hud->GetSize();
// Clear of the view cube and the two round view buttons, which own the bottom-left corner.
@@ -983,6 +987,13 @@ void DesignCanvas::place_status_hud()
m_status_hud->Move(bl);
}
void DesignCanvas::show_status_hud(bool on)
{
if (!m_status_hud) return;
if (on) place_status_hud(); // re-anchors first: the page may have been resized while away
else m_status_hud->Hide();
}
void DesignCanvas::set_body_highlight(bool on)
{
if (m_body_selected == on) return;