//================================================================
void GraphicsView_ViewFrame::onViewGlobalPan()
{
-// myViewer->activateTransform( GraphicsView_Viewer::PanGlobal );
+ myViewer->globalPan();
}
//================================================================
//================================================================
void GraphicsView_ViewFrame::onViewReset()
{
-// myViewer->activateTransform( GraphicsView_Viewer::Reset );
}
//================================================================
previousPos = QPoint();
panning = false;
+ globalPanning = false;
SUIT_ResourceMgr* rmgr = SUIT_Session::session()->resourceMgr();
zoomCursor = new QCursor( rmgr->loadPixmap( "GraphicsView", tr( "ICON_GV_CURSOR_ZOOM" ) ) );
void GraphicsView_ViewPort::mousePressEvent(QMouseEvent *event)
{
- if (!zooming && !panning && items(event->pos()).count()==0 && (event->buttons() & Qt::LeftButton))
+ if (!zooming && !panning && !globalPanning && items(event->pos()).count()==0 && (event->buttons() & Qt::LeftButton))
{
startDrawingRect(event->pos().x(), event->pos().y());
}
-
+
+ if (globalPanning)
+ {
+ QPoint p0 = viewport()->rect().center();
+ QPoint p1 = event->pos();
+ double deltaX = p0.x() - p1.x();
+ double deltaY = p0.y() - p1.y();
+
+ pan(deltaX, -deltaY);
+ }
QGraphicsView::mousePressEvent(event);
emit vpMouseEvent(event);
}
fittingArea = false;
zooming = false;
panning = false;
+ globalPanning = false;
previousPos = QPoint();
}
zooming = true;
fittingArea = false;
panning = false;
+ globalPanning = false;
setCursor(*zoomCursor);
}
fittingArea = true;
zooming = false;
panning = false;
+ globalPanning = false;
setCursor(Qt::PointingHandCursor);
}
panning = true;
fittingArea = false;
zooming = false;
+ globalPanning = false;
setCursor(Qt::SizeAllCursor);
}
+void GraphicsView_ViewPort::activateGlobalPanAction()
+{
+ globalPanning = true;
+ panning = false;
+ fittingArea = false;
+ zooming = false;
+ setCursor(Qt::CrossCursor);
+}
+
void GraphicsView_ViewPort::pan( double theDX, double theDY )
{
if( QScrollBar* aHBar = horizontalScrollBar() )
void activateZoomAction();
void activateFitAreaAction();
void activatePanAction();
+ void activateGlobalPanAction();
void pan( double theDX, double theDY );
bool fittingArea;
bool zooming;
bool panning;
+ bool globalPanning;
QPoint previousPos;
QCursor* zoomCursor;
};
if (GraphicsView_ViewPort* aViewPort = getActiveViewPort())
aViewPort->activatePanAction();
}
+
+void GraphicsView_Viewer::globalPan()
+{
+ if (GraphicsView_ViewPort* aViewPort = getActiveViewPort())
+ {
+ aViewPort->fitAll();
+ aViewPort->activateGlobalPanAction();
+ }
+}