Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@2gis/markerdrawer

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@2gis/markerdrawer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/markerdrawer.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MarkerDrawer=e():t.MarkerDrawer=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1);i.d(e,"MarkerDrawer",function(){return r.a});var n=i(6);i.d(e,"Atlas",function(){return n.a})},function(t,e,i){"use strict";i.d(e,"a",function(){return o});var r=i(2),n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),o=function(t){function e(e){void 0===e&&(e={});var i=t.call(this)||this;return i._onClick=function(t){var e=i._getMousePosition(t),r=i._renderer.search(e);if(r.length){t.stopPropagation();var n={originalEvent:t,marker:Math.max.apply(Math,r)};i.fire("click",n)}},i._onMouseLeave=function(t){if(void 0!==i._hoveredMarker){var e={originalEvent:t,marker:i._hoveredMarker};i.fire("mouseout",e),i._hoveredMarker=void 0}},i._onMouseMove=function(t){var e=i._getMousePosition(t),r=i._renderer.search(e),n={originalEvent:t,marker:0};if(r.length){var o=Math.max.apply(Math,r);if(void 0!==i._hoveredMarker){if(i._hoveredMarker===o)return;n.marker=i._hoveredMarker,i.fire("mouseout",n)}i._hoveredMarker=o,n.marker=i._hoveredMarker,i.fire("mouseover",n)}else void 0!==i._hoveredMarker&&(n.marker=i._hoveredMarker,i.fire("mouseout",n),i._hoveredMarker=void 0)},i._onMouseDown=function(t){var e=i._getMousePosition(t),r=i._renderer.search(e);if(r.length){i._clickedMarker=Math.max.apply(Math,r);var n={originalEvent:t,marker:i._clickedMarker};i.fire("mousedown",n)}},i._onMouseUp=function(t){if(void 0!==i._clickedMarker){var e={originalEvent:t,marker:i._clickedMarker};i.fire("mouseup",e),i._clickedMarker=void 0}},i._renderer=new r.a(e.debugDrawing||!1,void 0!==e.bufferFactor?e.bufferFactor:.5,e.zIndex,e.updateOnMoveEnd),i}return n(e,t),e.prototype.setAtlas=function(t){this._renderer.setAtlas(t)},e.prototype.setMarkers=function(t){this._renderer.setMarkers(t)},e.prototype.update=function(){this._renderer.update()},e.prototype.addTo=function(t){return t.addLayer(this),this},e.prototype.onAdd=function(){return this._map?(this._pane=this._map.getPane("overlayPane"),this._renderer.onAddToMap(this._map),this._pane.addEventListener("click",this._onClick),this._pane.addEventListener("mousemove",this._onMouseMove),this._pane.addEventListener("mouseleave",this._onMouseLeave),this._pane.addEventListener("mousedown",this._onMouseDown),this._pane.addEventListener("mouseup",this._onMouseUp),this._pane.appendChild(this._renderer.container),this):this},e.prototype.remove=function(){return this._map&&this._map.removeLayer(this),this},e.prototype.onRemove=function(){return this._pane.removeChild(this._renderer.container),this._renderer.onRemoveFromMap(),this._pane.removeEventListener("click",this._onClick),this._pane.removeEventListener("mousemove",this._onMouseMove),this._pane.removeEventListener("mouseleave",this._onMouseLeave),this._pane.removeEventListener("mousedown",this._onMouseDown),this._pane.removeEventListener("mouseup",this._onMouseUp),this},e.prototype.setDebugDrawing=function(t){this._renderer.setDebugDrawing(t)},e.prototype._getMousePosition=function(t){var e=this._map,i=e.getContainer(),r=i.getBoundingClientRect();return[t.clientX-r.left-i.clientLeft,t.clientY-r.top-i.clientTop]},e}(L.Layer)},function(t,e,i){"use strict";i.d(e,"a",function(){return o});var r=i(3),n=(i.n(r),i(5)),o=function(){function t(t,e,i,r){void 0===r&&(r=!0);var o=this;this.update=function(){if(o._map){if(o._isRendering||o._isZooming)return void(o._needUpdate=!0);o._zoom=o._map.getZoom();var t=o._map.getCenter();Object(n.a)(o._origin,[t.lng,t.lat],o._zoom),o._origin[0]-=o._mapSize[0]/2,o._origin[1]-=o._mapSize[1]/2;var e=o._map.containerPointToLayerPoint([-o._bufferOffset[0],-o._bufferOffset[1]]).round();L.DomUtil.setPosition(o._hiddenFrame.canvas,e),o._render()}},this._onResize=function(){if(o._map){var t=o._map.getSize();o._pixelRatio=Math.min(Math.floor(window.devicePixelRatio),3),o._bufferOffset=[Math.round(t.x*o._bufferFactor),Math.round(t.y*o._bufferFactor)];var e=o._size=[t.x+2*o._bufferOffset[0],t.y+2*o._bufferOffset[1]];o._mapSize=[t.x,t.y],o._currentFrame.canvas.width=e[0]*o._pixelRatio,o._currentFrame.canvas.height=e[1]*o._pixelRatio,o._currentFrame.canvas.style.width=e[0]+"px",o._currentFrame.canvas.style.height=e[1]+"px",o._hiddenFrame.canvas.width=e[0]*o._pixelRatio,o._hiddenFrame.canvas.height=e[1]*o._pixelRatio,o._hiddenFrame.canvas.style.width=e[0]+"px",o._hiddenFrame.canvas.style.height=e[1]+"px"}},this._onZoomStart=function(){o.clear(),o._isZooming=!0},this._onMoveEnd=function(){o._isZooming=!1,o._updateOnMoveEnd&&o.update()},this._onMoveStart=function(){o._stopRendering()},this._renderLoop=function(){var t=o._lastRenderedMarker,e=Math.min(t+o._markersPerFrame,o._markers.length);if(t===e)return void o._renderFinish();var i=Object(n.b)();o._renderPart(t,e),o._lastRenderedMarker=e;var r=Object(n.b)()-i,a=r/(e-t);if(0!==a){var s=o._timePerFrame/a;o._markersPerFrame=Math.max(o._markersPerFrame+Math.floor((s-o._markersPerFrame)/5),100)}e!==o._markers.length?o._requestAnimationFrameId=requestAnimationFrame(o._renderLoop):o._renderFinish()},this._markers=[],this._markersData=[],this._isZooming=!1,this._debugDrawing=t,this._bufferFactor=e,this._updateOnMoveEnd=r,this._markersPerFrame=500,this._timePerFrame=10,this._origin=Object(n.c)(),this._vec=Object(n.c)(),this._lastRenderedMarker=0,this._needUpdate=!1,this.container=document.createElement("div"),i&&(this.container.style["z-index"]=i),this.container.style.position="absolute",this._currentFrame=this._createFrame(),this._hiddenFrame=this._createFrame()}return t.prototype.setAtlas=function(t){var e=this;t&&(this._atlas=t,this._atlas.whenReady().then(function(){e.update()}))},t.prototype.setMarkers=function(t){if(this._needUpdate=!1,this._stopRendering(),t.length>this._markersData.length){for(var e=[],i=0;i<t.length;i++)e[i]={index:i};this._markersData=e}this._markers=t,this.update()},t.prototype.onAddToMap=function(t){this._map=t,t.on({viewreset:this.update,movestart:this._onMoveStart,moveend:this._onMoveEnd,zoomstart:this._onZoomStart,resize:this._onResize}),this._onResize()},t.prototype.onRemoveFromMap=function(){this._map&&(this._map.off({viewreset:this.update,movestart:this._onMoveStart,moveend:this._onMoveEnd,zoomstart:this._onZoomStart,resize:this._onResize}),this._map=void 0,this._markersData=[],this._markers=[])},t.prototype.clear=function(){this._map&&(this._currentFrame.canvas.style.display="none",this._currentFrame.ctx.clearRect(0,0,this._size[0]*this._pixelRatio,this._size[1]*this._pixelRatio),this._currentFrame.tree.clear(),this._needUpdate=!1,this._isRendering&&(cancelAnimationFrame(this._requestAnimationFrameId),this._isRendering=!1))},t.prototype.search=function(t){var e=(t[0]+this._bufferOffset[0])*this._pixelRatio,i=(t[1]+this._bufferOffset[1])*this._pixelRatio;return this._currentFrame.tree.search({minX:e,minY:i,maxX:e,maxY:i}).map(function(t){return t.index})},t.prototype.setDebugDrawing=function(t){this._debugDrawing=t},t.prototype._stopRendering=function(){this._isRendering&&(cancelAnimationFrame(this._requestAnimationFrameId),this._isRendering=!1)},t.prototype._render=function(){this._map&&(this._hiddenFrame.tree.clear(),this._hiddenFrame.ctx.clearRect(0,0,this._size[0]*this._pixelRatio,this._size[1]*this._pixelRatio),this._isRendering=!0,this._lastRenderedMarker=0,this._renderLoop())},t.prototype._renderFinish=function(){this._isRendering=!1,this._switchFrames(),this._needUpdate&&(this._needUpdate=!1,this.update())},t.prototype._renderPart=function(t,e){var i=this._markers,r=this._markersData,o=this._atlas,a=this._debugDrawing,s=this._pixelRatio,h=this._size,u=this._hiddenFrame.ctx,c=this._vec,d=this._zoom,f=this._origin,m=this._bufferOffset;if(o.image){this._lastRenderedMarker=e;for(var _=[],p=t;p<e;p++){var l=i[p],v=r[p],g=o.sprites[l.iconIndex||0];if(g){var x=s/g.pixelDensity;if(Object(n.a)(c,l.position,d),c[0]=Math.round(c[0]),c[1]=Math.round(c[1]),c[0]=Math.round(c[0]-f[0])+m[0],c[1]=Math.round(c[1]-f[1])+m[1],c[0]=Math.round(c[0]*s-g.size[0]*x*g.anchor[0]),c[1]=Math.round(c[1]*s-g.size[1]*x*g.anchor[1]),!(c[0]<0||c[0]+g.size[0]*x>h[0]*s||c[1]<0||c[1]+g.size[1]*x>h[1]*s)){var M=g.interactiveMargin*x;v.minX=c[0]-M,v.minY=c[1]-M,v.maxX=c[0]+g.size[0]*x+M,v.maxY=c[1]+g.size[1]*x+M,_.push(v),u.drawImage(o.image,g.position[0],g.position[1],g.size[0],g.size[1],c[0],c[1],g.size[0]*x,g.size[1]*x),a&&this._debugDraw(l,c,g.size)}}}this._hiddenFrame.tree.load(_)}},t.prototype._debugDraw=function(t,e,i){var r=this._hiddenFrame.ctx,n=["#000000","#ff0000","#00ff00","#0000ff"],o=t.drawingOffsets;if(o)for(var a=0;a<o.length;a++){var s=o[a];r.beginPath(),r.strokeStyle=n[a],r.rect(e[0]-s,e[1]-s,i[0]+2*s,i[1]+2*s),r.stroke()}},t.prototype._createFrame=function(){var t=document.createElement("canvas");t.style.display="none",t.style.position="initial";var e=t.getContext("2d"),i=r();return this.container.appendChild(t),{canvas:t,ctx:e,tree:i}},t.prototype._switchFrames=function(){if(this._map){this._currentFrame.canvas.style.display="none",this._hiddenFrame.canvas.style.display="block";var t=this._currentFrame;this._currentFrame=this._hiddenFrame,this._hiddenFrame=t}},t}()},function(t,e,i){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function n(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r<e.length;r++)if(i(t,e[r]))return r;return-1}function o(t,e){a(t,0,t.children.length,e,t)}function a(t,e,i,r,n){n||(n=l(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var o,a=e;a<i;a++)o=t.children[a],s(n,t.leaf?r(o):o);return n}function s(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function h(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function d(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function m(t,e){var i=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,o-r)}function _(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function p(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function l(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,r,n){for(var o,a=[e,i];a.length;)i=a.pop(),e=a.pop(),i-e<=r||(o=e+Math.ceil((i-e)/r/2)*r,g(t,o,e,i,n),a.push(e,o,o,i))}t.exports=r,t.exports.default=r;var g=i(4);r.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!p(t,e))return i;for(var n,o,a,s,h=[];e;){for(n=0,o=e.children.length;n<o;n++)a=e.children[n],s=e.leaf?r(a):a,p(t,s)&&(e.leaf?i.push(a):_(t,s)?this._all(a,i):h.push(a));e=h.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!p(t,e))return!1;for(var r,n,o,a,s=[];e;){for(r=0,n=e.children.length;r<n;r++)if(o=e.children[r],a=e.leaf?i(o):o,p(t,a)){if(e.leaf||_(t,a))return!0;s.push(o)}e=s.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,i=t.length;e<i;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var n=this.data;this.data=r,r=n}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=l([]),this},remove:function(t,e){if(!t)return this;for(var i,r,o,a,s=this.data,h=this.toBBox(t),u=[],c=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],i=c.pop(),a=!0),s.leaf&&-1!==(o=n(t,s.children,e)))return s.children.splice(o,1),u.push(s),this._condense(u),this;a||s.leaf||!_(s,h)?r?(i++,s=r.children[i],a=!1):s=null:(u.push(s),c.push(i),i=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:h,compareMinY:u,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},_build:function(t,e,i,r){var n,a=i-e+1,s=this._maxEntries;if(a<=s)return n=l(t.slice(e,i+1)),o(n,this.toBBox),n;r||(r=Math.ceil(Math.log(a)/Math.log(s)),s=Math.ceil(a/Math.pow(s,r-1))),n=l([]),n.leaf=!1,n.height=r;var h,u,c,d,f=Math.ceil(a/s),m=f*Math.ceil(Math.sqrt(s));for(v(t,e,i,m,this.compareMinX),h=e;h<=i;h+=m)for(c=Math.min(h+m-1,i),v(t,h,c,f,this.compareMinY),u=h;u<=c;u+=f)d=Math.min(u+f-1,c),n.children.push(this._build(t,u,d,r-1));return o(n,this.toBBox),n},_chooseSubtree:function(t,e,i,r){for(var n,o,a,s,h,u,d,m;;){if(r.push(e),e.leaf||r.length-1===i)break;for(d=m=1/0,n=0,o=e.children.length;n<o;n++)a=e.children[n],h=c(a),u=f(t,a)-h,u<m?(m=u,d=h<d?h:d,s=a):u===m&&h<d&&(d=h,s=a);e=s||e.children[0]}return e},_insert:function(t,e,i){var r=this.toBBox,n=i?t:r(t),o=[],a=this._chooseSubtree(n,this.data,e,o);for(a.children.push(t),s(a,n);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r),s=l(i.children.splice(a,i.children.length-a));s.height=i.height,s.leaf=i.leaf,o(i,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(i,s)},_splitRoot:function(t,e){this.data=l([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,o,s,h,u,d,f;for(u=d=1/0,r=e;r<=i-e;r++)n=a(t,0,r,this.toBBox),o=a(t,r,i,this.toBBox),s=m(n,o),h=c(n)+c(o),s<u?(u=s,f=r,d=h<d?h:d):s===u&&h<d&&(d=h,f=r);return f},_chooseSplitAxis:function(t,e,i){var r=t.leaf?this.compareMinX:h,n=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,i,r)<this._allDistMargin(t,e,i,n)&&t.children.sort(r)},_allDistMargin:function(t,e,i,r){t.children.sort(r);var n,o,h=this.toBBox,u=a(t,0,e,h),c=a(t,i-e,i,h),f=d(u)+d(c);for(n=e;n<i-e;n++)o=t.children[n],s(u,t.leaf?h(o):o),f+=d(u);for(n=i-e-1;n>=e;n--)o=t.children[n],s(c,t.leaf?h(o):o),f+=d(c);return f},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--)s(e[r],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},function(t,e,i){!function(e,i){t.exports=i()}(0,function(){"use strict";function t(t,i,n,o,a){e(t,i,n||0,o||t.length-1,a||r)}function e(t,r,n,o,a){for(;o>n;){if(o-n>600){var s=o-n+1,h=r-n+1,u=Math.log(s),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(s-c)/s)*(h-s/2<0?-1:1);e(t,r,Math.max(n,Math.floor(r-h*c/s+d)),Math.min(o,Math.floor(r+(s-h)*c/s+d)),a)}var f=t[r],m=n,_=o;for(i(t,n,r),a(t[o],f)>0&&i(t,n,o);m<_;){for(i(t,m,_),m++,_--;a(t[m],f)<0;)m++;for(;a(t[_],f)>0;)_--}0===a(t[n],f)?i(t,n,_):(_++,i(t,_,o)),_<=r&&(n=_+1),r<=_&&(o=_-1)}}function i(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function r(t,e){return t<e?-1:t>e?1:0}return t})},function(t,e,i){"use strict";function r(){return new Float64Array(2)}function n(t,e,i){a(t,e),o(t,t,i)}function o(t,e,i){var r=256*Math.pow(2,i),n=.5/(Math.PI*s);t[0]=r*(n*e[0]+.5),t[1]=r*(-n*e[1]+.5)}function a(t,e){var i=Math.PI/180,r=Math.max(Math.min(h,e[1]),-h),n=Math.sin(r*i);t[0]=s*e[0]*i,t[1]=s*Math.log((1+n)/(1-n))/2}e.c=r,e.a=n,i.d(e,"b",function(){return u});var s=6378137,h=85.0511287798,u=window.performance&&window.performance.now?performance.now.bind(performance):Date.now.bind(Date)},function(t,e,i){"use strict";i.d(e,"a",function(){return n});var r=i(7),n=(i.n(r),function(){function t(t){var e=this;this.sprites=[],this._promise=Promise.all(t.map(function(t){return e._imageLoad(t.image)})).then(function(){return e._createSprite(t)})}return t.prototype.whenReady=function(){return this._promise},t.prototype._imageLoad=function(t){return t.complete?Promise.resolve():new Promise(function(e){t.addEventListener("load",e)})},t.prototype._createSprite=function(t){var e=t.map(function(t){var e=[t.image.width,t.image.height],i=t.size||e;return{width:i[0]+4,height:i[1]+4,image:t.image,anchor:t.anchor||[.5,.5],size:i,imageSize:e,interactiveMargin:t.interactiveMargin||0,pixelDensity:t.pixelDensity||1}}),i=r(e,{inPlace:!0});this.size=[i.width,i.height],this.sprites=e.map(function(t){return{position:[t.x+2,t.y+2],size:t.size,anchor:t.anchor,interactiveMargin:t.interactiveMargin,pixelDensity:t.pixelDensity}});var n=this.image=document.createElement("canvas"),o=n.getContext("2d");o&&(n.width=i.width,n.height=i.height,o.shadowColor="transparent",o.shadowBlur=0,e.forEach(function(t){o.drawImage(t.image,0,0,t.imageSize[0],t.imageSize[1],t.x+2,t.y+2,t.size[0],t.size[1])}))},t}())},function(t,e,i){"use strict";var r=i(8);t.exports=function(t,e){e=e||{};var i=new r,n=e.inPlace||!1,o=t.map(function(t){return n?t:{width:t.width,height:t.height,item:t}});o=o.sort(function(t,e){return e.width*e.height-t.width*t.height}),i.fit(o);var a=o.reduce(function(t,e){return Math.max(t,e.x+e.width)},0),s=o.reduce(function(t,e){return Math.max(t,e.y+e.height)},0),h={width:a,height:s};return n||(h.items=o),h}},function(t,e){var i=function(){};i.prototype={fit:function(t){var e,i,r,n,o=t.length,a=o>0?t[0].width:0,s=o>0?t[0].height:0;for(this.root={x:0,y:0,width:a,height:s},e=0;e<o;e++)r=t[e],(i=this.findNode(this.root,r.width,r.height))?(n=this.splitNode(i,r.width,r.height),r.x=n.x,r.y=n.y):(n=this.growNode(r.width,r.height),r.x=n.x,r.y=n.y)},findNode:function(t,e,i){return t.used?this.findNode(t.right,e,i)||this.findNode(t.down,e,i):e<=t.width&&i<=t.height?t:null},splitNode:function(t,e,i){return t.used=!0,t.down={x:t.x,y:t.y+i,width:t.width,height:t.height-i},t.right={x:t.x+e,y:t.y,width:t.width-e,height:i},t},growNode:function(t,e){var i=t<=this.root.width,r=e<=this.root.height,n=r&&this.root.height>=this.root.width+t,o=i&&this.root.width>=this.root.height+e;return n?this.growRight(t,e):o?this.growDown(t,e):r?this.growRight(t,e):i?this.growDown(t,e):null},growRight:function(t,e){this.root={used:!0,x:0,y:0,width:this.root.width+t,height:this.root.height,down:this.root,right:{x:this.root.width,y:0,width:t,height:this.root.height}};var i;return(i=this.findNode(this.root,t,e))?this.splitNode(i,t,e):null},growDown:function(t,e){this.root={used:!0,x:0,y:0,width:this.root.width,height:this.root.height+e,down:{x:0,y:this.root.height,width:this.root.width,height:e},right:this.root};var i;return(i=this.findNode(this.root,t,e))?this.splitNode(i,t,e):null}},t.exports=i}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MarkerDrawer=e():t.MarkerDrawer=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(1);i.d(e,"MarkerDrawer",function(){return n.a});var r=i(6);i.d(e,"Atlas",function(){return r.a})},function(t,e,i){"use strict";i.d(e,"a",function(){return o});var n=i(2),r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),o=function(t){function e(e){void 0===e&&(e={});var i=t.call(this)||this;return i._onClick=function(t){if(i._isValidData){var e=i._getMousePosition(t),n=i._renderer.search(e);if(n.length){t.stopPropagation();var r={originalEvent:t,marker:Math.max.apply(Math,n)};i.fire("click",r)}}},i._onMouseLeave=function(t){if(!i._isZooming&&void 0!==i._hoveredMarker){var e={originalEvent:t,marker:i._hoveredMarker};i.fire("mouseout",e),i._hoveredMarker=void 0}},i._onMouseMove=function(t){if(!i._isValidData)return void(i._duringInvalidTreeLastEvent=t);var e=i._getMousePosition(t),n=i._renderer.search(e),r={originalEvent:t,marker:0};if(n.length){var o=Math.max.apply(Math,n);if(void 0!==i._hoveredMarker){if(i._hoveredMarker===o)return;r.marker=i._hoveredMarker,i.fire("mouseout",r)}i._hoveredMarker=o,r.marker=i._hoveredMarker,i.fire("mouseover",r)}else void 0!==i._hoveredMarker&&(r.marker=i._hoveredMarker,i.fire("mouseout",r),i._hoveredMarker=void 0)},i._onMouseDown=function(t){if(i._isValidData){var e=i._getMousePosition(t),n=i._renderer.search(e);if(n.length){i._clickedMarker=Math.max.apply(Math,n);var r={originalEvent:t,marker:i._clickedMarker};i.fire("mousedown",r)}}},i._onMouseUp=function(t){if(void 0!==i._clickedMarker){var e={originalEvent:t,marker:i._clickedMarker};i.fire("mouseup",e),i._clickedMarker=void 0}},i._onMouseWheel=function(t){i._duringInvalidTreeLastEvent=t},i._onDblClick=function(t){i._duringInvalidTreeLastEvent=t},i._onZoomStart=function(){i._isZooming=!0},i._onMoveEnd=function(){i._isZooming=!1},i._renderer=new n.a(e.debugDrawing||!1,void 0!==e.bufferFactor?e.bufferFactor:.5,e.zIndex,e.updateOnMoveEnd),i._isZooming=!1,i._isValidData=!0,i._renderer.on("invalidtree",function(){i._isValidData=!1}),i._renderer.on("validtree",function(){i._isValidData||(i._isValidData=!0,i._duringInvalidTreeLastEvent&&(i._onMouseMove(i._duringInvalidTreeLastEvent),i._duringInvalidTreeLastEvent=void 0))}),i}return r(e,t),e.prototype.setAtlas=function(t){this._renderer.setAtlas(t)},e.prototype.setMarkers=function(t){this._renderer.setMarkers(t)},e.prototype.update=function(){this._renderer.update()},e.prototype.addTo=function(t){return t.addLayer(this),this},e.prototype.onAdd=function(){return this._map?(this._pane=this._map.getPane("overlayPane"),this._renderer.onAddToMap(this._map),this._pane.addEventListener("click",this._onClick),this._pane.addEventListener("mousemove",this._onMouseMove),this._pane.addEventListener("mouseleave",this._onMouseLeave),this._pane.addEventListener("mousedown",this._onMouseDown),this._pane.addEventListener("mouseup",this._onMouseUp),this._pane.addEventListener("wheel",this._onMouseWheel),this._pane.addEventListener("dblclick",this._onDblClick),this._map.on({zoomstart:this._onZoomStart,moveend:this._onMoveEnd}),this._pane.appendChild(this._renderer.container),this):this},e.prototype.remove=function(){return this._map&&this._map.removeLayer(this),this},e.prototype.onRemove=function(){return this._pane.removeChild(this._renderer.container),this._renderer.onRemoveFromMap(),this._pane.removeEventListener("click",this._onClick),this._pane.removeEventListener("mousemove",this._onMouseMove),this._pane.removeEventListener("mouseleave",this._onMouseLeave),this._pane.removeEventListener("mousedown",this._onMouseDown),this._pane.removeEventListener("mouseup",this._onMouseUp),this._pane.removeEventListener("wheel",this._onMouseWheel),this._pane.removeEventListener("dblclick",this._onDblClick),this._map.off({zoomstart:this._onZoomStart,moveend:this._onMoveEnd}),this},e.prototype.setDebugDrawing=function(t){this._renderer.setDebugDrawing(t)},e.prototype._getMousePosition=function(t){var e=this._map,i=e.getContainer(),n=i.getBoundingClientRect();return[t.clientX-n.left-i.clientLeft,t.clientY-n.top-i.clientTop]},e}(L.Layer)},function(t,e,i){"use strict";i.d(e,"a",function(){return a});var n=i(3),r=(i.n(n),i(5)),o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),a=function(t){function e(e,i,n,o){void 0===o&&(o=!0);var a=t.call(this)||this;return a.update=function(){if(a._map){if(a._isRendering||a._isZooming)return void(a._needUpdate=!0);a._zoom=a._map.getZoom();var t=a._map.getCenter();Object(r.a)(a._origin,[t.lng,t.lat],a._zoom),a._origin[0]-=a._mapSize[0]/2,a._origin[1]-=a._mapSize[1]/2;var e=a._map.containerPointToLayerPoint([-a._bufferOffset[0],-a._bufferOffset[1]]).round();L.DomUtil.setPosition(a._hiddenFrame.canvas,e),a._render()}},a._onResize=function(){if(a._map){var t=a._map.getSize();a._pixelRatio=Math.min(Math.floor(window.devicePixelRatio),3),a._bufferOffset=[Math.round(t.x*a._bufferFactor),Math.round(t.y*a._bufferFactor)];var e=a._size=[t.x+2*a._bufferOffset[0],t.y+2*a._bufferOffset[1]];a._mapSize=[t.x,t.y],a._currentFrame.canvas.width=e[0]*a._pixelRatio,a._currentFrame.canvas.height=e[1]*a._pixelRatio,a._currentFrame.canvas.style.width=e[0]+"px",a._currentFrame.canvas.style.height=e[1]+"px",a._hiddenFrame.canvas.width=e[0]*a._pixelRatio,a._hiddenFrame.canvas.height=e[1]*a._pixelRatio,a._hiddenFrame.canvas.style.width=e[0]+"px",a._hiddenFrame.canvas.style.height=e[1]+"px"}},a._onZoomStart=function(){a.clear(),a._isZooming=!0},a._onMoveEnd=function(){a._isZooming=!1,a._updateOnMoveEnd&&a.update()},a._onMoveStart=function(){a.fire("invalidtree"),a._stopRendering()},a._renderLoop=function(){var t=a._lastRenderedMarker,e=Math.min(t+a._markersPerFrame,a._markers.length);if(t===e)return void a._renderFinish();var i=Object(r.b)();a._renderPart(t,e),a._lastRenderedMarker=e;var n=Object(r.b)()-i,o=n/(e-t);if(0!==o){var s=a._timePerFrame/o;a._markersPerFrame=Math.max(a._markersPerFrame+Math.floor((s-a._markersPerFrame)/5),100)}e!==a._markers.length?a._requestAnimationFrameId=requestAnimationFrame(a._renderLoop):a._renderFinish()},a._markers=[],a._markersData=[],a._isZooming=!1,a._debugDrawing=e,a._bufferFactor=i,a._updateOnMoveEnd=o,a._markersPerFrame=500,a._timePerFrame=10,a._origin=Object(r.c)(),a._vec=Object(r.c)(),a._lastRenderedMarker=0,a._needUpdate=!1,a.container=document.createElement("div"),n&&(a.container.style["z-index"]=n),a.container.style.position="absolute",a._currentFrame=a._createFrame(),a._hiddenFrame=a._createFrame(),a}return o(e,t),e.prototype.setAtlas=function(t){var e=this;t&&(this._atlas=t,this._atlas.whenReady().then(function(){e.update()}))},e.prototype.setMarkers=function(t){if(this._needUpdate=!1,this._stopRendering(),t.length>this._markersData.length){for(var e=[],i=0;i<t.length;i++)e[i]={index:i};this._markersData=e}this._markers=t,this.update()},e.prototype.onAddToMap=function(t){this._map=t,t.on({viewreset:this.update,movestart:this._onMoveStart,moveend:this._onMoveEnd,zoomstart:this._onZoomStart,resize:this._onResize}),this._onResize()},e.prototype.onRemoveFromMap=function(){this._map&&(this._map.off({viewreset:this.update,movestart:this._onMoveStart,moveend:this._onMoveEnd,zoomstart:this._onZoomStart,resize:this._onResize}),this._map=void 0,this._markersData=[],this._markers=[])},e.prototype.clear=function(){this._map&&(this._currentFrame.canvas.style.display="none",this._currentFrame.ctx.clearRect(0,0,this._size[0]*this._pixelRatio,this._size[1]*this._pixelRatio),this._currentFrame.tree.clear(),this._needUpdate=!1,this._isRendering&&(cancelAnimationFrame(this._requestAnimationFrameId),this._isRendering=!1))},e.prototype.search=function(t){var e=(t[0]+this._bufferOffset[0])*this._pixelRatio,i=(t[1]+this._bufferOffset[1])*this._pixelRatio;return this._currentFrame.tree.search({minX:e,minY:i,maxX:e,maxY:i}).map(function(t){return t.index})},e.prototype.setDebugDrawing=function(t){this._debugDrawing=t},e.prototype._stopRendering=function(){this._isRendering&&(cancelAnimationFrame(this._requestAnimationFrameId),this._isRendering=!1)},e.prototype._render=function(){this._map&&(this._hiddenFrame.tree.clear(),this._hiddenFrame.ctx.clearRect(0,0,this._size[0]*this._pixelRatio,this._size[1]*this._pixelRatio),this._isRendering=!0,this._lastRenderedMarker=0,this._renderLoop())},e.prototype._renderFinish=function(){this._isRendering=!1,this._switchFrames(),this._needUpdate?(this._needUpdate=!1,this.update()):this.fire("validtree")},e.prototype._renderPart=function(t,e){var i=this._markers,n=this._markersData,o=this._atlas,a=this._debugDrawing,s=this._pixelRatio,h=this._size,u=this._hiddenFrame.ctx,d=this._vec,c=this._zoom,f=this._origin,_=this._bufferOffset;if(o.image){this._lastRenderedMarker=e;for(var m=[],l=t;l<e;l++){var p=i[l],v=n[l],g=o.sprites[p.iconIndex||0];if(g){var x=s/g.pixelDensity;if(Object(r.a)(d,p.position,c),d[0]=Math.round(d[0]),d[1]=Math.round(d[1]),d[0]=Math.round(d[0]-f[0])+_[0],d[1]=Math.round(d[1]-f[1])+_[1],d[0]=Math.round(d[0]*s-g.size[0]*x*g.anchor[0]),d[1]=Math.round(d[1]*s-g.size[1]*x*g.anchor[1]),!(d[0]<0||d[0]+g.size[0]*x>h[0]*s||d[1]<0||d[1]+g.size[1]*x>h[1]*s)){var M=g.interactiveMargin*x;v.minX=d[0]-M,v.minY=d[1]-M,v.maxX=d[0]+g.size[0]*x+M,v.maxY=d[1]+g.size[1]*x+M,m.push(v),u.drawImage(o.image,g.position[0],g.position[1],g.size[0],g.size[1],d[0],d[1],g.size[0]*x,g.size[1]*x),a&&this._debugDraw(p,d,g.size)}}}this._hiddenFrame.tree.load(m)}},e.prototype._debugDraw=function(t,e,i){var n=this._hiddenFrame.ctx,r=["#000000","#ff0000","#00ff00","#0000ff"],o=t.drawingOffsets;if(o)for(var a=0;a<o.length;a++){var s=o[a];n.beginPath(),n.strokeStyle=r[a],n.rect(e[0]-s,e[1]-s,i[0]+2*s,i[1]+2*s),n.stroke()}},e.prototype._createFrame=function(){var t=document.createElement("canvas");t.style.display="none",t.style.position="initial";var e=t.getContext("2d"),i=n();return this.container.appendChild(t),{canvas:t,ctx:e,tree:i}},e.prototype._switchFrames=function(){if(this._map){this._currentFrame.canvas.style.display="none",this._hiddenFrame.canvas.style.display="block";var t=this._currentFrame;this._currentFrame=this._hiddenFrame,this._hiddenFrame=t}},e}(L.Evented)},function(t,e,i){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function o(t,e){a(t,0,t.children.length,e,t)}function a(t,e,i,n,r){r||(r=p(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(var o,a=e;a<i;a++)o=t.children[a],s(r,t.leaf?n(o):o);return r}function s(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function h(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function d(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function _(t,e){var i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,o-n)}function m(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function l(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,n,r){for(var o,a=[e,i];a.length;)i=a.pop(),e=a.pop(),i-e<=n||(o=e+Math.ceil((i-e)/n/2)*n,g(t,o,e,i,r),a.push(e,o,o,i))}t.exports=n,t.exports.default=n;var g=i(4);n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!l(t,e))return i;for(var r,o,a,s,h=[];e;){for(r=0,o=e.children.length;r<o;r++)a=e.children[r],s=e.leaf?n(a):a,l(t,s)&&(e.leaf?i.push(a):m(t,s)?this._all(a,i):h.push(a));e=h.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!l(t,e))return!1;for(var n,r,o,a,s=[];e;){for(n=0,r=e.children.length;n<r;n++)if(o=e.children[n],a=e.leaf?i(o):o,l(t,a)){if(e.leaf||m(t,a))return!0;s.push(o)}e=s.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,i=t.length;e<i;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=p([]),this},remove:function(t,e){if(!t)return this;for(var i,n,o,a,s=this.data,h=this.toBBox(t),u=[],d=[];s||u.length;){if(s||(s=u.pop(),n=u[u.length-1],i=d.pop(),a=!0),s.leaf&&-1!==(o=r(t,s.children,e)))return s.children.splice(o,1),u.push(s),this._condense(u),this;a||s.leaf||!m(s,h)?n?(i++,s=n.children[i],a=!1):s=null:(u.push(s),d.push(i),i=0,n=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:h,compareMinY:u,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},_build:function(t,e,i,n){var r,a=i-e+1,s=this._maxEntries;if(a<=s)return r=p(t.slice(e,i+1)),o(r,this.toBBox),r;n||(n=Math.ceil(Math.log(a)/Math.log(s)),s=Math.ceil(a/Math.pow(s,n-1))),r=p([]),r.leaf=!1,r.height=n;var h,u,d,c,f=Math.ceil(a/s),_=f*Math.ceil(Math.sqrt(s));for(v(t,e,i,_,this.compareMinX),h=e;h<=i;h+=_)for(d=Math.min(h+_-1,i),v(t,h,d,f,this.compareMinY),u=h;u<=d;u+=f)c=Math.min(u+f-1,d),r.children.push(this._build(t,u,c,n-1));return o(r,this.toBBox),r},_chooseSubtree:function(t,e,i,n){for(var r,o,a,s,h,u,c,_;;){if(n.push(e),e.leaf||n.length-1===i)break;for(c=_=1/0,r=0,o=e.children.length;r<o;r++)a=e.children[r],h=d(a),u=f(t,a)-h,u<_?(_=u,c=h<c?h:c,s=a):u===_&&h<c&&(c=h,s=a);e=s||e.children[0]}return e},_insert:function(t,e,i){var n=this.toBBox,r=i?t:n(t),o=[],a=this._chooseSubtree(r,this.data,e,o);for(a.children.push(t),s(a,r);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(r,o,e)},_split:function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var a=this._chooseSplitIndex(i,r,n),s=p(i.children.splice(a,i.children.length-a));s.height=i.height,s.leaf=i.leaf,o(i,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(i,s)},_splitRoot:function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,r,o,s,h,u,c,f;for(u=c=1/0,n=e;n<=i-e;n++)r=a(t,0,n,this.toBBox),o=a(t,n,i,this.toBBox),s=_(r,o),h=d(r)+d(o),s<u?(u=s,f=n,c=h<c?h:c):s===u&&h<c&&(c=h,f=n);return f},_chooseSplitAxis:function(t,e,i){var n=t.leaf?this.compareMinX:h,r=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)},_allDistMargin:function(t,e,i,n){t.children.sort(n);var r,o,h=this.toBBox,u=a(t,0,e,h),d=a(t,i-e,i,h),f=c(u)+c(d);for(r=e;r<i-e;r++)o=t.children[r],s(u,t.leaf?h(o):o),f+=c(u);for(r=i-e-1;r>=e;r--)o=t.children[r],s(d,t.leaf?h(o):o),f+=c(d);return f},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)s(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},function(t,e,i){!function(e,i){t.exports=i()}(0,function(){"use strict";function t(t,i,r,o,a){e(t,i,r||0,o||t.length-1,a||n)}function e(t,n,r,o,a){for(;o>r;){if(o-r>600){var s=o-r+1,h=n-r+1,u=Math.log(s),d=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*d*(s-d)/s)*(h-s/2<0?-1:1);e(t,n,Math.max(r,Math.floor(n-h*d/s+c)),Math.min(o,Math.floor(n+(s-h)*d/s+c)),a)}var f=t[n],_=r,m=o;for(i(t,r,n),a(t[o],f)>0&&i(t,r,o);_<m;){for(i(t,_,m),_++,m--;a(t[_],f)<0;)_++;for(;a(t[m],f)>0;)m--}0===a(t[r],f)?i(t,r,m):(m++,i(t,m,o)),m<=n&&(r=m+1),n<=m&&(o=m-1)}}function i(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function n(t,e){return t<e?-1:t>e?1:0}return t})},function(t,e,i){"use strict";function n(){return new Float64Array(2)}function r(t,e,i){a(t,e),o(t,t,i)}function o(t,e,i){var n=256*Math.pow(2,i),r=.5/(Math.PI*s);t[0]=n*(r*e[0]+.5),t[1]=n*(-r*e[1]+.5)}function a(t,e){var i=Math.PI/180,n=Math.max(Math.min(h,e[1]),-h),r=Math.sin(n*i);t[0]=s*e[0]*i,t[1]=s*Math.log((1+r)/(1-r))/2}e.c=n,e.a=r,i.d(e,"b",function(){return u});var s=6378137,h=85.0511287798,u=window.performance&&window.performance.now?performance.now.bind(performance):Date.now.bind(Date)},function(t,e,i){"use strict";i.d(e,"a",function(){return r});var n=i(7),r=(i.n(n),function(){function t(t){var e=this;this.sprites=[],this._promise=Promise.all(t.map(function(t){return e._imageLoad(t.image)})).then(function(){return e._createSprite(t)})}return t.prototype.whenReady=function(){return this._promise},t.prototype._imageLoad=function(t){return t.complete?Promise.resolve():new Promise(function(e){t.addEventListener("load",e)})},t.prototype._createSprite=function(t){var e=t.map(function(t){var e=[t.image.width,t.image.height],i=t.size||e;return{width:i[0]+4,height:i[1]+4,image:t.image,anchor:t.anchor||[.5,.5],size:i,imageSize:e,interactiveMargin:t.interactiveMargin||0,pixelDensity:t.pixelDensity||1}}),i=n(e,{inPlace:!0});this.size=[i.width,i.height],this.sprites=e.map(function(t){return{position:[t.x+2,t.y+2],size:t.size,anchor:t.anchor,interactiveMargin:t.interactiveMargin,pixelDensity:t.pixelDensity}});var r=this.image=document.createElement("canvas"),o=r.getContext("2d");o&&(r.width=i.width,r.height=i.height,o.shadowColor="transparent",o.shadowBlur=0,e.forEach(function(t){o.drawImage(t.image,0,0,t.imageSize[0],t.imageSize[1],t.x+2,t.y+2,t.size[0],t.size[1])}))},t}())},function(t,e,i){"use strict";var n=i(8);t.exports=function(t,e){e=e||{};var i=new n,r=e.inPlace||!1,o=t.map(function(t){return r?t:{width:t.width,height:t.height,item:t}});o=o.sort(function(t,e){return e.width*e.height-t.width*t.height}),i.fit(o);var a=o.reduce(function(t,e){return Math.max(t,e.x+e.width)},0),s=o.reduce(function(t,e){return Math.max(t,e.y+e.height)},0),h={width:a,height:s};return r||(h.items=o),h}},function(t,e){var i=function(){};i.prototype={fit:function(t){var e,i,n,r,o=t.length,a=o>0?t[0].width:0,s=o>0?t[0].height:0;for(this.root={x:0,y:0,width:a,height:s},e=0;e<o;e++)n=t[e],(i=this.findNode(this.root,n.width,n.height))?(r=this.splitNode(i,n.width,n.height),n.x=r.x,n.y=r.y):(r=this.growNode(n.width,n.height),n.x=r.x,n.y=r.y)},findNode:function(t,e,i){return t.used?this.findNode(t.right,e,i)||this.findNode(t.down,e,i):e<=t.width&&i<=t.height?t:null},splitNode:function(t,e,i){return t.used=!0,t.down={x:t.x,y:t.y+i,width:t.width,height:t.height-i},t.right={x:t.x+e,y:t.y,width:t.width-e,height:i},t},growNode:function(t,e){var i=t<=this.root.width,n=e<=this.root.height,r=n&&this.root.height>=this.root.width+t,o=i&&this.root.width>=this.root.height+e;return r?this.growRight(t,e):o?this.growDown(t,e):n?this.growRight(t,e):i?this.growDown(t,e):null},growRight:function(t,e){this.root={used:!0,x:0,y:0,width:this.root.width+t,height:this.root.height,down:this.root,right:{x:this.root.width,y:0,width:t,height:this.root.height}};var i;return(i=this.findNode(this.root,t,e))?this.splitNode(i,t,e):null},growDown:function(t,e){this.root={used:!0,x:0,y:0,width:this.root.width,height:this.root.height+e,down:{x:0,y:this.root.height,width:this.root.width,height:e},right:this.root};var i;return(i=this.findNode(this.root,t,e))?this.splitNode(i,t,e):null}},t.exports=i}])});
//# sourceMappingURL=markerdrawer.js.map
import { Atlas } from './Atlas';
import { Marker, IRenderer, Vec2 } from './types';
export declare class CanvasRenderer implements IRenderer {
export declare class CanvasRenderer extends L.Evented implements IRenderer {
container: HTMLDivElement;

@@ -5,0 +5,0 @@ private _atlas;

@@ -17,2 +17,5 @@ import { Atlas } from './Atlas';

private _clickedMarker?;
private _duringInvalidTreeLastEvent?;
private _isValidData;
private _isZooming;
constructor(options?: MarkerDrawerOptions);

@@ -32,3 +35,19 @@ setAtlas(atlas: Atlas): void;

private _onMouseUp;
/**
* События, вызывающие movestart у карты, сохраняются на случай, когда
* во время невалидности rbush не происходит движение мышью, поскольку в таком
* случае будет невозможно определить местоположение курсора мыши, тем самым
* данная ситуация будет обработана некорректно.
*/
private _onMouseWheel;
/**
* События, вызывающие movestart у карты, сохраняются на случай, когда
* во время невалидности rbush не происходит движение мышью, поскольку в таком
* случае будет невозможно определить местоположение курсора мыши, тем самым
* данная ситуация будет обработана некорректно.
*/
private _onDblClick;
private _onZoomStart;
private _onMoveEnd;
private _getMousePosition;
}
{
"name": "@2gis/markerdrawer",
"version": "1.0.0",
"version": "1.0.1",
"description": "Library for fast drawing a huge amount of markers",

@@ -5,0 +5,0 @@ "author": {

@@ -32,2 +32,7 @@ declare namespace L {

class Evented {
fire(type: string, data?: any, propagate?: boolean): this;
on(type: string, fn: Function, context?: any): this;
}
namespace DomUtil {

@@ -34,0 +39,0 @@ function setPosition(el: HTMLElement, position: Point): void;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc