From 7a44c50f5a600e8b571ca484b89e753473b35c29 Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 23 Oct 2019 10:05:10 +0300 Subject: [PATCH] Improve movement of the dimension when value is 0. --- .../SketchPlugin_ConstraintDistance.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 47399b416..dfc755648 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -246,16 +246,16 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) } else return; - if (aEndPnt->distance(aStartPnt) < tolerance) - return; - myFlyoutUpdate = true; - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); - - double X = aFlyoutDir->dot(aLineDir->xy()); - double Y = -aFlyoutDir->cross(aLineDir->xy()); - aFlyoutAttr->setValue(X, Y); + if (aEndPnt->distance(aStartPnt) >= tolerance) { + std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); + double X = aFlyoutDir->dot(aLineDir->xy()); + double Y = -aFlyoutDir->cross(aLineDir->xy()); + aFlyoutAttr->setValue(X, Y); + } + else + aFlyoutAttr->setValue(aFlyoutDir->x(), aFlyoutDir->y()); myFlyoutUpdate = false; } } -- 2.39.2