Tell the user the badge is a button, and refresh the DoF when one is deleted

A glyph reads as decoration until something says otherwise, so the badges shipped
last commit were discoverable only by accident. Two places now say it, chosen because
they are where the eye already is:

- the moment of applying, which is the one the user is watching ("Applied constraint ·
  its badge is on the sketch — click the badge to remove it"). The hint line could not
  carry this alone: it only refreshes when the (mode, step, picks) tuple changes, and
  applying a constraint changes none of them.
- the Select-mode hint line, appended only while the live sketch actually holds a
  constraint, so it never advertises a badge that is not on screen.

Also fixes what the previous commit got wrong: remove_constraint_near solved through
solve_sketch_entities directly, which relaxes the geometry but leaves m_dof and the
per-entity conflict flags untouched and never fires on_solve_state. Deleting a
constraint therefore left the DoF readout describing the system as it was BEFORE the
deletion, and any red over-constrained tint stranded on screen. It goes through
resolve_live() now, the same path every other live edit uses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FbJKJAJxxkhDTs9XdZzKA
This commit is contained in:
Tommaso Bianchi
2026-09-01 06:41:31 +02:00
co-authored by Claude Opus 5
parent 3da0af38c3
commit b250a2b858
4 changed files with 22 additions and 2 deletions
+9 -1
View File
@@ -6329,6 +6329,12 @@ void DesignPanel::on_sketch_step(int mode, int step, int picks)
if (step == 0 && picks == 0 && DesignSketchTool::Mode(mode) != DesignSketchTool::Mode::Select
&& !text.IsEmpty())
text += _L(" · Esc goes back to Select");
// Badges are clickable and nothing said so — a glyph reads as decoration until something
// tells you it is a target. Only in Select mode (the only mode where the click is wired) and
// only once a constraint exists, so it never advertises a badge that is not on screen.
if (DesignSketchTool::Mode(mode) == DesignSketchTool::Mode::Select && m_viewport != nullptr &&
m_viewport->sketch_constraint_count() > 0 && !text.IsEmpty())
text += _L(" · click a constraint badge to remove it");
m_sketch_step = text;
if (text.IsEmpty() || m_status == nullptr) return;
m_status->SetForegroundColour(wxNullColour);
@@ -7842,7 +7848,9 @@ void DesignPanel::apply_live_constraint(SketchConstraintType type)
}
m_viewport->request_repaint();
m_status->SetForegroundColour(wxNullColour);
set_status(_L("Applied constraint"));
// Say where it went and how to undo it, here at the moment of applying: the hint line
// only refreshes when the step tuple changes, which applying a constraint does not.
set_status(_L("Applied constraint · its badge is on the sketch — click the badge to remove it"));
m_status->Refresh();
};