Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make zoomToLayer, zoomFull and zoomSelected all adds the same five pe…
…rcent margin around the extent. Fixes #932.

git-svn-id: http://svn.osgeo.org/qgis/trunk@8099 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Feb 2, 2008
1 parent 9b7ec28 commit bc200fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -493,7 +493,11 @@ void QgsMapCanvas::zoomFullExtent()
QgsRect extent = fullExtent();
// If the full extent is an empty set, don't do the zoom
if (!extent.isEmpty())
{
// Add a 5% margin around the full extent
extent.scale(1.05);
setExtent(extent);
}
refresh();

} // zoomFullExtent
Expand Down Expand Up @@ -561,7 +565,8 @@ void QgsMapCanvas::zoomToSelected()
{
// Expand rect to give a bit of space around the selected
// objects so as to keep them clear of the map boundaries
rect.scale(1.1);
// The same 5% should apply to all margins.
rect.scale(1.05);
setExtent(rect);
refresh();
return;
Expand Down

0 comments on commit bc200fe

Please sign in to comment.