Skip to content

Commit

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

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8099 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Feb 2, 2008
1 parent 68723cb commit 5fcec96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
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 5fcec96

Please sign in to comment.