From: azv Date: Wed, 23 Oct 2019 07:05:10 +0000 (+0300) Subject: Improve movement of the dimension when value is 0. X-Git-Tag: V9_5_0a1~166^2~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7a44c50f5a600e8b571ca484b89e753473b35c29;p=modules%2Fshaper.git Improve movement of the dimension when value is 0. --- 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; } }