fix: always rotate according to current viewport state
This commit is contained in:
@ -133,6 +133,19 @@ void GraphicsView::zoomView(qreal scaleFactor)
|
||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
||||
}
|
||||
|
||||
// This is always according to user's view.
|
||||
// the direction of the rotation will NOT be clockwise because the y-axis points downwards.
|
||||
void GraphicsView::rotateView(bool clockwise)
|
||||
{
|
||||
resetScale();
|
||||
|
||||
QTransform tf(0, clockwise ? 1 : -1, 0,
|
||||
clockwise ? -1 : 1, 0, 0,
|
||||
0, 0, 1);
|
||||
tf = transform() * tf;
|
||||
setTransform(tf);
|
||||
}
|
||||
|
||||
void GraphicsView::flipView(bool horizontal)
|
||||
{
|
||||
QTransform tf(horizontal ? -1 : 1, 0, 0,
|
||||
@ -151,12 +164,6 @@ void GraphicsView::resetScale()
|
||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
||||
}
|
||||
|
||||
void GraphicsView::rotateView(qreal rotateAngel)
|
||||
{
|
||||
resetScale();
|
||||
rotate(rotateAngel);
|
||||
}
|
||||
|
||||
void GraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode)
|
||||
{
|
||||
QGraphicsView::fitInView(rect, aspectRadioMode);
|
||||
|
Reference in New Issue
Block a user