Skip to content

Commit

Permalink
Remove android 2/3 hacks for TileLayer animation (we'll only support …
Browse files Browse the repository at this point in the history
…it for 4+)
  • Loading branch information
mourner committed Aug 2, 2012
1 parent cfc5528 commit 96b759c
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/map/anim/Map.ZoomAnimation.js
Expand Up @@ -7,6 +7,7 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
_zoomToIfClose: function (center, zoom) {

if (this._animatingZoom) { return true; }

if (!this.options.zoomAnimation) { return false; }

var scale = this.getZoomScale(zoom),
Expand Down Expand Up @@ -52,18 +53,7 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
tileBg.style[transform] += ' translate(0,0)';
}

var scaleStr;

// Android 2.* doesn't like translate/scale chains, transformOrigin + scale works better but
// it breaks touch zoom which Anroid doesn't support anyway, so that's a really ugly hack

// TODO work around this prettier
if (L.Browser.android23) {
tileBg.style[transform + 'Origin'] = origin.x + 'px ' + origin.y + 'px';
scaleStr = 'scale(' + scale + ')';
} else {
scaleStr = L.DomUtil.getScaleString(scale, origin);
}
var scaleStr = L.DomUtil.getScaleString(scale, origin);

L.Util.falseFn(tileBg.offsetWidth); //hack to make sure transform is updated before running animation

Expand All @@ -82,8 +72,7 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
tileBg = this._tileBg;

// If foreground layer doesn't have many tiles but bg layer does, keep the existing bg layer and just zoom it some more
// (disable this for Android due to it not supporting double translate)
if (!L.Browser.android23 && tileBg &&
if (tileBg &&
this._getLoadedTilesPercentage(tileBg) > 0.5 &&
this._getLoadedTilesPercentage(tilePane) < 0.5) {

Expand Down

0 comments on commit 96b759c

Please sign in to comment.