Skip to content

Commit

Permalink
Merge branch 'Azimkhan-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Apr 17, 2015
2 parents e54a401 + 4625c0a commit dc81287
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion leaflet/static/leaflet/leaflet.forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ L.GeometryField = L.Class.extend({
_setView: function () {
// Change view extent
if (this.drawnItems.getLayers().length > 0) {
this._map.fitBounds(this.drawnItems.getBounds());
var bounds = this.drawnItems.getBounds();
// In case of points, fitBounds() fails.
// https://github.com/makinacorpus/django-leaflet/issues/90
if (!bounds._southWest.equals(bounds._northEast))
this._map.fitBounds(bounds);
else
this._map.setView(bounds._northEast, this.default_zoom);
}
// Else keep view extent set by django-leaflet template tag
},
Expand Down

0 comments on commit dc81287

Please sign in to comment.