map-core-func 0.1.51 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * LICENSE : MIT
5
5
  * (c) 2016-2017 maptalks.org
6
6
  */
7
- function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}ll.registerRenderer("canvas",hl);var gl,dl={markerType:"ellipse",markerFill:(gl=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+gl.join()+", 0.5)"],[.3,"rgba("+gl.join()+", 1)"],[.2,"rgba("+gl.join()+", 1)"],[0,"rgba("+gl.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},Al=function(e){function r(){return cl(this,r),fl(this,e.apply(this,arguments))}return pl(r,e),r.prototype.addGeometry=function(r){return r instanceof t.Geometry&&(r=[r]),r.forEach((function(e,r){if(!(e instanceof t.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),e.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(e){if(!e||"AnimateMarkerLayer"!==e.type)return null;for(var n=new r(e.id,e.options),i=e.geometries,o=[],s=0;s<i.length;s++){var a=t.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),e.style&&n.setStyle(e.style),n},r}(t.VectorLayer);Al.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),Al.registerJSONType("AnimateMarkerLayer"),Al.registerRenderer("canvas",function(e){function r(){return cl(this,r),fl(this,e.apply(this,arguments))}return pl(r,e),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||e.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?dl:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(e){for(var r in this._spriteCache={},e){var n=e[r],i=new t.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(t.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var yl=function(){function t(e,r,n){h(this,t);var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,c=r.markerDx||0,f=r.markerDy||0,p=i.GeoJSON.toGeometry(e);this.layer=new Al(i.Util.GUID(),p,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:c,markerDy:f}}]).addTo(n)}return f(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function vl(t){var e=[1/0,1/0,-1/0,-1/0];return Za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}vl.default=vl;
7
+ function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}ll.registerRenderer("canvas",hl);var gl,dl={markerType:"ellipse",markerFill:(gl=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+gl.join()+", 0.5)"],[.3,"rgba("+gl.join()+", 1)"],[.2,"rgba("+gl.join()+", 1)"],[0,"rgba("+gl.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},Al=function(e){function r(){return cl(this,r),fl(this,e.apply(this,arguments))}return pl(r,e),r.prototype.addGeometry=function(r){return r instanceof t.Geometry&&(r=[r]),r.forEach((function(e,r){if(!(e instanceof t.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),e.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(e){if(!e||"AnimateMarkerLayer"!==e.type)return null;for(var n=new r(e.id,e.options),i=e.geometries,o=[],s=0;s<i.length;s++){var a=t.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),e.style&&n.setStyle(e.style),n},r}(t.VectorLayer);Al.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),Al.registerJSONType("AnimateMarkerLayer"),Al.registerRenderer("canvas",function(e){function r(){return cl(this,r),fl(this,e.apply(this,arguments))}return pl(r,e),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||e.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?dl:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(e){for(var r in this._spriteCache={},e){var n=e[r],i=new t.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(t.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var yl=function(){function t(e,r,n){h(this,t),this.map=n;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,c=r.markerDx||0,f=r.markerDy||0,p=i.GeoJSON.toGeometry(e);this.layer=new Al(i.Util.GUID(),p,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:c,markerDy:f}}]).addTo(n)}return f(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function vl(t){var e=[1/0,1/0,-1/0,-1/0];return Za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}vl.default=vl;
8
8
  /*
9
9
  object-assign
10
10
  (c) Sindre Sorhus
@@ -4,7 +4,7 @@ import*as t from"maptalks";import{Marker as e,Geometry as n,VectorLayer as r,ren
4
4
  * LICENSE : MIT
5
5
  * (c) 2016-2017 maptalks.org
6
6
  */
7
- function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;r++){var i=n[r],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}uc.registerRenderer("canvas",lc);var pc,gc={markerType:"ellipse",markerFill:(pc=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+pc.join()+", 0.5)"],[.3,"rgba("+pc.join()+", 1)"],[.2,"rgba("+pc.join()+", 1)"],[0,"rgba("+pc.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},dc=function(t){function r(){return hc(this,r),cc(this,t.apply(this,arguments))}return fc(r,t),r.prototype.addGeometry=function(r){return r instanceof n&&(r=[r]),r.forEach((function(t,n){if(!(t instanceof e))throw new Error("The geometry at "+n+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var e=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=n.fromJSON(i[s]);a&&o.push(a)}return e.addGeometry(o),t.style&&e.setStyle(t.style),e},r}(r);dc.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),dc.registerJSONType("AnimateMarkerLayer"),dc.registerRenderer("canvas",function(t){function n(){return hc(this,n),cc(this,t.apply(this,arguments))}return fc(n,t),n.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},n.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},n.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},n.prototype.onCanvasCreate=function(){this._prepare()},n.prototype.onGeometryAdd=function(){this._redraw()},n.prototype.onGeometryRemove=function(){this._redraw()},n.prototype.onGeometrySymbolChange=function(){this._redraw()},n.prototype.onGeometryPositionChange=function(){this._redraw()},n.prototype.onGeometryShow=function(){this._redraw()},n.prototype.onGeometryHide=function(){this._redraw()},n.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},n.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},n.prototype._drawAllMarkers=function(t){var e=this,n=this.getMap(),r=n.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=n._prjToContainerPoint(t.coordinates);r.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=n._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},n.prototype._drawMarker=function(t,e,n,r){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(r-t.start)%i/i,u=n.fade&&a>=.5?2-2*a:1,l=n.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},n.prototype._prepare=function(){var t=this,e=[],n={},r=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?gc:i._getInternalSymbol(),s=JSON.stringify(o);n[s]||(n[s]=o),e.push({coordinates:r.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(n),this._currentMarkers=e},n.prototype._prepareSprites=function(t){for(var n in this._spriteCache={},t){var r=t[n],i=new e([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[n]=i}},n.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},n.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},n=this.layer.options.animation?this.layer.options.animation.split(","):[],r=0;r<n.length;r++){var i=(t=n[r]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},n}(i.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var Ac=function(){function e(n,r,i){le(this,e);var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=t.GeoJSON.toGeometry(n);this.layer=new dc(t.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(i)}return ce(e,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),e}();function yc(t){var e=[1/0,1/0,-1/0,-1/0];return Kl(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}yc.default=yc;
7
+ function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;r++){var i=n[r],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}uc.registerRenderer("canvas",lc);var pc,gc={markerType:"ellipse",markerFill:(pc=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+pc.join()+", 0.5)"],[.3,"rgba("+pc.join()+", 1)"],[.2,"rgba("+pc.join()+", 1)"],[0,"rgba("+pc.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},dc=function(t){function r(){return hc(this,r),cc(this,t.apply(this,arguments))}return fc(r,t),r.prototype.addGeometry=function(r){return r instanceof n&&(r=[r]),r.forEach((function(t,n){if(!(t instanceof e))throw new Error("The geometry at "+n+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var e=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=n.fromJSON(i[s]);a&&o.push(a)}return e.addGeometry(o),t.style&&e.setStyle(t.style),e},r}(r);dc.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),dc.registerJSONType("AnimateMarkerLayer"),dc.registerRenderer("canvas",function(t){function n(){return hc(this,n),cc(this,t.apply(this,arguments))}return fc(n,t),n.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},n.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},n.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},n.prototype.onCanvasCreate=function(){this._prepare()},n.prototype.onGeometryAdd=function(){this._redraw()},n.prototype.onGeometryRemove=function(){this._redraw()},n.prototype.onGeometrySymbolChange=function(){this._redraw()},n.prototype.onGeometryPositionChange=function(){this._redraw()},n.prototype.onGeometryShow=function(){this._redraw()},n.prototype.onGeometryHide=function(){this._redraw()},n.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},n.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},n.prototype._drawAllMarkers=function(t){var e=this,n=this.getMap(),r=n.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=n._prjToContainerPoint(t.coordinates);r.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=n._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},n.prototype._drawMarker=function(t,e,n,r){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(r-t.start)%i/i,u=n.fade&&a>=.5?2-2*a:1,l=n.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},n.prototype._prepare=function(){var t=this,e=[],n={},r=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?gc:i._getInternalSymbol(),s=JSON.stringify(o);n[s]||(n[s]=o),e.push({coordinates:r.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(n),this._currentMarkers=e},n.prototype._prepareSprites=function(t){for(var n in this._spriteCache={},t){var r=t[n],i=new e([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[n]=i}},n.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},n.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},n=this.layer.options.animation?this.layer.options.animation.split(","):[],r=0;r<n.length;r++){var i=(t=n[r]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},n}(i.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var Ac=function(){function e(n,r,i){le(this,e),this.map=i;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=t.GeoJSON.toGeometry(n);this.layer=new dc(t.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(i)}return ce(e,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),e}();function yc(t){var e=[1/0,1/0,-1/0,-1/0];return Kl(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}yc.default=yc;
8
8
  /*
9
9
  object-assign
10
10
  (c) Sindre Sorhus
@@ -4,7 +4,7 @@
4
4
  * LICENSE : MIT
5
5
  * (c) 2016-2017 maptalks.org
6
6
  */
7
- function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}hl.registerRenderer("canvas",cl);var dl,Al={markerType:"ellipse",markerFill:(dl=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+dl.join()+", 0.5)"],[.3,"rgba("+dl.join()+", 1)"],[.2,"rgba("+dl.join()+", 1)"],[0,"rgba("+dl.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},yl=function(t){function r(){return fl(this,r),pl(this,t.apply(this,arguments))}return gl(r,t),r.prototype.addGeometry=function(r){return r instanceof e.Geometry&&(r=[r]),r.forEach((function(t,r){if(!(t instanceof e.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var n=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=e.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),t.style&&n.setStyle(t.style),n},r}(e.VectorLayer);yl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),yl.registerJSONType("AnimateMarkerLayer"),yl.registerRenderer("canvas",function(t){function r(){return fl(this,r),pl(this,t.apply(this,arguments))}return gl(r,t),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?Al:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(t){for(var r in this._spriteCache={},t){var n=t[r],i=new e.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(e.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var vl=function(){function t(e,r,n){c(this,t);var i=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,f=r.markerDy||0,p=o.GeoJSON.toGeometry(e);this.layer=new yl(o.Util.GUID(),p,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(i),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:f}}]).addTo(n)}return p(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function ml(t){var e=[1/0,1/0,-1/0,-1/0];return $a(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}ml.default=ml;
7
+ function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}hl.registerRenderer("canvas",cl);var dl,Al={markerType:"ellipse",markerFill:(dl=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+dl.join()+", 0.5)"],[.3,"rgba("+dl.join()+", 1)"],[.2,"rgba("+dl.join()+", 1)"],[0,"rgba("+dl.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},yl=function(t){function r(){return fl(this,r),pl(this,t.apply(this,arguments))}return gl(r,t),r.prototype.addGeometry=function(r){return r instanceof e.Geometry&&(r=[r]),r.forEach((function(t,r){if(!(t instanceof e.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var n=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=e.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),t.style&&n.setStyle(t.style),n},r}(e.VectorLayer);yl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),yl.registerJSONType("AnimateMarkerLayer"),yl.registerRenderer("canvas",function(t){function r(){return fl(this,r),pl(this,t.apply(this,arguments))}return gl(r,t),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?Al:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(t){for(var r in this._spriteCache={},t){var n=t[r],i=new e.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(e.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var vl=function(){function t(e,r,n){c(this,t),this.map=n;var i=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,f=r.markerDy||0,p=o.GeoJSON.toGeometry(e);this.layer=new yl(o.Util.GUID(),p,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(i),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:f}}]).addTo(n)}return p(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function ml(t){var e=[1/0,1/0,-1/0,-1/0];return $a(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}ml.default=ml;
8
8
  /*
9
9
  object-assign
10
10
  (c) Sindre Sorhus
@@ -7,7 +7,7 @@ function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProp
7
7
  /*!
8
8
  * requires maptalks@>=0.25.0
9
9
  */
10
- function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}nl.registerRenderer("canvas",il);var ul,ll={markerType:"ellipse",markerFill:(ul=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+ul.join()+", 0.5)"],[.3,"rgba("+ul.join()+", 1)"],[.2,"rgba("+ul.join()+", 1)"],[0,"rgba("+ul.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},hl=function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.addGeometry=function(e){return e instanceof maptalks.Geometry&&(e=[e]),e.forEach((function(t,e){if(!(t instanceof maptalks.Marker))throw new Error("The geometry at "+e+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},e.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var r=new e(t.id,t.options),n=t.geometries,i=[],o=0;o<n.length;o++){var s=maptalks.Geometry.fromJSON(n[o]);s&&i.push(s)}return r.addGeometry(i),t.style&&r.setStyle(t.style),r},e}(maptalks.VectorLayer);hl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),hl.registerJSONType("AnimateMarkerLayer"),hl.registerRenderer("canvas",function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},e.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},e.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},e.prototype.onCanvasCreate=function(){this._prepare()},e.prototype.onGeometryAdd=function(){this._redraw()},e.prototype.onGeometryRemove=function(){this._redraw()},e.prototype.onGeometrySymbolChange=function(){this._redraw()},e.prototype.onGeometryPositionChange=function(){this._redraw()},e.prototype.onGeometryShow=function(){this._redraw()},e.prototype.onGeometryHide=function(){this._redraw()},e.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},e.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},e.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},e.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},e.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?ll:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},e.prototype._prepareSprites=function(t){for(var e in this._spriteCache={},t){var r=t[e],n=new maptalks.Marker([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[e]=n}},e.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},e.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},e}(maptalks.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var cl=function(){function t(e,r,n){i(this,t);var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=maptalks.GeoJSON.toGeometry(e);this.layer=new hl(maptalks.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(n)}return s(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function fl(t){var e=[1/0,1/0,-1/0,-1/0];return za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}fl.default=fl;
10
+ function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}nl.registerRenderer("canvas",il);var ul,ll={markerType:"ellipse",markerFill:(ul=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+ul.join()+", 0.5)"],[.3,"rgba("+ul.join()+", 1)"],[.2,"rgba("+ul.join()+", 1)"],[0,"rgba("+ul.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},hl=function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.addGeometry=function(e){return e instanceof maptalks.Geometry&&(e=[e]),e.forEach((function(t,e){if(!(t instanceof maptalks.Marker))throw new Error("The geometry at "+e+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},e.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var r=new e(t.id,t.options),n=t.geometries,i=[],o=0;o<n.length;o++){var s=maptalks.Geometry.fromJSON(n[o]);s&&i.push(s)}return r.addGeometry(i),t.style&&r.setStyle(t.style),r},e}(maptalks.VectorLayer);hl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),hl.registerJSONType("AnimateMarkerLayer"),hl.registerRenderer("canvas",function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},e.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},e.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},e.prototype.onCanvasCreate=function(){this._prepare()},e.prototype.onGeometryAdd=function(){this._redraw()},e.prototype.onGeometryRemove=function(){this._redraw()},e.prototype.onGeometrySymbolChange=function(){this._redraw()},e.prototype.onGeometryPositionChange=function(){this._redraw()},e.prototype.onGeometryShow=function(){this._redraw()},e.prototype.onGeometryHide=function(){this._redraw()},e.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},e.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},e.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},e.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},e.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?ll:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},e.prototype._prepareSprites=function(t){for(var e in this._spriteCache={},t){var r=t[e],n=new maptalks.Marker([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[e]=n}},e.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},e.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},e}(maptalks.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var cl=function(){function t(e,r,n){i(this,t),this.map=n;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=maptalks.GeoJSON.toGeometry(e);this.layer=new hl(maptalks.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(n)}return s(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function fl(t){var e=[1/0,1/0,-1/0,-1/0];return za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}fl.default=fl;
11
11
  /*
12
12
  object-assign
13
13
  (c) Sindre Sorhus
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "map-core-func",
3
3
  "umdName": "map-core-func",
4
- "version": "0.1.51",
4
+ "version": "0.1.52",
5
5
  "description": "map-core-func",
6
6
  "files": [
7
7
  "dist"