diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index b11011972f..75d219057d 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -1144,16 +1144,45 @@ void DrawSketchHandler::drawPositionAtCursor(const Base::Vector2d& position) void DrawSketchHandler::drawDirectionAtCursor(const Base::Vector2d& position, const Base::Vector2d& origin) { + if (!showCursorCoords()) { + return; + } + float length = (position - origin).Length(); float angle = (position - origin).GetAngle(Base::Vector2d(1.f, 0.f)); - if (showCursorCoords()) { - SbString text; - std::string lengthString = lengthToDisplayFormat(length, 1); - std::string angleString = angleToDisplayFormat(angle * 180.0 / M_PI, 1); - text.sprintf(" (%s, %s)", lengthString.c_str(), angleString.c_str()); - setPositionText(position, text); + SbString text; + std::string lengthString = lengthToDisplayFormat(length, 1); + std::string angleString = angleToDisplayFormat(angle * 180.0 / M_PI, 1); + text.sprintf(" (%s, %s)", lengthString.c_str(), angleString.c_str()); + setPositionText(position, text); +} + +void DrawSketchHandler::drawWidthHeightAtCursor(const Base::Vector2d& position, + const double val1, + const double val2) +{ + if (!showCursorCoords()) { + return; } + + SbString text; + std::string val1String = lengthToDisplayFormat(val1, 1); + std::string val2String = lengthToDisplayFormat(val2, 1); + text.sprintf(" (%s x %s)", val1String.c_str(), val2String.c_str()); + setPositionText(position, text); +} + +void DrawSketchHandler::drawDoubleAtCursor(const Base::Vector2d& position, const double val) +{ + if (!showCursorCoords()) { + return; + } + + SbString text; + std::string doubleString = lengthToDisplayFormat(val, 1); + text.sprintf(" (%s)", doubleString.c_str()); + setPositionText(position, text); } std::unique_ptr DrawSketchHandler::createToolWidget() const diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index f17eea8b48..e16ef0b952 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -282,6 +282,9 @@ protected: void drawPositionAtCursor(const Base::Vector2d& position); void drawDirectionAtCursor(const Base::Vector2d& position, const Base::Vector2d& origin); + void + drawWidthHeightAtCursor(const Base::Vector2d& position, const double val1, const double val2); + void drawDoubleAtCursor(const Base::Vector2d& position, const double radius); int getPreselectPoint() const; int getPreselectCurve() const;