Skip to content

Commit bc200fe

Browse files
author
homann
committedFeb 2, 2008
Make zoomToLayer, zoomFull and zoomSelected all adds the same five percent margin around the extent. Fixes #932.
git-svn-id: http://svn.osgeo.org/qgis/trunk@8099 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9b7ec28 commit bc200fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,11 @@ void QgsMapCanvas::zoomFullExtent()
493493
QgsRect extent = fullExtent();
494494
// If the full extent is an empty set, don't do the zoom
495495
if (!extent.isEmpty())
496+
{
497+
// Add a 5% margin around the full extent
498+
extent.scale(1.05);
496499
setExtent(extent);
500+
}
497501
refresh();
498502

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

0 commit comments

Comments
 (0)