update build
This commit is contained in:
parent
064b0fd60f
commit
4dd11ef018
8
dist/leaflet.js
vendored
8
dist/leaflet.js
vendored
@ -16,8 +16,8 @@ L.Draggable.START,this._onDown);this._enabled=false}},_onDown:function(a){if(!(a
|
||||
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);if(this._moved){this.fire("dragend");this._moved=false}},_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.Transition=L.Class.extend({includes:L.Mixin.Events,statics:{CUSTOM_PROPS_SETTERS:{position:L.DomUtil.setPosition}},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);a.style[L.Transition.PROPERTY]="none";a.style[L.Transition.DURATION]=this.options.duration+"s";a.style[L.Transition.EASING]=this.options.easing;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.PROPERTY]=c.join(", ");
|
||||
for(b in a)a.hasOwnProperty(b)&&this._setProperty(b,a[b]);this._inProgress=true;this.fire("start");this._timer=setInterval(this._onFakeStep,this.options.fakeStepInterval)},_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},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],
|
||||
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");this._timer=setInterval(this._onFakeStep,this.options.fakeStepInterval)},_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},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)}},
|
||||
@ -37,7 +37,7 @@ c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/thi
|
||||
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._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);if(a){var b=this._getCenterForScrollWheelZoom(this._lastMousePos,a);a=this._map.getZoom()+a;this._map.setView(b,a);this._delta=0}},_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},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,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},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+
|
||||
1)},zoomOut:function(){return this.setZoom(this,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")},addLayer:function(a){var b=L.Util.stamp(a);if(!this._layers[b]){a.onAdd(this);this._layers[b]=a;this._layersMaxZoom=Math.max(this._layersMaxZoom||0,a.options.maxZoom||Infinity);this._layersMinZoom=
|
||||
1)},zoomOut:function(){return this.setZoom(this,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;this._layersMaxZoom=Math.max(this._layersMaxZoom||0,a.options.maxZoom||Infinity);this._layersMinZoom=
|
||||
Math.min(this._layersMinZoom||Infinity,a.options.minZoom||0);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},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))},
|
||||
@ -47,4 +47,4 @@ this._panes.overlayPane=this._createPane("leaflet-overlay-pane")},_createPane:fu
|
||||
{};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))},_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._resetView(a,b);return true}return false},_initEvents:function(){L.DomEvent.addListener(this._container,"click",this._onMouseClick,this);L.DomEvent.addListener(this._container,
|
||||
"dblclick",this._fireMouseEvent,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()},_offsetIsWithinView:function(a,b){var c=b||1,d=this.getSize();return Math.abs(a.x)<=d.width*c&&Math.abs(a.y)<=d.height*c},_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;a=a.coords.longitude;var e=new L.LatLng(d-b,a-c);b=new L.LatLng(d+b,a+c);b=new L.LatLngBounds(e,b);this.fitBounds(b);
|
||||
this.fire("locationfound",{latlng:new L.LatLng(d,a),bounds:b})}});
|
||||
this.fire("locationfound",{latlng:new L.LatLng(d,a),bounds:b})}});L.Map.include({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")}});
|
||||
|
Loading…
Reference in New Issue
Block a user