diff --git a/debug/vector/vector-bounds.html b/debug/vector/vector-bounds.html new file mode 100644 index 000000000..a9886d7da --- /dev/null +++ b/debug/vector/vector-bounds.html @@ -0,0 +1,69 @@ + + + + Leaflet debug page + + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/src/layer/vector/Path.js b/src/layer/vector/Path.js index ad1394e00..b5cadefa9 100644 --- a/src/layer/vector/Path.js +++ b/src/layer/vector/Path.js @@ -61,6 +61,15 @@ L.Path = L.Class.extend({ this._updateStyle(); } return this; + }, + + getBounds: function() { + var b = new L.LatLngBounds(); + var latLngs = this.getLatLngs(); + for (var i = 0, len = latLngs.length; i < len; i++) { + b.extend(latLngs[i]); + } + return b; }, _initElements: function() {