From 8f2bc2c11b8550d007b7da704d38fa5b0ca0ae77 Mon Sep 17 00:00:00 2001 From: mourner Date: Thu, 31 Mar 2011 22:59:46 +0300 Subject: [PATCH 1/2] fix removal of useful code by closure compiler --- src/map/ext/Map.ZoomAnimation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/ext/Map.ZoomAnimation.js b/src/map/ext/Map.ZoomAnimation.js index d0c27226..0c17cc5a 100644 --- a/src/map/ext/Map.ZoomAnimation.js +++ b/src/map/ext/Map.ZoomAnimation.js @@ -37,7 +37,7 @@ L.Map.include(!(L.Transition && L.Transition.implemented()) ? {} : { this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY] = startTransform; - this._tileBg.offsetWidth; //hack to make sure transform is updated before running animation + L.Util.falseFn(this._tileBg.offsetWidth); //hack to make sure transform is updated before running animation var options = {}; options[L.DomUtil.TRANSFORM_PROPERTY] = startTransform + ' ' + L.DomUtil.getScaleString(scale, origin); From 443371379e2b2ff1c5a2a199933e89284aa79d9e Mon Sep 17 00:00:00 2001 From: mourner Date: Thu, 31 Mar 2011 22:59:59 +0300 Subject: [PATCH 2/2] update build --- dist/leaflet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/leaflet.js b/dist/leaflet.js index 5015a58e..6e56a1f8 100644 --- a/dist/leaflet.js +++ b/dist/leaflet.js @@ -80,6 +80,6 @@ _initEvents:function(){L.DomEvent.addListener(this._container,"click",this._onMo _getNewTopLeftPoint:function(a){var b=this.getSize().divideBy(2,!0);return this.project(a).subtract(b).round()},_limitZoom:function(a){var b=this.getMinZoom(),c=this.getMaxZoom();return Math.max(b,Math.min(c,a))}});L.Map.include({locate:function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(L.Util.bind(this._handleGeolocationResponse,this),L.Util.bind(this._handleGeolocationError,this));return this},_handleGeolocationError:function(a){this.fire("locationerror",{message:a.message})},_handleGeolocationResponse:function(a){var b=180*a.coords.accuracy/4E7,c=b*2,d=a.coords.latitude,e=a.coords.longitude,f=new L.LatLng(d-b,e-c);b=new L.LatLng(d+b,e+c);f=new L.LatLngBounds(f,b);this.fitBounds(f); this.fire("locationfound",{latlng:new L.LatLng(d,e),bounds:f,accuracy:a.coords.accuracy})}});L.Map.include({openPopup:function(a){this.closePopup();this._popup=a;this.addLayer(a)},closePopup:function(){this._popup&&this.removeLayer(this._popup)}});L.Map.include(!L.Transition||!L.Transition.implemented()?{}:{setView:function(a,b,c){b=this._limitZoom(b);var d=this._zoom!=b;if(this._loaded&&!c&&this._layers&&(c=this._getNewTopLeftPoint(a).subtract(this._getTopLeftPoint()),d&&this._zoomToIfCenterInView?this._zoomToIfCenterInView(a,b,c):this._panByIfClose(c)))return this;this._resetView(a,b);return this},panBy:function(a){if(!this._panTransition)this._panTransition=new L.Transition(this._mapPane,{duration:0.3}),this._panTransition.on("step",this._onPanTransitionStep, this),this._panTransition.on("end",this._onPanTransitionEnd,this);this.fire(this,"movestart");this._panTransition.run({position:L.DomUtil.getPosition(this._mapPane).subtract(a)});return this},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){this.fire("moveend")},_panByIfClose:function(a){if(this._offsetIsWithinView(a))return this.panBy(a),!0;return!1},_offsetIsWithinView:function(a,b){var c=b||1,d=this.getSize();return Math.abs(a.x)<=d.x*c&&Math.abs(a.y)<=d.y*c}});L.Map.include(!L.Transition||!L.Transition.implemented()?{}:{_zoomToIfCenterInView:function(a,b,c){if(this._animatingZoom)return!0;if(!L.Transition.NATIVE)return!1;var d=Math.pow(2,b-this._zoom),e=c.divideBy(1-1/d);if(!this._offsetIsWithinView(e,1))return!1;this._prepareTileBg();this._mapPane.className+=" leaflet-animating";c=L.DomUtil.getPosition(this._mapPane);e=this.containerPointToLayerPoint(this.getSize().divideBy(2)).add(e);c=L.DomUtil.getTranslateString(c);this._runAnimation(a,b,d,c,e);return!0}, -_runAnimation:function(a,b,c,d,e){this._animatingZoom=!0;this._resetView(a,b);this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY]=d;a={};a[L.DomUtil.TRANSFORM_PROPERTY]=d+" "+L.DomUtil.getScaleString(c,e);this._tileBg.transition.run(a)},_prepareTileBg:function(){if(!this._tileBg)this._tileBg=this._createPane("leaflet-tile-pane",this._mapPane),this._tileBg.style.zIndex=1;var a=this._tilePane,b=this._tileBg;b.innerHTML="";b.style[L.DomUtil.TRANSFORM_PROPERTY]="";b.style.visibility="hidden";b.empty=!0; -a.empty=!1;this._tilePane=this._panes.tilePane=b;this._tileBg=a;if(!this._tileBg.transition)this._tileBg.transition=new L.Transition(this._tileBg,{duration:0.25,easing:"cubic-bezier(0.25,0.1,0.25,0.75)"}),this._tileBg.transition.on("end",this._onZoomTransitionEnd,this)},_onZoomTransitionEnd:function(){this._restoreTileFront();this._mapPane.className=this._mapPane.className.replace(" leaflet-animating","");this._animatingZoom=!1},_restoreTileFront:function(){this._tilePane.style.visibility="";this._tilePane.style.zIndex= -2;this._tileBg.style.zIndex=1}}); +_runAnimation:function(a,b,c,d,e){this._animatingZoom=!0;this._resetView(a,b);this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY]=d;L.Util.falseFn(this._tileBg.offsetWidth);a={};a[L.DomUtil.TRANSFORM_PROPERTY]=d+" "+L.DomUtil.getScaleString(c,e);this._tileBg.transition.run(a)},_prepareTileBg:function(){if(!this._tileBg)this._tileBg=this._createPane("leaflet-tile-pane",this._mapPane),this._tileBg.style.zIndex=1;var a=this._tilePane,b=this._tileBg;b.innerHTML="";b.style[L.DomUtil.TRANSFORM_PROPERTY]=""; +b.style.visibility="hidden";b.empty=!0;a.empty=!1;this._tilePane=this._panes.tilePane=b;this._tileBg=a;if(!this._tileBg.transition)this._tileBg.transition=new L.Transition(this._tileBg,{duration:0.25,easing:"cubic-bezier(0.25,0.1,0.25,0.75)"}),this._tileBg.transition.on("end",this._onZoomTransitionEnd,this)},_onZoomTransitionEnd:function(){this._restoreTileFront();this._mapPane.className=this._mapPane.className.replace(" leaflet-animating","");this._animatingZoom=!1},_restoreTileFront:function(){this._tilePane.style.visibility= +"";this._tilePane.style.zIndex=2;this._tileBg.style.zIndex=1}});