mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-26 18:31:11 +00:00
Port the sketch usability fixes: Enter/Esc, rename, stale picks
Carries snaporca 95e59289f9, faec177d42 and 20df726ecb. Parity re-verified: 17 files identical, 8 diverging by their expected counts — DesignCanvas.cpp back to 16 and DesignPanel.cpp back to 32, which is the proof each hunk landed on the right side of the FeatFlyout and TAB_ID_PREPARE divergences rather than on top of them. All three answer exussum12's review on OrcaSlicer PR #15238. ENTER/ESC IN THE VALUE FIELD. The field is a borderless always-on-top frame, and whether it may hold keyboard focus is the platform's decision — a borderless NSWindow can never be key, and mutter refuses a re-mapped window. When focus is denied the keys reach the panel instead and the queued-dimension chain (a line queues Length then Angle) cannot be walked. The CHAR_HOOK now forwards Enter/Numpad-Enter/Tab/Esc to the field when it is open and unfocused, and stays out of the way when it is focused. ESC FROM ANYWHERE. Separately and more simply: `dismissable` is false throughout sketch mode because m_active is the FEATURE tool, so Esc fell through to whatever widget had focus. Click any toolbar button or the Construction checkbox first and Esc did nothing at all — the likelier reading of "Esc hardly ever works", and platform-independent. DesignCanvas exposes request_sketch_exit() and the hook calls it whenever a sketch is live, after the inline-field forwarding so an open field still takes Esc first. RENAME. wxTR_EDIT_LABELS plus the two label-edit events write through to CadFeature::name and the recipe, with a Rename verb in the offer and F2. The rebuild is deferred with CallAfter because refresh_tree() destroys the very wxTreeItemId wx is holding during END_LABEL_EDIT — inline, it killed the process. STALE PICKS. set_tool now drops the Dimension tool's first pick, the Constrain picks and m_point_sel, and delete_selected clears the pending dimension reference that could otherwise dereference a renumbered entity. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fbf858ba47
commit
510e63dff2
@@ -241,6 +241,15 @@ void DesignSketchTool::set_tool(Mode mode)
|
||||
// the value away and reverted the corner to sharp, with nothing on screen saying so.
|
||||
reset_op(); // drop any in-progress (not yet ready) edit-op gizmo
|
||||
reset_tf(); // drop any in-progress transform gizmo
|
||||
// A pick that survives the tool that made it is invisible, and the first sign of it is a
|
||||
// constraint or a dimension landing on geometry the user did not choose. Drop the modal
|
||||
// picks left armed by the tool we are leaving: the Dimension tool's first pick, the
|
||||
// Constrain tool's picks, and the individual point selection.
|
||||
m_dim_has0 = false;
|
||||
m_dim_e0 = -1;
|
||||
m_dim_r0 = SketchPointRole::P0;
|
||||
m_pick0 = m_pick1 = m_pick2 = -1;
|
||||
m_point_sel.clear();
|
||||
m_selection.clear();
|
||||
if (on_selection_changed) on_selection_changed(0);
|
||||
}
|
||||
@@ -328,6 +337,11 @@ void DesignSketchTool::delete_selected()
|
||||
m_dimensions.clear();
|
||||
m_dim_has0 = false;
|
||||
m_pending_dim = -1;
|
||||
// The Dimension tool's pending FIRST pick is the same dangling-reference hazard as the placed
|
||||
// quotes just cleared above: it references an entity index that has shifted or gone away, and
|
||||
// a stale m_dim_e0 would dereference out of range on the next click. Drop it too.
|
||||
m_dim_e0 = -1;
|
||||
m_dim_r0 = SketchPointRole::P0;
|
||||
if (on_selection_changed) on_selection_changed(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user