Skip to content
Permalink
Browse files

Use shift+middle mouse as a universal drag-zoom

  • Loading branch information
uclaros authored and nyalldawson committed Mar 25, 2021
1 parent c7f37d9 commit 57e57374098ca212f20f97fd7b1bd2c1ac3cd5c7
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/gui/qgsmapcanvas.cpp
@@ -1885,8 +1885,15 @@ void QgsMapCanvas::endZoomRect( QPoint pos )

void QgsMapCanvas::mousePressEvent( QMouseEvent *e )
{
// use shift+middle mouse button for zooming, map tools won't receive any events in that case
if ( e->button() == Qt::MiddleButton &&
e->modifiers() & Qt::ShiftModifier )
{
beginZoomRect( e->pos() );
return;
}
//use middle mouse button for panning, map tools won't receive any events in that case
if ( e->button() == Qt::MiddleButton )
else if ( e->button() == Qt::MiddleButton )
{
mCanvasProperties->panSelectorDown = true;
panActionStart( mCanvasProperties->mouseLastXY );
@@ -1927,8 +1934,15 @@ void QgsMapCanvas::mousePressEvent( QMouseEvent *e )

void QgsMapCanvas::mouseReleaseEvent( QMouseEvent *e )
{
// if using shift+middle mouse button for zooming, end zooming and return
if ( mZoomDragging &&
e->button() == Qt::MiddleButton )
{
endZoomRect( e->pos() );
return;
}
//use middle mouse button for panning, map tools won't receive any events in that case
if ( e->button() == Qt::MiddleButton )
else if ( e->button() == Qt::MiddleButton )
{
mCanvasProperties->panSelectorDown = false;
panActionEnd( mCanvasProperties->mouseLastXY );

0 comments on commit 57e5737

Please sign in to comment.