Design: double-click a sketch stroke to edit it — the gesture belongs on the geometry

Selecting a committed sketch line lit the right tree row and then told the user
to go and press Edit in the panel. That is the side-panel dependency this tab
exists to remove, and it made "selectable" true while "editable from the
geometry" stayed false.

on_edit_feature already does the whole job — re-open the entities in the sketch
UI with handles and live quotes — and was only ever reachable from a tree row.
A double-click on a committed stroke now calls it for that feature. Double-click
on empty space still fits the view, so nothing is taken away.

The stroke hit test is now one hit_display_sketch() shared by the click and the
double-click. Two copies of "what is under the pointer" drift, and a double-click
acting on a different entity than the click before it is a miserable thing to
chase. It also reports the entity index, which the tracer prints, so a pick that
lands on the wrong stroke can be seen rather than inferred.

Verified on :11 end to end: draw an open line, commit, double-click it. The
tracer prints "double-click -> edit sketch feature 0 (entity 0)", the panel
reads "Editing sketch — drag a handle or click a quote to edit", and a click
inside the session selects the line with endpoint handles, live quotes and
"1 selected — Delete removes them".

NOT delivered by this commit, found while verifying it: typing a new value into
a length quote is accepted and displayed but the geometry does not move and the
solver drops to "Conflicting constraints". Filed separately — it lives in the
constraint layer, not in selection, and nothing here touches it.

Refs snaporca-e1p.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyRwbuq6fjn3VV9U9UvhBM
This commit is contained in:
Tommaso Bianchi
2026-07-31 21:10:08 +02:00
co-authored by Claude Opus 5
parent c5404507c7
commit a1fdb9f217
5 changed files with 84 additions and 28 deletions
+8
View File
@@ -158,6 +158,9 @@ public:
// Click a committed sketch overlay (no live session) -> select that loop: the Sketch
// feature index + the clicked closed-region index within it (-1 = no specific loop).
std::function<void(int feature, int region)> on_display_sketch_selected;
// Double-click on a committed sketch stroke: open THAT feature for editing. Selecting a line
// and then hunting for an Edit button in a panel is the dependency this tab exists to remove.
std::function<void(int feature)> on_display_sketch_activated;
// Entities forming the currently click-selected loop (for a per-loop extrude); empty
// if no loop is selected.
std::vector<SketchEntity> selected_loop_entities() const;
@@ -918,6 +921,11 @@ private:
GLSelectionRectangle m_rubber;
void pick_bodies_in_rectangle(); // resolve the swept rectangle -> whole-body selection
bool on_mouse_impl(wxMouseEvent& evt, GLCanvas3D& canvas); // the body; on_mouse wraps it
// Nearest stroke + enclosing region of ONE committed sketch. Shared by the click and
// double-click paths so they cannot disagree about what is under the pointer.
void hit_display_sketch(const DisplaySketch& d, const Vec2d& p, double tol,
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
void render_solid_highlight();
void render_datum_planes(); // translucent rectangles for datum/reference planes