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 0.0.14 to 1.0.0

.vscode/settings.json

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=window.devicePixelRatio,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);0!==a&&(o._markersPerFrame=Math.max(Math.floor((o._markersPerFrame+o._timePerFrame/a)/2),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=1e3,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(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}])});
//# sourceMappingURL=markerdrawer.js.map
{
"name": "@2gis/markerdrawer",
"version": "0.0.14",
"version": "1.0.0",
"description": "Library for fast drawing a huge amount of markers",

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

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