From 02adc3a1b18c283f13a2c9bf51f84aea7a5826ff Mon Sep 17 00:00:00 2001 From: danzel Date: Tue, 17 Jul 2012 14:07:52 +1200 Subject: [PATCH] Add zoomToBounds to MarkerCluster. Fixes #6 --- src/MarkerCluster.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index b79e7390b..627933dac 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -29,6 +29,11 @@ L.MarkerCluster = L.Marker.extend({ return storageArray; }, + //Zoom to the extents of this cluster + zoomToBounds: function () { + this._group._map.fitBounds(this._bounds); + }, + _baseInit: function () { L.Marker.prototype.initialize.call(this, this._latlng, { icon: this._group.options.iconCreateFunction(this._childCount) }); },