diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 8900e3b83..42a257796 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -127,19 +127,6 @@ void VToolBasePoint::AddToFile() QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange && scene()) - { - // value - this is new position. - QPointF newPos = value.toPointF(); - QRectF rect = scene()->sceneRect(); - if (rect.contains(newPos) == false) - { - // Save element into rect of scene. - newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left()))); - newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top()))); - return newPos; - } - } - if (change == ItemPositionHasChanged && scene()) { // 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. @@ -153,17 +140,14 @@ QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, co MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene()); connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSP); - if (scene()) + if (QGraphicsView *view = scene()->views().at(0)) { - if (QGraphicsView *view = scene()->views().at(0)) - { - view->ensureVisible(this); - } + view->ensureVisible(this); } changeFinished = true; } } - return QGraphicsItem::itemChange(change, value); + return VToolSinglePoint::itemChange(change, value); } //---------------------------------------------------------------------------------------------------------------------