Skip to content

Commit

Permalink
Use shift+middle mouse as a universal drag-zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Mar 25, 2021
1 parent c7f37d9 commit 57e5737
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 57e5737

Please sign in to comment.