Make fictive scene bigger in all cases.
--HG-- branch : develop
This commit is contained in:
parent
019b3dc38b
commit
6d566c2715
|
@ -194,25 +194,22 @@ void GraphicsViewZoom::FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view)
|
||||||
const QPointF b = view->mapToScene(view->viewport()->width(), view->viewport()->height());
|
const QPointF b = view->mapToScene(view->viewport()->width(), view->viewport()->height());
|
||||||
QRectF viewRect = QRectF( a, b );
|
QRectF viewRect = QRectF( a, b );
|
||||||
|
|
||||||
|
//Scale view
|
||||||
|
QLineF topLeftRay(viewRect.center(), viewRect.topLeft());
|
||||||
|
topLeftRay.setLength(topLeftRay.length()*2);
|
||||||
|
|
||||||
|
QLineF bottomRightRay(viewRect.center(), viewRect.bottomRight());
|
||||||
|
bottomRightRay.setLength(bottomRightRay.length()*2);
|
||||||
|
|
||||||
|
viewRect = QRectF(topLeftRay.p2(), bottomRightRay.p2());
|
||||||
|
|
||||||
//Calculate scene rect
|
//Calculate scene rect
|
||||||
const QRectF sceneRect = sc->sceneRect();
|
const QRectF sceneRect = sc->sceneRect();
|
||||||
|
|
||||||
if (not sceneRect.contains(viewRect))
|
//Unite two rects
|
||||||
{//Scene less than view
|
const QRectF newRect = sceneRect.united(viewRect);
|
||||||
//Scale view
|
|
||||||
QLineF topLeftRay(viewRect.center(), viewRect.topLeft());
|
|
||||||
topLeftRay.setLength(topLeftRay.length()*2);
|
|
||||||
|
|
||||||
QLineF bottomRightRay(viewRect.center(), viewRect.bottomRight());
|
sc->setSceneRect(newRect);
|
||||||
bottomRightRay.setLength(bottomRightRay.length()*2);
|
|
||||||
|
|
||||||
viewRect = QRectF(topLeftRay.p2(), bottomRightRay.p2());
|
|
||||||
|
|
||||||
//Unite two rects
|
|
||||||
const QRectF newRect = sceneRect.united(viewRect);
|
|
||||||
|
|
||||||
sc->setSceneRect(newRect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user