From: mpv Date: Fri, 6 Nov 2015 06:47:03 +0000 (+0300) Subject: Make the coordinate of arc edited in the property panel unchanged in edit mode X-Git-Tag: V_2.0.0_alfa1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cf866db36039478775ba35c875e56d532afcef19;p=modules%2Fshaper.git Make the coordinate of arc edited in the property panel unchanged in edit mode --- diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 22898f95e..07e9b1a78 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -272,33 +272,33 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt())); std::shared_ptr aProjection = aCircleForArc->project(anEndAttr->pnt()); if (aProjection && anEndAttr->pnt()->distance(aProjection) > tolerance) { - // issue #855: trying to update only not-updated coordinate if it is possible - /* - if (abs(myXEndBefore - anEndAttr->x()) < 1.e-10) { // keep Y unchanged - double aVy = aCenterAttr->y() - anEndAttr->y(); - double aVy2 = aVy * aVy; - double aR2 = aCircleForArc->radius() * aCircleForArc->radius(); - if (aVy2 <= aR2) { - double aDX = sqrt(aR2 - aVy * aVy); - if (anEndAttr->x() > aCenterAttr->x()) - aProjection->setX(aCenterAttr->x() + aDX); - else - aProjection->setX(aCenterAttr->x() - aDX); - aProjection->setY(anEndAttr->y()); - } - } else if (abs(myYEndBefore - anEndAttr->y()) < 1.e-10) { // keep X unchanged - double aVx = aCenterAttr->x() - anEndAttr->x(); - double aVx2 = aVx * aVx; - double aR2 = aCircleForArc->radius() * aCircleForArc->radius(); - if (aVx2 <= aR2) { - double aDY = sqrt(aR2 - aVx * aVx); - if (anEndAttr->y() > aCenterAttr->y()) - aProjection->setY(aCenterAttr->y() + aDY); - else - aProjection->setY(aCenterAttr->y() - aDY); - aProjection->setX(anEndAttr->x()); + if (!isStable()) { // issue #855: trying to update only not-updated coordinate if it is possible + if (abs(myXEndBefore - anEndAttr->x()) < 1.e-10) { // keep Y unchanged + double aVy = aCenterAttr->y() - anEndAttr->y(); + double aVy2 = aVy * aVy; + double aR2 = aCircleForArc->radius() * aCircleForArc->radius(); + if (aVy2 <= aR2) { + double aDX = sqrt(aR2 - aVy * aVy); + if (anEndAttr->x() > aCenterAttr->x()) + aProjection->setX(aCenterAttr->x() + aDX); + else + aProjection->setX(aCenterAttr->x() - aDX); + aProjection->setY(anEndAttr->y()); + } + } else if (abs(myYEndBefore - anEndAttr->y()) < 1.e-10) { // keep X unchanged + double aVx = aCenterAttr->x() - anEndAttr->x(); + double aVx2 = aVx * aVx; + double aR2 = aCircleForArc->radius() * aCircleForArc->radius(); + if (aVx2 <= aR2) { + double aDY = sqrt(aR2 - aVx * aVx); + if (anEndAttr->y() > aCenterAttr->y()) + aProjection->setY(aCenterAttr->y() + aDY); + else + aProjection->setY(aCenterAttr->y() - aDY); + aProjection->setX(anEndAttr->x()); + } } - }*/ + } anEndAttr->setValue(aProjection); }