At last, zooming animation! HUGE commit!

This commit is contained in:
Mourner 2011-01-14 18:43:40 +02:00
parent d15dc94a0b
commit be09f97cf2
12 changed files with 165 additions and 95 deletions

View File

@ -27,17 +27,14 @@ Controls:
- basic zoom control
- zoom slider
Visual appearance:
- zooming animation
- show scaled background until tiles are loaded
Known issues to be fixed:
- touch zooming on Android is broken
- no IE6/7 support yet, some IE8 glitches
- touch zooming on Android is broken
- zoom animation breaks if you rapidly zoom multiple times
- show scaled background until tiles are loaded in browsers with no transition support
## Leaflet developers
Lead Developer: [Vladimir Agafonkin](http://github.com/mourner)
Lead Developer: [Vladimir Agafonkin](http://github.com/mourner)
Contributors: be the first!

View File

@ -17,7 +17,7 @@
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
latlng = new L.LatLng(50.5, 30.51);
var map = new L.Map('map').addLayer(cloudmade).setView(latlng, 15);
var map = new L.Map('map', {center: latlng, zoom: 15}).addLayer(cloudmade);
function createMarker(latlng) {
var marker = new L.Marker(latlng);

21
dist/leaflet.css vendored
View File

@ -9,6 +9,9 @@
.leaflet-container {
overflow: hidden;
}
.leaflet-tile-pane {
-webkit-transform: translate3d(0,0,0);
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
@ -19,7 +22,7 @@
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: visible;
visibility: inherit;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
@ -37,11 +40,17 @@
position: relative;
}
.leaflet-tile-pane { z-index: 1; }
.leaflet-overlay-pane { z-index: 2; }
.leaflet-shadow-pane { z-index: 3; }
.leaflet-marker-pane { z-index: 4; }
.leaflet-popup-pane { z-index: 5; }
.leaflet-tile-pane { z-index: 2; }
.leaflet-overlay-pane { z-index: 3; }
.leaflet-shadow-pane { z-index: 4; }
.leaflet-marker-pane { z-index: 5; }
.leaflet-popup-pane { z-index: 6; }
.leaflet-animating .leaflet-marker-pane,
.leaflet-animating .leaflet-shadow-pane,
.leaflet-animating .leaflet-popup-pane {
visibility: hidden;
}
/* Popup layout */

51
dist/leaflet.js vendored
View File

@ -9,29 +9,31 @@ L.Class.extend=function(a){function b(){!L.Class._prototyping&&this.initialize&&
function(e){L.Util.extend(this.prototype,e)};for(var d in this)if(this.hasOwnProperty(d)&&d!="prototype")b[d]=this[d];return b};L.Mixin={};
L.Mixin.Events={addEventListener:function(a,b,c){var d=this._leaflet_events=this._leaflet_events||{};d[a]=d[a]||[];d[a].push({action:b,context:c});return this},hasEventListeners:function(a){return"_leaflet_events"in this&&a in this._leaflet_events&&this._leaflet_events[a].length>0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d<f;d++)if(e[a][d].action===b&&(!c||e[a][d].context===c)){e[a].splice(d,1);break}return this},fireEvent:function(a,
b){if(this.hasEventListeners(a)){for(var c=L.Util.extend({type:a,target:this},b),d=this._leaflet_events[a].slice(),e=0,f=d.length;e<f;e++)d[e].action.call(d[e].context||this,c);return this}}};L.Mixin.Events.on=L.Mixin.Events.addEventListener;L.Mixin.Events.off=L.Mixin.Events.removeEventListener;L.Mixin.Events.fire=L.Mixin.Events.fireEvent;(function(){var a=navigator.userAgent.toLowerCase(),b=!!window.ActiveXObject,c=a.indexOf("webkit")!=-1,d=a.indexOf("mobile")!=-1;L.Browser={ie:b,ie6:b&&!window.XMLHttpRequest,webkit:c,webkit3d:c&&"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix,mobileWebkit:c&&d,gecko:a.indexOf("gecko")!=-1}})();L.Point=function(a,b,c){this.x=c?Math.round(a):a;this.y=c?Math.round(b):b};
L.Point.prototype={add:function(a){return new L.Point(this.x+a.x,this.y+a.y)},subtract:function(a){return new L.Point(this.x-a.x,this.y-a.y)},divideBy:function(a,b){return new L.Point(this.x/a,this.y/a,b)},multiplyBy:function(a){return new L.Point(this.x*a,this.y*a)},distanceTo:function(a){var b=a.x-this.x;a=a.y-this.y;return Math.sqrt(b*b+a*a)},round:function(){return new L.Point(Math.round(this.x),Math.round(this.y))},toString:function(){return"Point( "+this.x+", "+this.y+" )"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this.min&&!this.max){this.min=new L.Point(a.x,a.y);this.max=new L.Point(a.x,a.y)}else{this.min.x=Math.min(a.x,this.min.x);this.max.x=Math.max(a.x,this.max.x);this.min.y=Math.min(a.y,this.min.y);this.max.y=Math.max(a.y,this.max.y)}},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
L.Point.prototype={add:function(a){return new L.Point(this.x+a.x,this.y+a.y)},subtract:function(a){return new L.Point(this.x-a.x,this.y-a.y)},divideBy:function(a,b){return new L.Point(this.x/a,this.y/a,b)},multiplyBy:function(a){return new L.Point(this.x*a,this.y*a)},distanceTo:function(a){var b=a.x-this.x;a=a.y-this.y;return Math.sqrt(b*b+a*a)},round:function(){return new L.Point(Math.round(this.x),Math.round(this.y))},clone:function(){return new L.Point(this.x,this.y)},toString:function(){return"Point( "+
this.x+", "+this.y+" )"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this.min&&!this.max){this.min=new L.Point(a.x,a.y);this.max=new L.Point(a.x,a.y)}else{this.min.x=Math.min(a.x,this.min.x);this.max.x=Math.max(a.x,this.max.x);this.min.y=Math.min(a.y,this.min.y);this.max.y=Math.max(a.y,this.max.y)}},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
this.min.x&&a.max.x<=this.max.x&&a.min.y>=this.min.y&&a.max.y<=this.max.y}});L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a;this._b=b;this._c=c;this._d=d},transform:function(a,b){b=b||1;return new L.Point(b*(this._a*a.x+this._b),b*(this._c*a.y+this._d))},untransform:function(a,b){b=b||1;return new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}});L.DomEvent={addListener:function(a,b,c,d){function e(g){return c.call(d||a,g||L.DomEvent._getEvent())}var f=L.Util.stamp(c);a["_leaflet_"+b+f]=e;if("addEventListener"in a){b=="mousewheel"&&a.addEventListener("DOMMouseScroll",e,false);a.addEventListener(b,e,false)}else"attachEvent"in a&&a.attachEvent("on"+b,e)},removeListener:function(a,b,c){c=L.Util.stamp(c);c="_leaflet_"+b+c;handler=a[c];if("removeEventListener"in a){b=="mousewheel"&&a.removeEventListener("DOMMouseScroll",handler,false);a.removeEventListener(b,
handler,false)}else if("detachEvent"in a){a.detachEvent("on"+b,handler);delete a[c]}},_getEvent:function(){var a=window.event;if(!a)for(var b=arguments.callee.caller;b;){if((a=b.arguments[0])&&Event==a.constructor)break;b=b.caller}return a},stopPropagation:function(a){if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},disableClickPropagation:function(a){L.DomEvent.addListener(a,"mousedown",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"click",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,
"dblclick",L.DomEvent.stopPropagation)},preventDefault:function(a){if(a.preventDefault)a.preventDefault();else a.returnValue=false},getMousePosition:function(a,b){var c=new L.Point(a.pageX?a.pageX:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pageY?a.pageY:a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return b?c.subtract(L.DomUtil.getCumulativeOffset(b)):c},getWheelDelta:function(a){var b=0;if(a.wheelDelta)b=a.wheelDelta/120;if(a.detail)b=-a.detail/
3;return b}};L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];if(typeof c=="undefined"&&a.currentStyle)c=a.currentStyle[b];if(typeof c=="undefined")c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;return c=="auto"?null:c},getCumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop-a.scrollTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return new L.Point(c,b)},create:function(a,b,c){a=document.createElement(a);a.className=
b;c&&c.appendChild(a);return a},TRANSLATE_OPEN:"translate"+(L.Browser.webkit3d?"3d(":"("),TRANSLATE_CLOSE:L.Browser.webkit3d?",0)":")",getTranslateString:function(a){return L.DomUtil.TRANSLATE_OPEN+a.x+"px,"+a.y+"px"+L.DomUtil.TRANSLATE_CLOSE},setPosition:function(a,b){a._leaflet_pos=b;if(L.Browser.webkit)a.style.webkitTransform=L.DomUtil.getTranslateString(b);else{a.style.left=b.x+"px";a.style.top=b.y+"px"}},getPosition:function(a){return a._leaflet_pos}};L.Draggable=L.Class.extend({includes:L.Mixin.Events,statics:{START:L.Browser.mobileWebkit?"touchstart":"mousedown",END:L.Browser.mobileWebkit?"touchend":"mouseup",MOVE:L.Browser.mobileWebkit?"touchmove":"mousemove"},initialize:function(a,b){this._element=a;this._dragStartTarget=b||a},enable:function(){if(!this._enabled){L.DomEvent.addListener(this._dragStartTarget,L.Draggable.START,this._onDown,this);this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._dragStartTarget,
b;c&&c.appendChild(a);return a},testProp:function(a){for(var b=document.documentElement.style,c=0;c<a.length;c++)if(a[c]in b)return a[c];return false},getTranslateString:function(a){return L.DomUtil.TRANSLATE_OPEN+a.x+"px,"+a.y+"px"+L.DomUtil.TRANSLATE_CLOSE},getScaleString:function(a,b){return L.DomUtil.getTranslateString(b)+" scale("+a+") "+L.DomUtil.getTranslateString(b.multiplyBy(-1))},setPosition:function(a,b){a._leaflet_pos=b;if(L.Browser.webkit)a.style[L.DomUtil.TRANSFORM_PROPERTY]=L.DomUtil.getTranslateString(b);
else{a.style.left=b.x+"px";a.style.top=b.y+"px"}},getPosition:function(a){return a._leaflet_pos}};L.Util.extend(L.DomUtil,{TRANSITION_PROPERTY:L.DomUtil.testProp(["transition","webkitTransition","OTransition","MozTransition","msTransition"]),TRANSFORM_PROPERTY:L.DomUtil.testProp(["transformProperty","WebkitTransform","OTransform","MozTransform","msTransform"]),TRANSLATE_OPEN:"translate"+(L.Browser.webkit3d?"3d(":"("),TRANSLATE_CLOSE:L.Browser.webkit3d?",0)":")"});L.Draggable=L.Class.extend({includes:L.Mixin.Events,statics:{START:L.Browser.mobileWebkit?"touchstart":"mousedown",END:L.Browser.mobileWebkit?"touchend":"mouseup",MOVE:L.Browser.mobileWebkit?"touchmove":"mousemove"},initialize:function(a,b){this._element=a;this._dragStartTarget=b||a},enable:function(){if(!this._enabled){L.DomEvent.addListener(this._dragStartTarget,L.Draggable.START,this._onDown,this);this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._dragStartTarget,
L.Draggable.START,this._onDown);this._enabled=false}},_onDown:function(a){if(!(a.shiftKey||a.which!=1&&a.button!=1&&!a.touches)){a.touches||L.DomEvent.preventDefault(a);if(!(a.touches&&a.touches.length>1)){if(a.touches&&a.touches.length==1)a=a.touches[0];this._dragStartPos=L.DomUtil.getPosition(this._element);this._startX=a.clientX;this._startY=a.clientY;this._moved=false;this._disableTextSelection();this._setMovingCursor();L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this);L.DomEvent.addListener(document,
L.Draggable.END,this._onUp,this)}}},_onMove:function(a){L.DomEvent.preventDefault(a);if(!(a.touches&&a.touches.length>1)){if(a.touches&&a.touches.length==1)a=a.touches[0];this._newPos=this._dragStartPos.add(new L.Point(a.clientX-this._startX,a.clientY-this._startY));this._updatePosition();if(!this._moved){this.fire("dragstart");this._moved=true}this.fire("drag")}},_updatePosition:function(){L.DomUtil.setPosition(this._element,this._newPos)},_onUp:function(){this._enableTextSelection();this._restoreCursor();
L.DomEvent.removeListener(document,L.Draggable.MOVE,this._onMove);L.DomEvent.removeListener(document,L.Draggable.END,this._onUp);this._moved&&this.fire("dragend")},_setMovingCursor:function(){this._bodyCursor=document.body.style.cursor;document.body.style.cursor="move"},_restoreCursor:function(){document.body.style.cursor=this._bodyCursor},_disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty();if(!this._onselectstart){this._onselectstart=document.onselectstart;
document.onselectstart=L.Util.falseFn}},_enableTextSelection:function(){document.onselectstart=this._onselectstart;this._onselectstart=null}});L.Icon=L.Class.extend({iconUrl:L.ROOT_URL+"images/marker.png",shadowUrl:L.ROOT_URL+"images/marker-shadow.png",iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),initialize:function(a){if(a)this.iconUrl=a},createIcon:function(){return this._createImg("icon")},createShadow:function(){return this._createImg("shadow")},_createImg:function(a){var b=L.DomUtil.create("img","leaflet-marker-"+a);b.src=this[a+"Url"];if(this.iconAnchor){b.style.marginLeft=-this.iconAnchor.x+"px";b.style.marginTop=
-this.iconAnchor.y+"px"}else L.DomEvent.addListener(b,"load",this._setAnchorToCenter);return b},_setAnchorToCenter:function(){this.style.marginLeft=-this.width/2+"px";this.style.marginTop=-this.height/2+"px"}});L.Transition=L.Class.extend({includes:L.Mixin.Events,statics:{CUSTOM_PROPS_SETTERS:{position:L.DomUtil.setPosition},implemented:function(){return L.Transition.NATIVE||L.Transition.TIMER}},options:{easing:"ease",duration:0.5},_setProperty:function(a,b){var c=L.Transition.CUSTOM_PROPS_SETTERS;if(a in c)c[a](this._el,b);else this._el.style[a]=b}});L.Transition=L.Transition.extend({statics:function(){for(var a=document.documentElement.style,b=["transition","webkitTransition","OTransition","MozTransition"],c="",d="transitionend",e=0;e<b.length;e++)if(b[e]in a){c=b[e];break}if(c=="webkitTransition"||c=="OTransition")d=c+"End";return{NATIVE:!!c,TRANSITION:c,PROPERTY:c+"Property",DURATION:c+"Duration",EASING:c+"TimingFunction",END:d,CUSTOM_PROPS_PROPERTIES:{position:L.Browser.webkit?"-webkit-transform":"top, left"}}}(),options:{fakeStepInterval:100},
initialize:function(a,b){this._el=a;L.Util.extend(this.options,b);L.DomEvent.addListener(a,L.Transition.END,this._onTransitionEnd,this);this._onFakeStep=L.Util.bind(this._onFakeStep,this)},run:function(a){var b,c=[],d=L.Transition.CUSTOM_PROPS_PROPERTIES;for(b in a)if(a.hasOwnProperty(b)){b=d[b]?d[b]:b;c.push(b)}this._el.style[L.Transition.DURATION]=this.options.duration+"s";this._el.style[L.Transition.EASING]=this.options.easing;this._el.style[L.Transition.PROPERTY]=c.join(", ");for(b in a)a.hasOwnProperty(b)&&
this._setProperty(b,a[b]);this._inProgress=true;this.fire("start");if(L.Transition.NATIVE)this._timer=setInterval(this._onFakeStep,this.options.fakeStepInterval);else this._onTransitionEnd()},_onFakeStep:function(){this.fire("step")},_onTransitionEnd:function(){if(this._inProgress){this._inProgress=false;clearInterval(this._timer);this._el.style[L.Transition.PROPERTY]="none";this.fire("step");this.fire("end")}}});L.Transition=L.Transition.NATIVE?L.Transition:L.Transition.extend({statics:{getTime:Date.now||function(){return+new Date},TIMER:true,EASINGS:{ease:[0.25,0.1,0.25,1],linear:[0,0,1,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]},CUSTOM_PROPS_GETTERS:{position:L.DomUtil.getPosition},UNIT_RE:/^[\d\.]+(\D*)$/},options:{fps:50},initialize:function(a,b){this._el=a;L.Util.extend(this.options,b);var c=L.Transition.EASINGS[this.options.easing];this._p1=new L.Point(0,0);this._p2=
new L.Point(c[0],c[1]);this._p3=new L.Point(c[2],c[3]);this._p4=new L.Point(1,1);this._step=L.Util.bind(this._step,this);this._interval=Math.round(1E3/this.options.fps)},run:function(a){this._props={};var b=L.Transition.CUSTOM_PROPS_GETTERS,c=L.Transition.UNIT_RE;this.fire("start");for(var d in a)if(a.hasOwnProperty(d)){var e={};if(d in b)e.from=b[d](this._el);else{var f=this._el.style[d].match(c);e.from=parseFloat(f[0]);e.unit=f[1]}e.to=a[d];this._props[d]=e}clearInterval(this._timer);this._timer=
setInterval(this._step,this._interval);this._startTime=L.Transition.getTime()},_step:function(){var a=L.Transition.getTime()-this._startTime,b=this.options.duration*1E3;if(a<b)this._runFrame(this._cubicBezier(a/b));else{this._runFrame(1);this._complete()}},_runFrame:function(a){var b=L.Transition.CUSTOM_PROPS_SETTERS,c,d;for(c in this._props)if(this._props.hasOwnProperty(c)){d=this._props[c];if(c in b){d=d.to.subtract(d.from).multiplyBy(a).add(d.from);b[c](this._el,d)}else this._el.style[c]=(d.to-
d.from)*a+d.from+d.unit}this.fire("step")},_complete:function(){clearInterval(this._timer);this.fire("end")},_cubicBezier:function(a){var b=3*Math.pow(1-a,2)*a,c=3*(1-a)*Math.pow(a,2),d=Math.pow(a,3);a=this._p1.multiplyBy(Math.pow(1-a,3));b=this._p2.multiplyBy(b);c=this._p3.multiplyBy(c);d=this._p4.multiplyBy(d);return a.add(b).add(c).add(d).y}});L.LatLng=L.Class.extend({statics:{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1.0E-9},initialize:function(a,b,c){if(c!==true){a=Math.max(Math.min(a,90),-90);b=(b+180)%360+(b<-180?180:-180)}this.lat=a;this.lng=b},equals:function(a){if(!(a instanceof L.LatLng))return false;return Math.max(Math.abs(this.lat-a.lat),Math.abs(this.lng-a.lng))<=L.LatLng.MAX_MARGIN},toString:function(){return"LatLng( "+L.Util.formatNum(this.lat,5)+", "+L.Util.formatNum(this.lng,5)+" )"}});L.LatLngBounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this._southWest&&!this._northEast){this._southWest=new L.LatLng(a.lat,a.lng);this._northEast=new L.LatLng(a.lat,a.lng)}else{this._southWest.lat=Math.min(a.lat,this._southWest.lat);this._southWest.lng=Math.min(a.lng,this._southWest.lng);this._northEast.lat=Math.max(a.lat,this._northEast.lat);this._northEast.lng=Math.max(a.lng,this._northEast.lng)}},
-this.iconAnchor.y+"px"}else L.DomEvent.addListener(b,"load",this._setAnchorToCenter);return b},_setAnchorToCenter:function(){this.style.marginLeft=-this.width/2+"px";this.style.marginTop=-this.height/2+"px"}});L.Transition=L.Class.extend({includes:L.Mixin.Events,statics:{CUSTOM_PROPS_SETTERS:{position:L.DomUtil.setPosition},implemented:function(){return L.Transition.NATIVE||L.Transition.TIMER}},options:{easing:"ease",duration:0.5},_setProperty:function(a,b){var c=L.Transition.CUSTOM_PROPS_SETTERS;if(a in c)c[a](this._el,b);else this._el.style[a]=b}});L.Transition=L.Transition.extend({statics:function(){var a=L.DomUtil.TRANSITION_PROPERTY;return{NATIVE:!!a,TRANSITION:a,PROPERTY:a+"Property",DURATION:a+"Duration",EASING:a+"TimingFunction",END:a=="webkitTransition"||a=="OTransition"?a+"End":"transitionend",CUSTOM_PROPS_PROPERTIES:{position:L.Browser.webkit?L.DomUtil.TRANSFORM_PROPERTY:"top, left"}}}(),options:{fakeStepInterval:100},initialize:function(a,b){this._el=a;L.Util.extend(this.options,b);L.DomEvent.addListener(a,L.Transition.END,this._onTransitionEnd,
this);this._onFakeStep=L.Util.bind(this._onFakeStep,this)},run:function(a){var b,c=[],d=L.Transition.CUSTOM_PROPS_PROPERTIES;for(b in a)if(a.hasOwnProperty(b)){b=d[b]?d[b]:b;b=b.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()});c.push(b)}this._el.style[L.Transition.DURATION]=this.options.duration+"s";this._el.style[L.Transition.EASING]=this.options.easing;this._el.style[L.Transition.PROPERTY]=c.join(", ");for(b in a)a.hasOwnProperty(b)&&this._setProperty(b,a[b]);this._inProgress=true;this.fire("start");
if(L.Transition.NATIVE)this._timer=setInterval(this._onFakeStep,this.options.fakeStepInterval);else this._onTransitionEnd()},_onFakeStep:function(){this.fire("step")},_onTransitionEnd:function(){if(this._inProgress){this._inProgress=false;clearInterval(this._timer);this._el.style[L.Transition.PROPERTY]="none";this.fire("step");this.fire("end")}}});L.Transition=L.Transition.NATIVE?L.Transition:L.Transition.extend({statics:{getTime:Date.now||function(){return+new Date},TIMER:true,EASINGS:{ease:[0.25,0.1,0.25,1],linear:[0,0,1,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]},CUSTOM_PROPS_GETTERS:{position:L.DomUtil.getPosition},UNIT_RE:/^[\d\.]+(\D*)$/},options:{fps:50},initialize:function(a,b){this._el=a;L.Util.extend(this.options,b);var c=L.Transition.EASINGS[this.options.easing]||L.Transition.EASINGS.ease;this._p1=
new L.Point(0,0);this._p2=new L.Point(c[0],c[1]);this._p3=new L.Point(c[2],c[3]);this._p4=new L.Point(1,1);this._step=L.Util.bind(this._step,this);this._interval=Math.round(1E3/this.options.fps)},run:function(a){this._props={};var b=L.Transition.CUSTOM_PROPS_GETTERS,c=L.Transition.UNIT_RE;this.fire("start");for(var d in a)if(a.hasOwnProperty(d)){var e={};if(d in b)e.from=b[d](this._el);else{var f=this._el.style[d].match(c);e.from=parseFloat(f[0]);e.unit=f[1]}e.to=a[d];this._props[d]=e}clearInterval(this._timer);
this._timer=setInterval(this._step,this._interval);this._startTime=L.Transition.getTime()},_step:function(){var a=L.Transition.getTime()-this._startTime,b=this.options.duration*1E3;if(a<b)this._runFrame(this._cubicBezier(a/b));else{this._runFrame(1);this._complete()}},_runFrame:function(a){var b=L.Transition.CUSTOM_PROPS_SETTERS,c,d;for(c in this._props)if(this._props.hasOwnProperty(c)){d=this._props[c];if(c in b){d=d.to.subtract(d.from).multiplyBy(a).add(d.from);b[c](this._el,d)}else this._el.style[c]=
(d.to-d.from)*a+d.from+d.unit}this.fire("step")},_complete:function(){clearInterval(this._timer);this.fire("end")},_cubicBezier:function(a){var b=3*Math.pow(1-a,2)*a,c=3*(1-a)*Math.pow(a,2),d=Math.pow(a,3);a=this._p1.multiplyBy(Math.pow(1-a,3));b=this._p2.multiplyBy(b);c=this._p3.multiplyBy(c);d=this._p4.multiplyBy(d);return a.add(b).add(c).add(d).y}});L.LatLng=L.Class.extend({statics:{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1.0E-9},initialize:function(a,b,c){if(c!==true){a=Math.max(Math.min(a,90),-90);b=(b+180)%360+(b<-180?180:-180)}this.lat=a;this.lng=b},equals:function(a){if(!(a instanceof L.LatLng))return false;return Math.max(Math.abs(this.lat-a.lat),Math.abs(this.lng-a.lng))<=L.LatLng.MAX_MARGIN},toString:function(){return"LatLng( "+L.Util.formatNum(this.lat,5)+", "+L.Util.formatNum(this.lng,5)+" )"}});L.LatLngBounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){if(!this._southWest&&!this._northEast){this._southWest=new L.LatLng(a.lat,a.lng);this._northEast=new L.LatLng(a.lat,a.lng)}else{this._southWest.lat=Math.min(a.lat,this._southWest.lat);this._southWest.lng=Math.min(a.lng,this._southWest.lng);this._northEast.lat=Math.max(a.lat,this._northEast.lat);this._northEast.lng=Math.max(a.lng,this._northEast.lng)}},
getCenter:function(){return new L.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new L.LatLng(this._northEast.lat,this._southWest.lng)},getSouthEast:function(){return new L.LatLng(this._southWest.lat,this._northEast.lng)},contains:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest();a=a.getNorthEast();return d.lat>=
b.lat&&a.lat<=c.lat&&d.lng>=b.lng&&a.lng<=c.lng}});L.Projection={};L.Projection.Mercator={MAX_LATITUDE:function(){var a=Math.exp(2*Math.PI);return Math.asin((a-1)/(a+1))*L.LatLng.RAD_TO_DEG}(),project:function(a){var b=L.LatLng.DEG_TO_RAD,c=L.Projection.Mercator.MAX_LATITUDE,d=a.lng*b;a=Math.max(Math.min(c,a.lat),-c)*b;a=Math.log(Math.tan(Math.PI/4+a/2));return new L.Point(d,a)},unproject:function(a,b){var c=L.LatLng.DEG_TO_RAD;return new L.LatLng((2*Math.atan(Math.exp(a.y))-Math.PI/2)/c,a.x/c,b)}};L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{tileSize:256,minZoom:0,maxZoom:18,subdomains:"abc",copyright:"",unloadInvisibleTiles:L.Browser.mobileWebkit,updateWhenIdle:L.Browser.mobileWebkit,errorTileUrl:""},initialize:function(a,b){L.Util.extend(this.options,b);this._url=a;if(typeof this.options.subdomains=="string")this.options.subdomains=this.options.subdomains.split("")},onAdd:function(a){this._map=a;this._container=L.DomUtil.create("div","leaflet-layer",a.getPanes().tilePane);
this._tileImg=L.DomUtil.create("img","leaflet-tile");this._tileImg.galleryimg="no";var b=this.options.tileSize;this._tileImg.style.width=b+"px";this._tileImg.style.height=b+"px";a.on("viewreset",this._reset,this);if(this.options.updateWhenIdle)a.on("moveend",this._update,this);else{this._limitedUpdate=L.Util.limitExecByInterval(this._update,100,this);a.on("move",this._limitedUpdate,this)}this._reset();this._update()},onRemove:function(){this._map.getPanes().tilePane.removeChild(this._container);this._map.off("viewreset",
this._reset);this.options.updateWhenIdle?this._map.off("moveend",this._update):this._map.off("move",this._limitedUpdate)},_reset:function(){this._tiles={};this._container.innerHTML=""},_update:function(){var a=this._map.getPixelBounds(),b=this.options.tileSize,c=new L.Point(Math.floor(a.min.x/b),Math.floor(a.min.y/b));a=new L.Point(Math.floor(a.max.x/b),Math.floor(a.max.y/b));c=new L.Bounds(c,a);this._loadTilesFromCenterOut(c);this.options.unloadInvisibleTiles&&this._unloadOtherTiles(c)},getTileUrl:function(a,
b){return this._url.replace("{s}",this.options.subdomains[(a.x+a.y)%this.options.subdomains.length]).replace("{z}",b).replace("{x}",a.x).replace("{y}",a.y)},_loadTilesFromCenterOut:function(a){for(var b=[],c=a.getCenter(),d=a.min.y;d<=a.max.y;d++)for(var e=a.min.x;e<=a.max.x;e++)e+":"+d in this._tiles||b.push(new L.Point(e,d));b.sort(function(f,g){return f.distanceTo(c)-g.distanceTo(c)});a=0;for(d=b.length;a<d;a++)this._loadTile(b[a])},_unloadOtherTiles:function(a){var b,c,d;for(d in this._tiles)if(this._tiles.hasOwnProperty(d)){b=
d.split(":");c=parseInt(b[0],10);b=parseInt(b[1],10);if(c<a.min.x||c>a.max.x||b<a.min.y||b>a.max.y){this._container.removeChild(this._tiles[d]);delete this._tiles[d]}}},_loadTile:function(a){var b=this._map.getPixelOrigin();b=a.multiplyBy(this.options.tileSize).subtract(b);var c=this._map.getZoom(),d=1<<c;a.x=(a.x%d+d)%d;if(!(a.y<0||a.y>=d)){d=this._tileImg.cloneNode(false);this._tiles[a.x+":"+a.y]=d;L.DomUtil.setPosition(d,b);d._leaflet_layer=this;d.onload=this._tileOnLoad;d.onerror=this._tileOnError;
d.onselectstart=d.onmousemove=L.Util.falseFn;d.src=this.getTileUrl(a,c);this._container.appendChild(d)}},_tileOnLoad:function(){this.className+=" leaflet-tile-loaded";this._leaflet_layer.fire("tileload",{tile:this})},_tileOnError:function(){this._leaflet_layer.fire("tileerror",{tile:this,url:this.src});this.src=this._leaflet_layer.options.errorTileUrl}});L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a;this._bounds=b},onAdd:function(a){this._map=a;this._image=L.DomUtil.create("img","leaflet-image-layer");this._image.style.visibility="hidden";this._image.style.position="absolute";L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:this._onImageLoad,src:this._url});this._map.getPanes().overlayPane.appendChild(this._image);this._map.on("viewreset",this._reset,
b.lat&&a.lat<=c.lat&&d.lng>=b.lng&&a.lng<=c.lng}});L.Projection={};L.Projection.Mercator={MAX_LATITUDE:function(){var a=Math.exp(2*Math.PI);return Math.asin((a-1)/(a+1))*L.LatLng.RAD_TO_DEG}(),project:function(a){var b=L.LatLng.DEG_TO_RAD,c=L.Projection.Mercator.MAX_LATITUDE,d=a.lng*b;a=Math.max(Math.min(c,a.lat),-c)*b;a=Math.log(Math.tan(Math.PI/4+a/2));return new L.Point(d,a)},unproject:function(a,b){var c=L.LatLng.DEG_TO_RAD;return new L.LatLng((2*Math.atan(Math.exp(a.y))-Math.PI/2)/c,a.x/c,b)}};L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{tileSize:256,minZoom:0,maxZoom:18,subdomains:"abc",copyright:"",unloadInvisibleTiles:L.Browser.mobileWebkit,updateWhenIdle:L.Browser.mobileWebkit,errorTileUrl:""},initialize:function(a,b){L.Util.extend(this.options,b);this._url=a;if(typeof this.options.subdomains=="string")this.options.subdomains=this.options.subdomains.split("")},onAdd:function(a){this._map=a;this._initContainer();this._tileImg=L.DomUtil.create("img","leaflet-tile");this._tileImg.galleryimg=
"no";var b=this.options.tileSize;this._tileImg.style.width=b+"px";this._tileImg.style.height=b+"px";a.on("viewreset",this._reset,this);if(this.options.updateWhenIdle)a.on("moveend",this._update,this);else{this._limitedUpdate=L.Util.limitExecByInterval(this._update,100,this);a.on("move",this._limitedUpdate,this)}this._reset();this._update()},onRemove:function(){this._map.getPanes().tilePane.removeChild(this._container);this._map.off("viewreset",this._reset);this.options.updateWhenIdle?this._map.off("moveend",
this._update):this._map.off("move",this._limitedUpdate)},_initContainer:function(){var a=this._map.getPanes().tilePane;if(!this._container||a.expired)this._container=L.DomUtil.create("div","leaflet-layer",a)},_reset:function(){this._tiles={};this._initContainer();this._container.innerHTML=""},_update:function(){var a=this._map.getPixelBounds(),b=this.options.tileSize,c=new L.Point(Math.floor(a.min.x/b),Math.floor(a.min.y/b));a=new L.Point(Math.floor(a.max.x/b),Math.floor(a.max.y/b));c=new L.Bounds(c,
a);this._loadTilesFromCenterOut(c);this.options.unloadInvisibleTiles&&this._unloadOtherTiles(c)},getTileUrl:function(a,b){return this._url.replace("{s}",this.options.subdomains[(a.x+a.y)%this.options.subdomains.length]).replace("{z}",b).replace("{x}",a.x).replace("{y}",a.y)},_loadTilesFromCenterOut:function(a){for(var b=[],c=a.getCenter(),d=a.min.y;d<=a.max.y;d++)for(var e=a.min.x;e<=a.max.x;e++)e+":"+d in this._tiles||b.push(new L.Point(e,d));b.sort(function(f,g){return f.distanceTo(c)-g.distanceTo(c)});
a=0;for(d=b.length;a<d;a++)this._loadTile(b[a])},_unloadOtherTiles:function(a){var b,c,d;for(d in this._tiles)if(this._tiles.hasOwnProperty(d)){b=d.split(":");c=parseInt(b[0],10);b=parseInt(b[1],10);if(c<a.min.x||c>a.max.x||b<a.min.y||b>a.max.y){this._container.removeChild(this._tiles[d]);delete this._tiles[d]}}},_loadTile:function(a){var b=this._map.getPixelOrigin();b=a.multiplyBy(this.options.tileSize).subtract(b);var c=this._map.getZoom(),d=1<<c;a.x=(a.x%d+d)%d;if(!(a.y<0||a.y>=d)){d=this._tileImg.cloneNode(false);
this._tiles[a.x+":"+a.y]=d;L.DomUtil.setPosition(d,b);d._leaflet_layer=this;d.onload=this._tileOnLoad;d.onerror=this._tileOnError;d.onselectstart=d.onmousemove=L.Util.falseFn;d.src=this.getTileUrl(a,c);this._container.appendChild(d)}},_tileOnLoad:function(){this.className+=" leaflet-tile-loaded";this._leaflet_layer.fire("tileload",{tile:this})},_tileOnError:function(){this._leaflet_layer.fire("tileerror",{tile:this,url:this.src});this.src=this._leaflet_layer.options.errorTileUrl}});L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a;this._bounds=b},onAdd:function(a){this._map=a;this._image=L.DomUtil.create("img","leaflet-image-layer");this._image.style.visibility="hidden";this._image.style.position="absolute";L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:this._onImageLoad,src:this._url});this._map.getPanes().overlayPane.appendChild(this._image);this._map.on("viewreset",this._reset,
this);this._reset()},_reset:function(){var a=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),b=this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(a);L.DomUtil.setPosition(this._image,a);this._image.style.width=b.x+"px";this._image.style.height=b.y+"px"},_onImageLoad:function(){this.style.visibility=""}});L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon,clickable:true},initialize:function(a,b){this._latlng=a;L.Util.extend(this.options,b)},onAdd:function(a){this._map=a;if(!this._icon){this._icon=this.options.icon.createIcon();a._panes.markerPane.appendChild(this._icon);this._initInteraction()}if(!this._shadow){this._shadow=this.options.icon.createShadow();a._panes.shadowPane.appendChild(this._shadow)}a.on("viewreset",this._reset,this);this._reset()},onRemove:function(a){this._icon&&
a._panes.markerPane.removeChild(this._icon);this._shadow||a._panes.shadowPane.removeChild(this._shadow);a.off("viewreset",this._reset,this)},getLatLng:function(){return this._latlng},_reset:function(){var a=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(this._icon,a);L.DomUtil.setPosition(this._shadow,a);this._icon.style.zIndex=a.y},_initInteraction:function(){if(this.options.clickable){this._icon.className+=" leaflet-clickable";L.DomEvent.addListener(this._icon,"mousedown",
this._fireMouseEvent,this);L.DomEvent.addListener(this._icon,"click",this._fireMouseEvent,this);L.DomEvent.addListener(this._icon,"dblclick",this._fireMouseEvent,this)}},_fireMouseEvent:function(a){this.fire(a.type);L.DomEvent.stopPropagation(a)}});L.Popup=L.Class.extend({includes:L.Mixin.Events,options:{maxWidth:300,autoPan:true,closeButton:true,closeOnMapClick:true,offset:new L.Point(0,0),autoPanPadding:new L.Point(5,5)},initialize:function(a,b,c){this._latlng=a;this._content=b;L.Util.extend(this.options,c)},onAdd:function(a){this._map=a;if(!this._container){this._initLayout();this._updateContent()}this._container.style.opacity="0";this._map._panes.popupPane.appendChild(this._container);this._map.on("viewreset",this._updatePosition,this);
@ -42,22 +44,23 @@ this._map.latLngToLayerPoint(this._latlng);this._containerBottom=-a.y-this.optio
this._map.getSize();if(b.x<0)c.x=b.x-d.x;if(b.x+this._containerWidth>e.x)c.x=b.x+this._containerWidth-e.x+d.x;if(b.y<0)c.y=b.y-d.y;if(b.y+a>e.y)c.y=b.y+a-e.y+d.y;if(c.x||c.y)this._map.panBy(c)}},_onCloseButtonClick:function(){this._close();return false}});L.Marker.include({openPopup:function(){this._map.closePopup();this._popup&&this._map.openPopup(this._popup);return this},bindPopup:function(a,b){b=L.Util.extend({offset:this.options.icon.popupAnchor},b);this._popup=new L.Popup(this._latlng,a,b);this.on("click",this.openPopup,this);return this}});L.Handler=L.Class.extend({initialize:function(a,b){this._map=a;b&&this.enable()},enabled:function(){return!!this._enabled}});L.Handler.MapDrag=L.Handler.extend({enable:function(){if(!this._enabled){if(!this._draggable){this._draggable=new L.Draggable(this._map._mapPane,this._map._container);var a=this._map.getSize();if(a.x*a.y>=7E5&&L.Browser.gecko)this._draggable._updatePosition=L.Util.deferExecByInterval(this._draggable._updatePosition,0,this._draggable);this._draggable.on("dragstart",this._onDragStart,this);this._draggable.on("drag",this._onDrag,this);this._draggable.on("dragend",this._onDragEnd,this)}this._draggable.enable();
this._enabled=true}},disable:function(){if(this._enabled){this._draggable.disable();this._enabled=false}},moved:function(){return this._draggable._moved},_onDragStart:function(){this._map.fire("movestart");this._map.fire("dragstart")},_onDrag:function(){this._map.fire("move");this._map.fire("drag")},_onDragEnd:function(){this._map.fire("moveend");this._map.fire("dragend")}});L.Handler.TouchZoom=L.Handler.extend({enable:function(){if(!(!L.Browser.mobileWebkit||this._enabled)){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this);this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this);this._enabled=false}},_onTouchStart:function(a){if(!(!a.touches||a.touches.length!=2)){var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]),
d=this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));this._startCenter=b.add(c).divideBy(2,true);this._startDist=b.distanceTo(c);this._startTransform=this._map._mapPane.style.webkitTransform;this._moved=false;this._centerOffset=d.subtract(this._startCenter);L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this);L.DomEvent.addListener(document,"touchend",this._onTouchEnd,this);L.DomEvent.preventDefault(a)}},_onTouchMove:function(a){if(!(!a.touches||a.touches.length!=
2)){if(!this._moved){this._map._panes.popupPane.style.display="none";this._moved=true}var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist;this._delta=b.add(c).divideBy(2,true).subtract(this._startCenter);this._map._mapPane.style.webkitTransform=[this._startTransform,L.DomUtil.getTranslateString(this._delta),L.DomUtil.getTranslateString(this._startCenter),"scale("+this._scale+")",L.DomUtil.getTranslateString(this._startCenter.multiplyBy(-1))].join(" ");
L.DomEvent.preventDefault(a)}},_onTouchEnd:function(a){if(!(!a.touches||a.touches.length>=2||!this._scale)){a=this._map.getZoom()+Math.round(Math.log(this._scale)/Math.LN2);var b=this._centerOffset.subtract(this._delta).divideBy(this._scale);this._map.setView(this._map.unproject(this._map.getPixelOrigin().add(this._startCenter).add(b)),a,true);this._map._panes.popupPane.style.display="";this._scale=null;L.DomEvent.removeListener(document,"touchmove",this._onTouchMove);L.DomEvent.removeListener(document,
"touchend",this._onTouchEnd)}}});L.Handler.ScrollWheelZoom=L.Handler.extend({enable:function(){if(!this._enabled){L.DomEvent.addListener(this._map._container,"mousewheel",this._onWheelScroll,this);this._delta=0;this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._map._container,"mousewheel",this._onWheelScroll);this._enabled=false}},_onWheelScroll:function(a){this._delta+=L.DomEvent.getWheelDelta(a);this._lastMousePos=this._map.mouseEventToContainerPoint(a);clearTimeout(this._timer);this._timer=
setTimeout(L.Util.bind(this._performZoom,this),50);L.DomEvent.preventDefault(a)},_performZoom:function(){var a=Math.round(this._delta);this._delta=0;if(a){var b=this._getCenterForScrollWheelZoom(this._lastMousePos,a);a=this._map.getZoom()+a;this._map._limitZoom(a)!=this._map._zoom&&this._map.setView(b,a)}},_getCenterForScrollWheelZoom:function(a,b){var c=this._map.getPixelBounds().getCenter(),d=this._map.getSize().divideBy(2);d=a.subtract(d).multiplyBy(1-Math.pow(2,-b));return this._map.unproject(c.add(d))}});L.Handler.DoubleClickZoom=L.Handler.extend({enable:function(){if(!this._enabled){this._map.on("dblclick",this._onDoubleClick,this._map);this._enabled=true}},disable:function(){if(this._enabled){this._map.off("dblclick",this._onDoubleClick,this._map);this._enabled=false}},_onDoubleClick:function(a){this.setView(a.position,this._zoom+1)}});L.Map=L.Class.extend({includes:L.Mixin.Events,options:{projection:L.Projection.Mercator,transformation:new L.Transformation(0.5/Math.PI,0.5,-0.5/Math.PI,0.5),scaling:function(a){return 256*(1<<a)},center:new L.LatLng(0,0),zoom:0,layers:[],dragging:true,touchZoom:L.Browser.mobileWebkit,scrollWheelZoom:!L.Browser.mobileWebkit,doubleClickZoom:true,trackResize:true,closePopupOnClick:true},initialize:function(a,b){this._container=L.DomUtil.get(a);L.Util.extend(this.options,b);this._initLayout();var c=
this.options.layers;c=c instanceof Array?c:[c];this._initLayers(c);if(L.DomEvent){this._initEvents();L.Handler&&this._initInteraction()}this.setView(this.options.center,this.options.zoom,true)},setView:function(a,b){b=this._limitZoom(b);this._resetView(a,b);return this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),
b,true)},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){this.fire("movestart");this._rawPanBy(a);this.fire("move");this.fire("moveend");return this},addLayer:function(a){var b=L.Util.stamp(a);if(!this._layers[b]){a.onAdd(this);this._layers[b]=a;if(a.options&&!isNaN(a.options.maxZoom))this._layersMaxZoom=Math.max(this._layersMaxZoom||0,a.options.maxZoom);if(a.options&&!isNaN(a.options.minZoom))this._layersMinZoom=Math.min(this._layersMinZoom||Infinity,a.options.minZoom);this.fire("layeradd",
2)){if(!this._moved){this._map._panes.popupPane.style.display="none";this._moved=true}var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist;this._delta=b.add(c).divideBy(2,true).subtract(this._startCenter);this._map._mapPane.style.webkitTransform=[this._startTransform,L.DomUtil.getTranslateString(this._delta),L.DomUtil.getScaleString(this._scale,this._startCenter)].join(" ");L.DomEvent.preventDefault(a)}},
_onTouchEnd:function(a){if(!(!a.touches||a.touches.length>=2||!this._scale)){a=this._map.getZoom()+Math.round(Math.log(this._scale)/Math.LN2);var b=this._centerOffset.subtract(this._delta).divideBy(this._scale);this._map.setView(this._map.unproject(this._map.getPixelOrigin().add(this._startCenter).add(b)),a,true);this._map._panes.popupPane.style.display="";this._scale=null;L.DomEvent.removeListener(document,"touchmove",this._onTouchMove);L.DomEvent.removeListener(document,"touchend",this._onTouchEnd)}}});L.Handler.ScrollWheelZoom=L.Handler.extend({enable:function(){if(!this._enabled){L.DomEvent.addListener(this._map._container,"mousewheel",this._onWheelScroll,this);this._delta=0;this._enabled=true}},disable:function(){if(this._enabled){L.DomEvent.removeListener(this._map._container,"mousewheel",this._onWheelScroll);this._enabled=false}},_onWheelScroll:function(a){this._delta+=L.DomEvent.getWheelDelta(a);this._lastMousePos=this._map.mouseEventToContainerPoint(a);clearTimeout(this._timer);this._timer=
setTimeout(L.Util.bind(this._performZoom,this),50);L.DomEvent.preventDefault(a)},_performZoom:function(){var a=Math.round(this._delta);this._delta=0;if(a){var b=this._getCenterForScrollWheelZoom(this._lastMousePos,a);a=this._map.getZoom()+a;this._map._limitZoom(a)!=this._map._zoom&&this._map.setView(b,a)}},_getCenterForScrollWheelZoom:function(a,b){var c=this._map.getPixelBounds().getCenter(),d=this._map.getSize().divideBy(2);d=a.subtract(d).multiplyBy(1-Math.pow(2,-b));return this._map.unproject(c.add(d))}});L.Handler.DoubleClickZoom=L.Handler.extend({enable:function(){if(!this._enabled){this._map.on("dblclick",this._onDoubleClick,this._map);this._enabled=true}},disable:function(){if(this._enabled){this._map.off("dblclick",this._onDoubleClick,this._map);this._enabled=false}},_onDoubleClick:function(a){this.setView(a.position,this._zoom+1)}});L.Map=L.Class.extend({includes:L.Mixin.Events,options:{projection:L.Projection.Mercator,transformation:new L.Transformation(0.5/Math.PI,0.5,-0.5/Math.PI,0.5),scaling:function(a){return 256*(1<<a)},center:new L.LatLng(0,0),zoom:0,layers:[],dragging:true,touchZoom:L.Browser.mobileWebkit,scrollWheelZoom:!L.Browser.mobileWebkit,doubleClickZoom:true,trackResize:true,closePopupOnClick:true},initialize:function(a,b){this._container=L.DomUtil.get(a);L.Util.extend(this.options,b);this._initLayout();if(L.DomEvent){this._initEvents();
L.Handler&&this._initInteraction()}this.setView(this.options.center,this.options.zoom,true);var c=this.options.layers;c=c instanceof Array?c:[c];this._initLayers(c)},setView:function(a,b){b=this._limitZoom(b);this._resetView(a,b);return this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b,true)},
panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){this.fire("movestart");this._rawPanBy(a);this.fire("move");this.fire("moveend");return this},addLayer:function(a){var b=L.Util.stamp(a);if(!this._layers[b]){a.onAdd(this);this._layers[b]=a;if(a.options&&!isNaN(a.options.maxZoom))this._layersMaxZoom=Math.max(this._layersMaxZoom||0,a.options.maxZoom);if(a.options&&!isNaN(a.options.minZoom))this._layersMinZoom=Math.min(this._layersMinZoom||Infinity,a.options.minZoom);this.fire("layeradd",
{layer:a})}return this},removeLayer:function(a){var b=L.Util.stamp(a);if(this._layers[b]){a.onRemove(this);delete this._layers[b];this.fire("layerremove",{layer:a})}return this},invalidateSize:function(){this._sizeChanged=true;this.fire("move");clearTimeout(this._sizeTimer);this._sizeTimer=setTimeout(L.Util.bind(function(){this.fire("moveend")},this),200);return this},getCenter:function(a){var b=this.getSize().divideBy(2);return this.unproject(this._getTopLeftPoint().add(b),this._zoom,a)},getZoom:function(){return this._zoom},
getBounds:function(){var a=this.getPixelBounds(),b=this.unproject(new L.Point(a.min.x,a.max.y));a=this.unproject(new L.Point(a.max.x,a.min.y));return new L.LatLngBounds(b,a)},getMinZoom:function(){return isNaN(this.options.minZoom)?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return isNaN(this.options.maxZoom)?this._layersMaxZoom||Infinity:this.options.maxZoom},getBoundsZoom:function(a){var b=this.getSize(),c=this.getMinZoom(),d=this.getMaxZoom(),e=a.getNorthEast();a=a.getSouthWest();
var f,g;do{f=this.project(e,c);g=this.project(a,c);f=new L.Point(f.x-g.x,g.y-f.y);c++}while(f.x<=b.x&&f.y<=b.y&&c<=d);return c-1},getSize:function(){if(!this._size||this._sizeChanged){this._size=new L.Point(this._container.clientWidth,this._container.clientHeight);this._sizeChanged=false}return this._size},getPixelBounds:function(){var a=this._getTopLeftPoint(),b=this.getSize();return new L.Bounds(a,a.add(b))},getPixelOrigin:function(){return this._initialTopLeftPoint},mouseEventToContainerPoint:function(a){return L.DomEvent.getMousePosition(a,
this._container)},mouseEventToLayerPoint:function(a){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(a))},mouseEventToLatLng:function(a){return this.layerPointToLatLng(this.mouseEventToLayerPoint(a))},containerPointToLayerPoint:function(a){return a.subtract(L.DomUtil.getPosition(this._mapPane))},layerPointToContainerPoint:function(a){return a.add(L.DomUtil.getPosition(this._mapPane))},layerPointToLatLng:function(a){return this.unproject(a.add(this._initialTopLeftPoint))},latLngToLayerPoint:function(a){return this.project(a).subtract(this._initialTopLeftPoint)},
project:function(a,b){var c=this.options.projection.project(a),d=this.options.scaling(isNaN(b)?this._zoom:b);return this.options.transformation.transform(c,d)},unproject:function(a,b,c){b=this.options.scaling(isNaN(b)?this._zoom:b);return this.options.projection.unproject(this.options.transformation.untransform(a,b),c)},getPanes:function(){return this._panes},_initLayout:function(){this._container.className+=" leaflet-container";this._container.style.position=L.DomUtil.getStyle(this._container,"position")==
"absolute"?"absolute":"relative";this._panes={};this._panes.mapPane=this._mapPane=this._createPane("leaflet-map-pane");this._panes.tilePane=this._createPane("leaflet-tile-pane");this._panes.shadowPane=this._createPane("leaflet-shadow-pane");this._panes.overlayPane=this._createPane("leaflet-overlay-pane");this._panes.markerPane=this._createPane("leaflet-marker-pane");this._panes.popupPane=this._createPane("leaflet-popup-pane")},_createPane:function(a){return L.DomUtil.create("div",a,this._mapPane||
this._container)},_resetView:function(a,b){var c=this._zoom!=b;this.fire("movestart");this._zoom=b;this._initialTopLeftPoint=this._getNewTopLeftPoint(a);L.DomUtil.setPosition(this._mapPane,new L.Point(0,0));this.fire("viewreset");this.fire("move");c&&this.fire("zoomend");this.fire("moveend")},_initLayers:function(a){this._layers={};for(var b=0,c=a.length;b<c;b++)this.addLayer(a[b])},_rawPanBy:function(a){var b=L.DomUtil.getPosition(this._mapPane);L.DomUtil.setPosition(this._mapPane,b.subtract(a))},
"absolute"?"absolute":"relative";this._panes={};this._mapPane=this._panes.mapPane=this._createPane("leaflet-map-pane",this._container);this._panes.tilePane=this._createPane("leaflet-tile-pane");this._panes.shadowPane=this._createPane("leaflet-shadow-pane");this._panes.overlayPane=this._createPane("leaflet-overlay-pane");this._panes.markerPane=this._createPane("leaflet-marker-pane");this._panes.popupPane=this._createPane("leaflet-popup-pane")},_createPane:function(a,b){return L.DomUtil.create("div",
a,b||this._mapPane)},_resetView:function(a,b){var c=this._zoom!=b;this.fire("movestart");this._zoom=b;this._initialTopLeftPoint=this._getNewTopLeftPoint(a);L.DomUtil.setPosition(this._mapPane,new L.Point(0,0));this.fire("viewreset");this.fire("move");c&&this.fire("zoomend");this.fire("moveend")},_initLayers:function(a){this._layers={};for(var b=0,c=a.length;b<c;b++)this.addLayer(a[b])},_rawPanBy:function(a){var b=L.DomUtil.getPosition(this._mapPane);L.DomUtil.setPosition(this._mapPane,b.subtract(a))},
_initEvents:function(){L.DomEvent.addListener(this._container,"click",this._onMouseClick,this);L.DomEvent.addListener(this._container,"dblclick",this._fireMouseEvent,this);L.DomEvent.addListener(this._container,"mousedown",this._fireMouseEvent,this);this.options.trackResize&&L.DomEvent.addListener(window,"resize",this.invalidateSize,this)},_onMouseClick:function(a){this.dragging&&this.dragging.moved()||this._fireMouseEvent(a)},_fireMouseEvent:function(a){this.hasEventListeners(a.type)&&this.fire(a.type,
{position:this.mouseEventToLatLng(a),layerPoint:this.mouseEventToLayerPoint(a)})},_initInteraction:function(){var a={dragging:L.Handler.MapDrag,touchZoom:L.Handler.TouchZoom,doubleClickZoom:L.Handler.DoubleClickZoom,scrollWheelZoom:L.Handler.ScrollWheelZoom},b;for(b in a)if(a.hasOwnProperty(b)&&a[b])this[b]=new a[b](this,this.options[b])},_getTopLeftPoint:function(){return this._initialTopLeftPoint.subtract(L.DomUtil.getPosition(this._mapPane))},_getNewTopLeftPoint:function(a){var b=this.getSize().divideBy(2,
true);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(!(L.Transition&&L.Transition.implemented())?{}:{setView:function(a,b,c){b=this._limitZoom(b);var d=this._zoom!=b;if(!c&&this._layers){c=this._getNewTopLeftPoint(a).subtract(this._getTopLeftPoint());if(d?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)){this.panBy(a);return true}return false},_zoomToIfCenterInView:function(a,b,c){if(this._offsetIsWithinView(c,0.5)){this.latLngToLayerPoint(a);this._resetView(a,b);return true}return false},
_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({openPopup:function(a){this._popup=a;this.addLayer(a)},closePopup:function(){this._popup&&this.removeLayer(this._popup)}});
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)){this.panBy(a);return true}return false},_zoomToIfCenterInView:function(a,b,c){if(!L.Transition.NATIVE)return false;var d=Math.pow(2,b-this._zoom),e=c.divideBy(1-1/d);if(!this._offsetIsWithinView(e,
0.5))return false;if(!this._tileBg){this._tileBg=this._createPane("leaflet-tile-pane");this._tileBg.style.zIndex=1}this._swapFrontAndBg();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)}var f=this.containerPointToLayerPoint(this.getSize().divideBy(2));c=L.DomUtil.getPosition(this._mapPane);e=f.add(e).subtract(c.divideBy(d-1));var g=L.DomUtil.getScaleString(d,
e);this._mapPane.className+=" leaflet-animating";this._resetView(a,b);this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY]=L.DomUtil.getTranslateString(c);setTimeout(L.Util.bind(function(){var h={};h[L.DomUtil.TRANSFORM_PROPERTY]=g;this._tileBg.transition.run(h)},this),20);return true},_swapFrontAndBg:function(){var a=this._panes.tilePane;this._tileBg.innerHTML="";this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY]="";this._tileBg.expired=true;this._tileBg.style.visibility="hidden";a.expired=false;this._panes.tilePane=
this._tileBg;this._tileBg=a},_onZoomTransitionEnd:function(){this._panes.tilePane.style.visibility="";this._panes.tilePane.style.zIndex=2;this._tileBg.style.zIndex=1;this._mapPane.className=this._mapPane.className.replace(" leaflet-animating","")},_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({openPopup:function(a){this._popup=a;this.addLayer(a)},closePopup:function(){this._popup&&this.removeLayer(this._popup)}});

View File

@ -42,19 +42,33 @@ L.DomUtil = {
//TODO refactor away this ugly translate/position mess
TRANSLATE_OPEN: 'translate' + (L.Browser.webkit3d ? '3d(' : '('),
TRANSLATE_CLOSE: L.Browser.webkit3d ? ',0)' : ')',
testProp: function(props) {
var style = document.documentElement.style;
for (var i = 0; i < props.length; i++) {
if (props[i] in style) {
return props[i];
}
}
return false;
},
getTranslateString: function(point) {
return L.DomUtil.TRANSLATE_OPEN +
point.x + 'px,' + point.y + 'px' +
L.DomUtil.TRANSLATE_CLOSE;
},
getScaleString: function(scale, origin) {
return L.DomUtil.getTranslateString(origin) +
' scale(' + scale + ') ' +
L.DomUtil.getTranslateString(origin.multiplyBy(-1));
},
setPosition: function(el, point) {
el._leaflet_pos = point;
if (L.Browser.webkit) {
el.style.webkitTransform = L.DomUtil.getTranslateString(point);
el.style[L.DomUtil.TRANSFORM_PROPERTY] = L.DomUtil.getTranslateString(point);
} else {
el.style.left = point.x + 'px';
el.style.top = point.y + 'px';
@ -64,4 +78,12 @@ L.DomUtil = {
getPosition: function(el) {
return el._leaflet_pos;
}
};
};
L.Util.extend(L.DomUtil, {
TRANSITION_PROPERTY: L.DomUtil.testProp(['transition', 'webkitTransition', 'OTransition', 'MozTransition', 'msTransition']),
TRANSFORM_PROPERTY: L.DomUtil.testProp(['transformProperty', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform']),
TRANSLATE_OPEN: 'translate' + (L.Browser.webkit3d ? '3d(' : '('),
TRANSLATE_CLOSE: L.Browser.webkit3d ? ',0)' : ')'
});

View File

@ -5,21 +5,9 @@
L.Transition = L.Transition.extend({
statics: (function() {
var style = document.documentElement.style,
names = ['transition', 'webkitTransition', 'OTransition', 'MozTransition'],
transition = '',
transitionEnd = 'transitionend';
for (var i = 0; i < names.length; i++) {
if (names[i] in style) {
transition = names[i];
break;
}
}
if (transition == 'webkitTransition' || transition == 'OTransition') {
transitionEnd = transition + 'End';
}
var transition = L.DomUtil.TRANSITION_PROPERTY,
transitionEnd = (transition == 'webkitTransition' || transition == 'OTransition' ?
transition + 'End' : 'transitionend');
return {
NATIVE: !!transition,
@ -32,8 +20,7 @@ L.Transition = L.Transition.extend({
// transition-property value to use with each particular custom property
CUSTOM_PROPS_PROPERTIES: {
position: L.Browser.webkit ? '-webkit-transform' : 'top, left'
//TODO enable native position animation for other transition-capable browsers?
position: L.Browser.webkit ? L.DomUtil.TRANSFORM_PROPERTY : 'top, left'
}
};
})(),
@ -58,6 +45,7 @@ L.Transition = L.Transition.extend({
for (prop in props) {
if (props.hasOwnProperty(prop)) {
prop = customProp[prop] ? customProp[prop] : prop;
prop = prop.replace(/([A-Z])/g, function(w) { return '-' + w.toLowerCase(); });
propsList.push(prop);
}
}

View File

@ -33,7 +33,8 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
this._el = el;
L.Util.extend(this.options, options);
var easings = L.Transition.EASINGS[this.options.easing];
var easings = L.Transition.EASINGS[this.options.easing] || L.Transition.EASINGS['ease'];
this._p1 = new L.Point(0, 0);
this._p2 = new L.Point(easings[0], easings[1]);
this._p3 = new L.Point(easings[2], easings[3]);
@ -75,9 +76,9 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
var time = L.Transition.getTime(),
elapsed = time - this._startTime,
duration = this.options.duration * 1000;
if (elapsed < duration) {
var percentComplete = this._cubicBezier(elapsed / duration);
this._runFrame(percentComplete);
this._runFrame(this._cubicBezier(elapsed / duration));
} else {
this._runFrame(1);
this._complete();

View File

@ -34,6 +34,10 @@ L.Point.prototype = {
return new L.Point(Math.round(this.x), Math.round(this.y));
},
clone: function() {
return new L.Point(this.x, this.y);
},
toString: function() {
return 'Point( ' + this.x + ', ' + this.y + ' )';
}

View File

@ -63,9 +63,7 @@ L.Handler.TouchZoom = L.Handler.extend({
this._map._mapPane.style.webkitTransform = [
this._startTransform,
L.DomUtil.getTranslateString(this._delta),
L.DomUtil.getTranslateString(this._startCenter),
'scale(' + this._scale + ')',
L.DomUtil.getTranslateString(this._startCenter.multiplyBy(-1))
L.DomUtil.getScaleString(this._scale, this._startCenter)
].join(" ");
L.DomEvent.preventDefault(e);

View File

@ -30,7 +30,7 @@ L.TileLayer = L.Class.extend({
this._map = map;
// create a container div for tiles
this._container = L.DomUtil.create('div', 'leaflet-layer', map.getPanes().tilePane);
this._initContainer();
// create an image to clone for tiles
this._tileImg = L.DomUtil.create('img', 'leaflet-tile');
@ -66,8 +66,16 @@ L.TileLayer = L.Class.extend({
}
},
_initContainer: function() {
var tilePane = this._map.getPanes().tilePane;
if (!this._container || tilePane.expired) {
this._container = L.DomUtil.create('div', 'leaflet-layer', tilePane);
}
},
_reset: function() {
this._tiles = {};
this._initContainer();
this._container.innerHTML = '';
},

View File

@ -53,29 +53,68 @@ L.Map.include(!(L.Transition && L.Transition.implemented()) ? {} : {
return false;
},
_zoomToIfCenterInView: function(center, zoom, offset) {
_zoomToIfCenterInView: function(center, zoom, centerOffset) {
if (!L.Transition.NATIVE) { return false; }
var zoomDelta = zoom - this._zoom,
scale = Math.pow(2, zoomDelta),
offset = centerOffset.divideBy(1 - 1/scale);
//if offset does not exceed half of the view
if (this._offsetIsWithinView(offset, 0.5)) {
//TODO animated zoom
// if (!this._zoomTransition) {
// this._zoomTransition = new L.Transition(this._mapPane, {duration: 0.3});
// }
var centerPoint = this.latLngToLayerPoint(center);
// this._mapPane.style['-webkit-transform-origin'] = '50% 50%';
// this._zoomTransition.run({
// '-webkit-transform': [
// //this._mapPane.style.webkitTransform,
// L.DomUtil.getTranslateString(centerPoint),
// 'scale(' + 5 + ')',
// L.DomUtil.getTranslateString(centerPoint.multiplyBy(-1))
// ].join(' ')
// });
this._resetView(center, zoom);
return true;
if(!this._offsetIsWithinView(offset, 0.5)) { return false; }
if (!this._tileBg) {
this._tileBg = this._createPane('leaflet-tile-pane');
this._tileBg.style.zIndex = 1;
}
return false;
this._swapFrontAndBg(); //TODO refactor away tile layer swapping to share it with touch zoom
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);
}
var centerPoint = this.containerPointToLayerPoint(this.getSize().divideBy(2)),
mapPaneOffset = L.DomUtil.getPosition(this._mapPane),
origin = centerPoint.add(offset).subtract(mapPaneOffset.divideBy(scale - 1)),
transformStr = L.DomUtil.getScaleString(scale, origin);
this._mapPane.className += ' leaflet-animating';
this._resetView(center, zoom);
this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY] = L.DomUtil.getTranslateString(mapPaneOffset);
//TODO eliminate this ugly hack
setTimeout(L.Util.bind(function() {
var options = {};
options[L.DomUtil.TRANSFORM_PROPERTY] = transformStr;
this._tileBg.transition.run(options);
}, this), 20);
return true;
},
_swapFrontAndBg: function() {
var oldTilePane = this._panes.tilePane;
this._tileBg.innerHTML = '';
this._tileBg.style[L.DomUtil.TRANSFORM_PROPERTY] = '';
this._tileBg.expired = true; //TODO better name for property
this._tileBg.style.visibility = 'hidden';
oldTilePane.expired = false;
this._panes.tilePane = this._tileBg;
this._tileBg = oldTilePane;
},
_onZoomTransitionEnd: function() {
this._panes.tilePane.style.visibility = '';
this._panes.tilePane.style.zIndex = 2;
this._tileBg.style.zIndex = 1;
this._mapPane.className = this._mapPane.className.replace(' leaflet-animating', ''); //TODO toggleClass util
},
_offsetIsWithinView: function(offset, multiplyFactor) {

View File

@ -36,16 +36,16 @@ L.Map = L.Class.extend({
this._initLayout();
var layers = this.options.layers;
layers = (layers instanceof Array ? layers : [layers]);
this._initLayers(layers);
if (L.DomEvent) {
this._initEvents();
if (L.Handler) { this._initInteraction(); }
}
this.setView(this.options.center, this.options.zoom, true);
var layers = this.options.layers;
layers = (layers instanceof Array ? layers : [layers]);
this._initLayers(layers);
},
@ -259,7 +259,8 @@ L.Map = L.Class.extend({
this._container.style.position = (position == 'absolute' ? 'absolute' : 'relative');
this._panes = {};
this._panes.mapPane = this._mapPane = this._createPane('leaflet-map-pane');
this._mapPane = this._panes.mapPane = this._createPane('leaflet-map-pane', this._container);
this._panes.tilePane = this._createPane('leaflet-tile-pane');
this._panes.shadowPane = this._createPane('leaflet-shadow-pane');
this._panes.overlayPane = this._createPane('leaflet-overlay-pane');
@ -267,8 +268,8 @@ L.Map = L.Class.extend({
this._panes.popupPane = this._createPane('leaflet-popup-pane');
},
_createPane: function(className) {
return L.DomUtil.create('div', className, this._mapPane || this._container);
_createPane: function(className, container) {
return L.DomUtil.create('div', className, container || this._mapPane);
},
_resetView: function(center, zoom) {