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
This commit is contained in:
George Peden
2025-09-07 12:31:14 -10:00
committed by Chris Hennes
parent 27af7fda04
commit 700afdb07f

View File

@@ -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",