CloudMade/Leaflet — pull request #492 by jacobtoye (2012-02-15 22:55:39+00:00)
Title: Ability to pad a LatLngBounds by a %

Updated ````LatLngBounds```` to provide the functionality to extend the bounds by a %.

**Use case**
When a group of markers are displayed on the map sometimes they touch the edge of the window. This can mean that part of the marker is not visible. This could be true for other items that are displayed on the map.

The way I am using it is I have an array of markers that has a ````LatLngBounds```` to represent the bounds of those markers. When the map is loaded I want to show all markers in the map viewport (without any right on the edge).

To test you can add the following code to the map.html debug file (I didn't think a minor function would deserve a new debug file so didn't commit it).

````Pad bounds by 5%````

````
function padBounds () {
map.fitBounds(map.getBounds().padBounds(0.05));
}
L.DomUtil.get('padbounds').onclick = padBounds;
````