diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 85d75b0bd..e7e0f0170 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -477,6 +477,12 @@ void VToolSpline::SetVisualization() */ void VToolSpline::RefreshGeometry() { + // Very important to disable control points. Without it the pogram can't move the curve. + foreach (VControlPointSpline *point, controlPoints) + { + point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); + } + this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); if (isHovered || detailsMode) @@ -506,4 +512,31 @@ void VToolSpline::RefreshGeometry() controlPoints[1]->blockSignals(false); SetVisualization(); + + // Each time we move something we call recalculation scene rect. In some cases this can cause moving + // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. + static bool changeFinished = true; + if (changeFinished) + { + changeFinished = false; + + const QList viewList = scene()->views(); + if (not viewList.isEmpty()) + { + if (QGraphicsView *view = viewList.at(0)) + { + VMainGraphicsScene *currentScene = qobject_cast(scene()); + SCASSERT(currentScene); + const QPointF cursorPosition = currentScene->getScenePos(); + view->ensureVisible(QRectF(cursorPosition.x()-50, cursorPosition.y()-50, 100, 100)); + } + } + + changeFinished = true; + } + + foreach (VControlPointSpline *point, controlPoints) + { + point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + } } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 6d1ba2bac..dc67d767f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -549,6 +549,12 @@ void VToolSplinePath::SetVisualization() */ void VToolSplinePath::RefreshGeometry() { + // Very important to disable control points. Without it the pogram can't move the curve. + foreach (VControlPointSpline *point, controlPoints) + { + point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); + } + if (isHovered || detailsMode) { this->setPath(ToolPath(PathDirection::Show)); @@ -583,4 +589,31 @@ void VToolSplinePath::RefreshGeometry() } SetVisualization(); + + // Each time we move something we call recalculation scene rect. In some cases this can cause moving + // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. + static bool changeFinished = true; + if (changeFinished) + { + changeFinished = false; + + const QList viewList = scene()->views(); + if (not viewList.isEmpty()) + { + if (QGraphicsView *view = viewList.at(0)) + { + VMainGraphicsScene *currentScene = qobject_cast(scene()); + SCASSERT(currentScene); + const QPointF cursorPosition = currentScene->getScenePos(); + view->ensureVisible(QRectF(cursorPosition.x()-50, cursorPosition.y()-50, 100, 100)); + } + } + + changeFinished = true; + } + + foreach (VControlPointSpline *point, controlPoints) + { + point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + } }