From 03ea7fd4c68052390faed4da95ab3e5aaa753893 Mon Sep 17 00:00:00 2001 From: George Peden Date: Mon, 8 Sep 2025 17:16:17 -1000 Subject: [PATCH] Fix Sketcher Dimension hints - add context-aware hints based on selection - Add PICK_POINT_OR_EDGE constant to DrawSketchHandlerDimension class - Implement nuanced hints for Dimension tool based on selected geometry: - Empty selection: 'pick point or edge' - Single point/line/circle: 'pick second point or edge' - Multiple selections: 'pick second point or edge' - Remove stray character causing build error - Addresses feedback on issue #22282 for comprehensive Sketcher hints coverage --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 6ebee50cb3..071c0f4890 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1732,6 +1732,7 @@ class DrawSketchHandlerDimension : public DrawSketchHandler public: // Helper constants for hint texts static constexpr const char* PICK_EDGE = "%1 pick edge"; + static constexpr const char* PICK_POINT_OR_EDGE = "%1 pick point or edge"; static constexpr const char* PICK_SECOND_POINT_OR_EDGE = "%1 pick second point or edge"; static constexpr const char* PLACE_DIMENSION = "%1 place dimension"; explicit DrawSketchHandlerDimension(std::vector SubNames) @@ -1983,11 +1984,20 @@ public: std::list getToolHints() const override { if (selectionEmpty()) { - return {{QObject::tr(PICK_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; - } else if (selPoints.size() == 1 && selLine.empty() && selCircleArc.empty()) { + return {{QObject::tr(PICK_POINT_OR_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (selPoints.size() == 1 && selLine.empty() && selCircleArc.empty() && selEllipseAndCo.empty() && selSplineAndCo.empty()) { + // Single point - can add more points, lines, circles, etc. + return {{QObject::tr(PICK_SECOND_POINT_OR_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (selLine.size() == 1 && selPoints.empty() && selCircleArc.empty() && selEllipseAndCo.empty() && selSplineAndCo.empty()) { + // Single line - can add more points, lines, circles, etc. + return {{QObject::tr(PICK_SECOND_POINT_OR_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; + } else if (selCircleArc.size() == 1 && selPoints.empty() && selLine.empty() && selEllipseAndCo.empty() && selSplineAndCo.empty()) { + // Single circle/arc - can add more points, lines, circles, etc. return {{QObject::tr(PICK_SECOND_POINT_OR_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; } else { - return {{QObject::tr(PLACE_DIMENSION), {Gui::InputHint::UserInput::MouseLeft}}}; + // Multiple selections or complex combinations - check if more selections are possible + // For now, assume more selections are possible unless we have a complete constraint + return {{QObject::tr(PICK_SECOND_POINT_OR_EDGE), {Gui::InputHint::UserInput::MouseLeft}}}; } }