Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
can re-center when scaling mapCanvas extent
- Loading branch information
Showing
with
6 additions
and
4 deletions.
-
+2
−1
python/gui/qgsmapcanvas.sip
-
+2
−2
src/gui/qgsmapcanvas.cpp
-
+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 ); |
|
|