Skip to content

Commit

Permalink
fix maxBounds infinite loop, close #1538
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Sep 24, 2015
1 parent 44f6519 commit 1be67c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/geo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Transform.prototype = {
get zoom() { return this._zoom; },
set zoom(zoom) {
zoom = Math.min(Math.max(zoom, this.minZoom), this.maxZoom);
if (this._zoom === zoom) return;
this._zoom = zoom;
this.scale = this.zoomScale(zoom);
this.tileZoom = Math.floor(zoom);
Expand Down Expand Up @@ -290,7 +291,7 @@ Transform.prototype = {
},

_constrain: function() {
if (!this.center) return;
if (!this.center || !this.width || !this.height) return;

var minY, maxY, minX, maxX, sy, sx, x2, y2,
size = this.size;
Expand Down

0 comments on commit 1be67c8

Please sign in to comment.