From 700afdb07fdca647eb694964f934e2def0f6c293 Mon Sep 17 00:00:00 2001 From: George Peden Date: Sun, 7 Sep 2025 12:31:14 -1000 Subject: [PATCH] Add context-aware hints for ConstrainAngle tool - Add special case for Sketcher_ConstrainAngle in getToolHints() - Hints now remember what user has selected to provide appropriate guidance - Step 0: 'pick edge or first point' (covers all workflows) - Step 1: Context-aware based on first selection: - If point first: 'pick first edge' (point+edge+edge workflow) - If line first: 'pick second line or point' (line+line or edge+point+edge) - Step 2: Context-aware based on selection history: - Point+edge+edge: 'pick second edge' - Edge+point+edge: 'pick second edge' - Fixes part of issue #22282 - missing angle constraint hints --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 32 +++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 8d207abd38..1cb68b96f4 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1125,6 +1125,30 @@ public: } } + // Special case for Sketcher_ConstrainAngle to generate context-aware hints + if (commandName == "Sketcher_ConstrainAngle") { + if (selectionStep == 0) { + return {{QObject::tr("%1 pick edge or first point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (selectionStep == 1 && !selSeq.empty()) { + if (isVertex(selSeq[0].GeoId, selSeq[0].PosId)) { + // Point + Edge + Edge workflow + return {{QObject::tr("%1 pick first edge"), {Gui::InputHint::UserInput::MouseLeft}}}; + } else { + // Could be Line + Line or Edge + Point + Edge workflow + // Tell user what they can actually pick next + return {{QObject::tr("%1 pick second line or point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } + } else if (selectionStep == 2 && !selSeq.empty()) { + if (isVertex(selSeq[0].GeoId, selSeq[0].PosId)) { + // Point + Edge + Edge workflow + return {{QObject::tr("%1 pick second edge"), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (isVertex(selSeq[1].GeoId, selSeq[1].PosId)) { + // Edge + Point + Edge workflow + return {{QObject::tr("%1 pick second edge"), {Gui::InputHint::UserInput::MouseLeft}}}; + } + } + } + // For everything else, use the static table return lookupConstraintHints(commandName, selectionStep); } @@ -1237,11 +1261,15 @@ private: // Angle {.commandName = "Sketcher_ConstrainAngle", .selectionStep = 0, - .hints = {{QObject::tr("%1 pick line"), {Gui::InputHint::UserInput::MouseLeft}}}}, + .hints = {{QObject::tr("%1 pick edge or first point"), {Gui::InputHint::UserInput::MouseLeft}}}}, {.commandName = "Sketcher_ConstrainAngle", .selectionStep = 1, - .hints = {{QObject::tr("%1 pick second line"), {Gui::InputHint::UserInput::MouseLeft}}}}, + .hints = {{QObject::tr("%1 pick second element"), {Gui::InputHint::UserInput::MouseLeft}}}}, + + {.commandName = "Sketcher_ConstrainAngle", + .selectionStep = 2, + .hints = {{QObject::tr("%1 pick second edge"), {Gui::InputHint::UserInput::MouseLeft}}}}, // Symmetry {.commandName = "Sketcher_ConstrainSymmetric",