Skip to content
Permalink
Browse files

can re-center when scaling mapCanvas extent

  • Loading branch information
3nids committed Jul 25, 2014
1 parent 6f23cb6 commit a9289b6a9021a60ba78d383eccdd32e33985da9f
Showing with 6 additions and 4 deletions.
  1. +2 −1 python/gui/qgsmapcanvas.sip
  2. +2 −2 src/gui/qgsmapcanvas.cpp
  3. +2 −1 src/gui/qgsmapcanvas.h
@@ -238,7 +238,8 @@ class QgsMapCanvas : QGraphicsView
void zoomScale( double scale );

//! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in
void zoomByFactor( double scaleFactor );
//! If point is given, re-center on it
void zoomByFactor( double scaleFactor, const QgsPoint *center = 0 );

//! Zooms in/out with a given center
void zoomWithCenter( int x, int y, bool zoomIn );
@@ -1815,10 +1815,10 @@ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString&
}
}

void QgsMapCanvas::zoomByFactor( double scaleFactor )
void QgsMapCanvas::zoomByFactor( double scaleFactor , const QgsPoint* center )
{
QgsRectangle r = mapSettings().visibleExtent();
r.scale( scaleFactor );
r.scale( scaleFactor, center );
setExtent( r );
refresh();
}
@@ -307,7 +307,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void zoomScale( double scale );

//! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in
void zoomByFactor( double scaleFactor );
//! If point is given, re-center on it
void zoomByFactor( double scaleFactor, const QgsPoint *center = 0 );

//! Zooms in/out with a given center
void zoomWithCenter( int x, int y, bool zoomIn );

0 comments on commit a9289b6

Please sign in to comment.
You can’t perform that action at this time.