Make zooming straight in at the bottom level do nothing rather than moving half a pixel across with odd sized windows (which makes the whole screen look blurry in chrome). We need floor rather than round otherwise we move 1px in each direction.

This commit is contained in:
danzel 2012-07-26 13:58:44 +12:00
parent 19ed1859bd
commit 8667f357f2
2 changed files with 11 additions and 1 deletions

View File

@ -57,6 +57,16 @@ L.Point.prototype = {
return this;
},
floor: function () {
return this.clone()._floor();
},
_floor: function () {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
return this;
},
clone: function () {
return new L.Point(this.x, this.y);
},

View File

@ -62,7 +62,7 @@ L.Map.include(!(L.Transition && L.Transition.implemented()) ? {} : {
_panByIfClose: function (center) {
// difference between the new and current centers in pixels
var offset = this._getCenterOffset(center);
var offset = this._getCenterOffset(center)._floor();
if (this._offsetIsWithinView(offset)) {
this.panBy(offset);