CAD: an armed face/edge pick must not lose its click to the body escalation

A card that asks for a face ("Click a solid FACE in the viewport") could not be
satisfied. Clicking the same sub-element twice deliberately escalates to the
whole body — right for free picking, wrong here: the user clicks the very face
the card is pointing at, the escalation turns it into a whole-body pick, and the
armed capture rejects it and leaves "(none)". Both orders failed, so a
face-based Coord Sys was reachable only by accident of ordering. That mattered
beyond the card: a mate needs a connector with an owning body, and a face or
edge pick is the only thing that sets one.

Adds DesignSketchTool::set_escalate_on_repick, off while the Plane, Axis or
CoordSys card has a pick armed and back on as soon as it is captured or
abandoned. While armed, clicking a face means "this face", which is what the
prompt already says.

Verified on the rig: arm Pick Face, click the face, and it reads "#5" on the
first click. With nothing armed the escalation still alternates whole <-> face
as before.
This commit is contained in:
Tommaso Bianchi
2026-08-14 08:26:24 +02:00
parent d8103f794b
commit 76d7dd6946
5 changed files with 31 additions and 1 deletions
+8
View File
@@ -90,6 +90,13 @@ public:
// Does the live session hold anything a cancel would throw away? Escape must not silently
// destroy drawn geometry; the panel asks this before treating Escape as "discard sketch".
bool live_sketch_has_work() const { return !m_entities.empty(); }
// Clicking the same sub-element again escalates to the whole body. That is right for free
// picking and WRONG while a card has armed a face/edge pick: the card says "click a FACE",
// the user clicks the face it is already showing, and the escalation turns it into a
// whole-body pick that the armed capture then rejects. The host turns this off for as long
// as a pick is armed.
void set_escalate_on_repick(bool on) { m_escalate_repick = on; }
bool constrain_value_anchor(wxPoint& out) const; // screen anchor over the picked constrain geometry
void begin(const SketchPlane& plane, Mode mode = Mode::Polyline);
@@ -1043,6 +1050,7 @@ private:
int& edge_feat, int& edge_reg, int& edge_ent,
double& edge_d, int& face_feat, int& face_reg) const;
bool m_right_consumed{false}; // last RightDown was a gesture terminator, not a menu
bool m_escalate_repick{true}; // re-picking the same sub-element takes the whole body
void render_solid_highlight();
// The shared body of the above: one highlight from explicit arguments, so the committed
// selection and the hover pre-highlight cannot drift apart in how they look.