From 018ed43fac184e1b0c8325d30c6200730a4bc798 Mon Sep 17 00:00:00 2001 From: George Peden Date: Sun, 7 Sep 2025 12:47:24 -1000 Subject: [PATCH] Add context-aware hints for remaining constraint tools - Add context-aware hints for ConstrainPerpendicular - Add context-aware hints for ConstrainTangent - Add context-aware hints for ConstrainSymmetric - All hints now remember user selections to provide appropriate guidance - Covers all workflows mentioned in issue #22282 feedback - Completes comprehensive coverage of missing constraint hints --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 1cb68b96f4..630f19189f 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1149,6 +1149,72 @@ public: } } + // Special case for Sketcher_ConstrainPerpendicular to generate context-aware hints + if (commandName == "Sketcher_ConstrainPerpendicular") { + 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 { + // Edge + Edge workflow + return {{QObject::tr("%1 pick second edge"), {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}}}; + } + } + } + + // Special case for Sketcher_ConstrainTangent to generate context-aware hints + if (commandName == "Sketcher_ConstrainTangent") { + 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 Edge + Edge or Edge + Point + Edge workflow + return {{QObject::tr("%1 pick second edge 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}}}; + } + } + } + + // Special case for Sketcher_ConstrainSymmetric to generate context-aware hints + if (commandName == "Sketcher_ConstrainSymmetric") { + 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 + Point or Point + Point + Edge/Point workflow + return {{QObject::tr("%1 pick edge or second point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } else { + // Edge + Point workflow + return {{QObject::tr("%1 pick symmetry point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } + } else if (selectionStep == 2 && !selSeq.empty()) { + if (isVertex(selSeq[0].GeoId, selSeq[0].PosId) && isVertex(selSeq[1].GeoId, selSeq[1].PosId)) { + // Point + Point + Edge/Point workflow + return {{QObject::tr("%1 pick symmetry line or point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (isVertex(selSeq[0].GeoId, selSeq[0].PosId) && !isVertex(selSeq[1].GeoId, selSeq[1].PosId)) { + // Point + Edge + Point workflow + return {{QObject::tr("%1 pick symmetry point"), {Gui::InputHint::UserInput::MouseLeft}}}; + } + } + } + // For everything else, use the static table return lookupConstraintHints(commandName, selectionStep); }