@arenarium/maps 1.0.183 → 1.0.185

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.
@@ -320,7 +320,7 @@ var y;
320
320
  const t = i.neighbours;
321
321
  for (let n = 0; n < t.length; n++) {
322
322
  const o = t[n], e = o.neighbours.indexOf(i);
323
- o.neighbours.splice(e, 1);
323
+ o.neighbours.splice(e, 1), o.influences.splice(e, 1);
324
324
  }
325
325
  }
326
326
  a.updateCollapsed = u;
@@ -1 +1 @@
1
- "use strict";var _=Object.defineProperty;var U=(l,g,A)=>g in l?_(l,g,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[g]=A;var m=(l,g,A)=>U(l,typeof g!="symbol"?g+"":g,A);exports.Rectangle=void 0;(l=>{function g(A,d,h){const b=A/2,p=d/2,c=Math.sqrt(b*b+p*p),u=Math.atan(p/b)*(180/Math.PI),a=h*(Math.PI/180);return h<180?h<90?h<u?{offsetX:0,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:0}:h<180-u?{offsetX:c*Math.cos(a)-b,offsetY:0}:{offsetX:-A,offsetY:c*Math.sin(a)-p}:h<270?h<180+u?{offsetX:-A,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:-d}:h<360-u?{offsetX:c*Math.cos(a)-b,offsetY:-d}:{offsetX:0,offsetY:c*Math.sin(a)-p}}l.getOffsets=g})(exports.Rectangle||(exports.Rectangle={}));exports.Mercator=void 0;(l=>{function g(c,u,a){return{x:d(u)*a,y:h(c)*a}}l.project=g;function A(c,u,a){return{lat:p(u/a),lng:b(c/a)}}l.unproject=A;function d(c){return(180+c)/360}function h(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function b(c){return c*360-180}function p(c){return 360/Math.PI*Math.atan(Math.exp((180-c*360)*Math.PI/180))-90}})(exports.Mercator||(exports.Mercator={}));exports.Angles=void 0;(l=>{l.COUNT=12,l.DEFAULT=270,l.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(exports.Angles||(exports.Angles={}));var T;(l=>{let g;(p=>{p.RADIANS=exports.Angles.DEGREES.map(a=>a*Math.PI/180),p.RADIANS_COS=p.RADIANS.map(a=>Math.cos(a)),p.RADIANS_SIN=p.RADIANS.map(a=>Math.sin(a));function c(a,M){const I=Math.abs(M/a);return I<1?I<.26795?0:1:I<3.73205?2:3}function u(a,M){const I=c(a,M);return a>0?M>0?(12-I)%12:0+I:M>0?6+I:6-I}p.getAngleIndex=u})(g=l.Angle||(l.Angle={}));class A{constructor(c,u,a,M){m(this,"center");m(this,"width");m(this,"height");m(this,"index");this.center=c,this.width=u,this.height=a,this.index=M}}l.Particle=A;function d(p){let c=!0;for(let u=0;u<p.length;u++){const{particle:a,influences:M}=p[u],I=a.index,D=a.center,N=a.width,P=a.height,i=b(I,-1),t=b(I,1),n=D.x+N*g.RADIANS_COS[i],o=D.y+P*g.RADIANS_SIN[i],e=D.x+N*g.RADIANS_COS[I],r=D.y+P*g.RADIANS_SIN[I],s=D.x+N*g.RADIANS_COS[t],f=D.y+P*g.RADIANS_SIN[t];let x=0,v=0,w=0;for(let z=0;z<M.length;z++){const S=M[z],R=S.index,E=S.center,G=S.width,W=S.height,B=E.x+G*g.RADIANS_COS[R],C=E.y+W*g.RADIANS_SIN[R],j=n-B,X=o-C;x+=1/(j*j+X*X);const Y=e-B,Z=r-C;v+=1/(Y*Y+Z*Z);const k=s-B,F=f-C;w+=1/(k*k+F*F)}let O=0;x<v&&x<w&&(O=-1),w<v&&w<x&&(O=1),O!=0&&(a.index=b(I,O),c=!1)}return c}l.updatePointIndexes=d;function h(p){for(let c=0;c<p.length;c++){const{particle:u,influences:a}=p[c],M=u.center;let I=0,D=0;for(let N=0;N<a.length;N++){const i=a[N].center,t=M.x-i.x,n=M.y-i.y;if(t==0&&n==0)continue;const o=Math.sqrt(t*t+n*n),e=1/(o*o);I+=e*t/o,D+=-(e*n)/o}u.index=g.getAngleIndex(I,D)}}l.initializePointIndexes=h;function b(p,c){return c==0?p:((p+c)%exports.Angles.COUNT+exports.Angles.COUNT)%exports.Angles.COUNT}})(T||(T={}));exports.Bounds=void 0;(l=>{function g(d,h){return!(d.x-d.left>h.x+h.right||d.x+d.right<h.x-h.left||d.y-d.top>h.y+h.bottom||d.y+d.bottom<h.y-h.top)}l.areOverlaping=g;function A(d,h){let b=Math.abs(d.x-h.x),c=(d.x<h.x?d.right+h.left:d.left+h.right)/b,u=Math.abs(d.y-h.y),M=(d.y<h.y?d.bottom+h.top:d.top+h.bottom)/u,I=Math.min(c,M);return Math.log2(I)}l.getZoomWhenTouching=A})(exports.Bounds||(exports.Bounds={}));var y;(l=>{class g{constructor(){m(this,"zoomAfterExpanded");m(this,"zoomAfterAngleIndexes");this.zoomAfterExpanded=NaN,this.zoomAfterAngleIndexes=[]}}l.Tooltip=g;class A{constructor(t,n,o){m(this,"index");m(this,"id");m(this,"rank");m(this,"x");m(this,"y");m(this,"width");m(this,"height");m(this,"expanded");m(this,"angle");m(this,"bounds");m(this,"neighbours");m(this,"particle");m(this,"influences");const e=exports.Mercator.project(n.lat,n.lng,t.mapSize),r=n.width+2*n.margin,s=n.height+2*n.margin;this.index=o,this.id=n.id,this.rank=n.rank,this.x=e.x,this.y=e.y,this.width=r,this.height=s,this.expanded=!0,this.angle=exports.Angles.DEFAULT,this.bounds=this.getBounds(1),this.neighbours=new Array,this.particle=new T.Particle({x:e.x,y:e.y},this.getParticleWidth(1),this.getParticleHeight(1),exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)),this.influences=[]}getBounds(t){let{offsetX:n,offsetY:o}=exports.Rectangle.getOffsets(this.width,this.height,this.angle),e=-n,r=this.width-e,s=-o,f=this.height-s;return{x:this.x,y:this.y,left:e/t,right:r/t,top:s/t,bottom:f/t}}getParticleWidth(t){return this.width/2/t}getParticleHeight(t){return this.height/2/t}updateBounds(t){this.bounds=this.getBounds(t)}updateParticle(t){this.particle.width=this.getParticleWidth(t),this.particle.height=this.getParticleHeight(t)}}l.Node=A;class d{constructor(t){m(this,"min");m(this,"max");m(this,"scale");m(this,"step");this.min=t.zoomMin,this.max=t.zoomMax,this.scale=t.zoomScale,this.step=1/this.scale}addSteps(t,n){return Math.round((t+n*this.step)*this.scale)/this.scale}getIndex(t){if(!(t<this.min))return Math.min(Math.ceil(t*this.scale),this.max*this.scale)}getMax(t){let n=this.min;for(let o=0;o<t.length;o++){const r=t[o].keys();for(const s of r){const f=Number(s)/this.scale;f>n&&(n=f)}}return n}}l.Zoom=d;function h(i,t){let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=new A(i,t[o],o);return n}l.createNodes=h;function b(i,t){const n=new Array;for(let e=0;e<t.length;e++)n[e]=new Array;const o=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e];o[e]={x:r.x,y:r.y,left:r.width,right:r.width,top:r.height,bottom:r.height}}for(let e=0;e<t.length;e++){const r=t[e],s=o[e],f=n[e];for(let x=e+1;x<t.length;x++){const v=t[x],w=o[x],O=n[x],z=exports.Bounds.getZoomWhenTouching(s,w),S=i.getIndex(z);if(S==null)continue;const R=f[S],E=O[S];R?R.push(v):f[S]=[v],E?E.push(r):O[S]=[r]}}return n}l.createNeighbourDeltas=b;function p(i){const t=new Set,n=[];for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1||e.neighbours.length==0||t.has(e))continue;t.add(e);const r=[],s=[e];for(;s.length>0;){const f=s.pop();r.push(f);for(const x of f.neighbours)t.has(x)||(t.add(x),s.push(x))}n.push(r)}return n}l.getNeighbourGraphs=p;function c(i,t,n){for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1){e.neighbours.length=0,e.influences.length=0;continue}const s=t[o][n];if(s!=null)for(let f=0;f<s.length;f++){const x=s[f];x.expanded!=!1&&(e.neighbours.push(x),e.influences.push(x.particle))}}}l.updateNeighbours=c;function u(i){i.expanded=!1;const t=i.neighbours;for(let n=0;n<t.length;n++){const o=t[n],e=o.neighbours.indexOf(i);o.neighbours.splice(e,1)}}l.updateCollapsed=u;function a(i,t,n){for(let o=0;o<i.length;o++){const e=i[o];if(e.expanded==!1)continue;const r=t.get(e.id);if(!r)throw new Error("Tooltip not found");r.zoomAfterExpanded=n;const s=exports.Angles.DEGREES.indexOf(e.angle);r.zoomAfterAngleIndexes.length==0?r.zoomAfterAngleIndexes.push([n,s]):r.zoomAfterAngleIndexes[0][1]!=s?r.zoomAfterAngleIndexes.unshift([n,s]):r.zoomAfterAngleIndexes[0][0]=n}}l.updateTooltips=a;function M(i,t){for(let n=0;n<i.length;n++)i[n].updateBounds(t)}l.updateBounds=M;function I(i){const t=new Set;for(let n=0;n<i.length;n++){const o=i[n],e=o.bounds,r=i[n].neighbours;for(let s=0;s<r.length;s++){const f=r[s],x=f.bounds;exports.Bounds.areOverlaping(x,e)&&(t.add(o),t.add(f))}}return t}l.getOverlaps=I;function D(i,t){let n=!1;for(let o=0;o<t.length;o++){const e=t[o],r=e.bounds,s=t[o].neighbours;for(let f=0;f<s.length;f++){const x=s[f],v=x.bounds;exports.Bounds.areOverlaping(v,r)&&(i.has(e)||(i.add(e),n=!0),i.has(x)||(i.add(x),n=!0))}}return n}l.updateOverlaps=D;function N(i){let t,n=0;for(let o=0;o<i.length;o++){const e=i[o],r=e.bounds,s=i[o].neighbours;let f=0;for(let x=0;x<s.length;x++){const v=s[x],w=v.bounds;exports.Bounds.areOverlaping(w,r)&&(f+=1+(v.rank-e.rank))}f=f*s.length,f>n&&(n=f,t=e)}return t}l.getOverlapsWorstNode=N;function P(i){for(let t=0;t<i.length;t++){const o=i[t].bounds;for(let e=t+1;e<i.length;e++){const s=i[e].bounds;if(exports.Bounds.areOverlaping(s,o))return!0}}return!1}l.areOverlaping=P,(i=>{function t(e){const r=e.map(s=>s.particle);T.initializePointIndexes(r.map(s=>({particle:s,influences:r})));for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}}i.initializeAngles=t;function n(e){const r=T.updatePointIndexes(e);for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}return r}i.updateAngles=n;function o(e,r){for(let s=0;s<e.length;s++)e[s].updateParticle(r)}i.updateParticles=o})(l.Particles||(l.Particles={}))})(y||(y={}));function H(l,g){const A=new y.Zoom(l);if(g.length==0)return[];if(g.length==1)return[[A.min,[[A.min,exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)]]]];const d=new Map(g.map(u=>[u.id,new y.Tooltip])),h=y.createNodes(l,g),b=y.createNeighbourDeltas(A,h),p=A.min,c=A.getMax(b);y.Particles.initializeAngles(h),y.updateTooltips(h,d,A.addSteps(A.max,1));for(let u=c;u>=p;u=A.addSteps(u,-1)){const a=Math.pow(2,u),M=Math.round(u*A.scale);y.updateNeighbours(h,b,M);const I=y.getNeighbourGraphs(h);for(const D of I){y.updateBounds(D,a),y.Particles.updateParticles(D,a);const N=y.getOverlaps(D);for(;N.size>1;){const P=Array.from(N);for(;;){const n=y.Particles.updateAngles(P);if(y.updateBounds(P,a),n==!0||y.areOverlaping(P)==!1)break}if(y.updateOverlaps(N,P))continue;const t=y.getOverlapsWorstNode(P);if(t==null)break;y.updateCollapsed(t),N.delete(t)}}y.updateTooltips(h,d,Number(u.toFixed(1)))}return Array.from(d.values()).map(u=>[u.zoomAfterExpanded,u.zoomAfterAngleIndexes])}exports.getStates=H;
1
+ "use strict";var _=Object.defineProperty;var U=(l,g,A)=>g in l?_(l,g,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[g]=A;var m=(l,g,A)=>U(l,typeof g!="symbol"?g+"":g,A);exports.Rectangle=void 0;(l=>{function g(A,d,h){const b=A/2,p=d/2,c=Math.sqrt(b*b+p*p),u=Math.atan(p/b)*(180/Math.PI),a=h*(Math.PI/180);return h<180?h<90?h<u?{offsetX:0,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:0}:h<180-u?{offsetX:c*Math.cos(a)-b,offsetY:0}:{offsetX:-A,offsetY:c*Math.sin(a)-p}:h<270?h<180+u?{offsetX:-A,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:-d}:h<360-u?{offsetX:c*Math.cos(a)-b,offsetY:-d}:{offsetX:0,offsetY:c*Math.sin(a)-p}}l.getOffsets=g})(exports.Rectangle||(exports.Rectangle={}));exports.Mercator=void 0;(l=>{function g(c,u,a){return{x:d(u)*a,y:h(c)*a}}l.project=g;function A(c,u,a){return{lat:p(u/a),lng:b(c/a)}}l.unproject=A;function d(c){return(180+c)/360}function h(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function b(c){return c*360-180}function p(c){return 360/Math.PI*Math.atan(Math.exp((180-c*360)*Math.PI/180))-90}})(exports.Mercator||(exports.Mercator={}));exports.Angles=void 0;(l=>{l.COUNT=12,l.DEFAULT=270,l.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(exports.Angles||(exports.Angles={}));var T;(l=>{let g;(p=>{p.RADIANS=exports.Angles.DEGREES.map(a=>a*Math.PI/180),p.RADIANS_COS=p.RADIANS.map(a=>Math.cos(a)),p.RADIANS_SIN=p.RADIANS.map(a=>Math.sin(a));function c(a,M){const I=Math.abs(M/a);return I<1?I<.26795?0:1:I<3.73205?2:3}function u(a,M){const I=c(a,M);return a>0?M>0?(12-I)%12:0+I:M>0?6+I:6-I}p.getAngleIndex=u})(g=l.Angle||(l.Angle={}));class A{constructor(c,u,a,M){m(this,"center");m(this,"width");m(this,"height");m(this,"index");this.center=c,this.width=u,this.height=a,this.index=M}}l.Particle=A;function d(p){let c=!0;for(let u=0;u<p.length;u++){const{particle:a,influences:M}=p[u],I=a.index,D=a.center,N=a.width,P=a.height,i=b(I,-1),t=b(I,1),n=D.x+N*g.RADIANS_COS[i],o=D.y+P*g.RADIANS_SIN[i],e=D.x+N*g.RADIANS_COS[I],r=D.y+P*g.RADIANS_SIN[I],s=D.x+N*g.RADIANS_COS[t],f=D.y+P*g.RADIANS_SIN[t];let x=0,v=0,w=0;for(let z=0;z<M.length;z++){const S=M[z],R=S.index,E=S.center,G=S.width,W=S.height,B=E.x+G*g.RADIANS_COS[R],C=E.y+W*g.RADIANS_SIN[R],j=n-B,X=o-C;x+=1/(j*j+X*X);const Y=e-B,Z=r-C;v+=1/(Y*Y+Z*Z);const k=s-B,F=f-C;w+=1/(k*k+F*F)}let O=0;x<v&&x<w&&(O=-1),w<v&&w<x&&(O=1),O!=0&&(a.index=b(I,O),c=!1)}return c}l.updatePointIndexes=d;function h(p){for(let c=0;c<p.length;c++){const{particle:u,influences:a}=p[c],M=u.center;let I=0,D=0;for(let N=0;N<a.length;N++){const i=a[N].center,t=M.x-i.x,n=M.y-i.y;if(t==0&&n==0)continue;const o=Math.sqrt(t*t+n*n),e=1/(o*o);I+=e*t/o,D+=-(e*n)/o}u.index=g.getAngleIndex(I,D)}}l.initializePointIndexes=h;function b(p,c){return c==0?p:((p+c)%exports.Angles.COUNT+exports.Angles.COUNT)%exports.Angles.COUNT}})(T||(T={}));exports.Bounds=void 0;(l=>{function g(d,h){return!(d.x-d.left>h.x+h.right||d.x+d.right<h.x-h.left||d.y-d.top>h.y+h.bottom||d.y+d.bottom<h.y-h.top)}l.areOverlaping=g;function A(d,h){let b=Math.abs(d.x-h.x),c=(d.x<h.x?d.right+h.left:d.left+h.right)/b,u=Math.abs(d.y-h.y),M=(d.y<h.y?d.bottom+h.top:d.top+h.bottom)/u,I=Math.min(c,M);return Math.log2(I)}l.getZoomWhenTouching=A})(exports.Bounds||(exports.Bounds={}));var y;(l=>{class g{constructor(){m(this,"zoomAfterExpanded");m(this,"zoomAfterAngleIndexes");this.zoomAfterExpanded=NaN,this.zoomAfterAngleIndexes=[]}}l.Tooltip=g;class A{constructor(t,n,o){m(this,"index");m(this,"id");m(this,"rank");m(this,"x");m(this,"y");m(this,"width");m(this,"height");m(this,"expanded");m(this,"angle");m(this,"bounds");m(this,"neighbours");m(this,"particle");m(this,"influences");const e=exports.Mercator.project(n.lat,n.lng,t.mapSize),r=n.width+2*n.margin,s=n.height+2*n.margin;this.index=o,this.id=n.id,this.rank=n.rank,this.x=e.x,this.y=e.y,this.width=r,this.height=s,this.expanded=!0,this.angle=exports.Angles.DEFAULT,this.bounds=this.getBounds(1),this.neighbours=new Array,this.particle=new T.Particle({x:e.x,y:e.y},this.getParticleWidth(1),this.getParticleHeight(1),exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)),this.influences=[]}getBounds(t){let{offsetX:n,offsetY:o}=exports.Rectangle.getOffsets(this.width,this.height,this.angle),e=-n,r=this.width-e,s=-o,f=this.height-s;return{x:this.x,y:this.y,left:e/t,right:r/t,top:s/t,bottom:f/t}}getParticleWidth(t){return this.width/2/t}getParticleHeight(t){return this.height/2/t}updateBounds(t){this.bounds=this.getBounds(t)}updateParticle(t){this.particle.width=this.getParticleWidth(t),this.particle.height=this.getParticleHeight(t)}}l.Node=A;class d{constructor(t){m(this,"min");m(this,"max");m(this,"scale");m(this,"step");this.min=t.zoomMin,this.max=t.zoomMax,this.scale=t.zoomScale,this.step=1/this.scale}addSteps(t,n){return Math.round((t+n*this.step)*this.scale)/this.scale}getIndex(t){if(!(t<this.min))return Math.min(Math.ceil(t*this.scale),this.max*this.scale)}getMax(t){let n=this.min;for(let o=0;o<t.length;o++){const r=t[o].keys();for(const s of r){const f=Number(s)/this.scale;f>n&&(n=f)}}return n}}l.Zoom=d;function h(i,t){let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=new A(i,t[o],o);return n}l.createNodes=h;function b(i,t){const n=new Array;for(let e=0;e<t.length;e++)n[e]=new Array;const o=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e];o[e]={x:r.x,y:r.y,left:r.width,right:r.width,top:r.height,bottom:r.height}}for(let e=0;e<t.length;e++){const r=t[e],s=o[e],f=n[e];for(let x=e+1;x<t.length;x++){const v=t[x],w=o[x],O=n[x],z=exports.Bounds.getZoomWhenTouching(s,w),S=i.getIndex(z);if(S==null)continue;const R=f[S],E=O[S];R?R.push(v):f[S]=[v],E?E.push(r):O[S]=[r]}}return n}l.createNeighbourDeltas=b;function p(i){const t=new Set,n=[];for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1||e.neighbours.length==0||t.has(e))continue;t.add(e);const r=[],s=[e];for(;s.length>0;){const f=s.pop();r.push(f);for(const x of f.neighbours)t.has(x)||(t.add(x),s.push(x))}n.push(r)}return n}l.getNeighbourGraphs=p;function c(i,t,n){for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1){e.neighbours.length=0,e.influences.length=0;continue}const s=t[o][n];if(s!=null)for(let f=0;f<s.length;f++){const x=s[f];x.expanded!=!1&&(e.neighbours.push(x),e.influences.push(x.particle))}}}l.updateNeighbours=c;function u(i){i.expanded=!1;const t=i.neighbours;for(let n=0;n<t.length;n++){const o=t[n],e=o.neighbours.indexOf(i);o.neighbours.splice(e,1),o.influences.splice(e,1)}}l.updateCollapsed=u;function a(i,t,n){for(let o=0;o<i.length;o++){const e=i[o];if(e.expanded==!1)continue;const r=t.get(e.id);if(!r)throw new Error("Tooltip not found");r.zoomAfterExpanded=n;const s=exports.Angles.DEGREES.indexOf(e.angle);r.zoomAfterAngleIndexes.length==0?r.zoomAfterAngleIndexes.push([n,s]):r.zoomAfterAngleIndexes[0][1]!=s?r.zoomAfterAngleIndexes.unshift([n,s]):r.zoomAfterAngleIndexes[0][0]=n}}l.updateTooltips=a;function M(i,t){for(let n=0;n<i.length;n++)i[n].updateBounds(t)}l.updateBounds=M;function I(i){const t=new Set;for(let n=0;n<i.length;n++){const o=i[n],e=o.bounds,r=i[n].neighbours;for(let s=0;s<r.length;s++){const f=r[s],x=f.bounds;exports.Bounds.areOverlaping(x,e)&&(t.add(o),t.add(f))}}return t}l.getOverlaps=I;function D(i,t){let n=!1;for(let o=0;o<t.length;o++){const e=t[o],r=e.bounds,s=t[o].neighbours;for(let f=0;f<s.length;f++){const x=s[f],v=x.bounds;exports.Bounds.areOverlaping(v,r)&&(i.has(e)||(i.add(e),n=!0),i.has(x)||(i.add(x),n=!0))}}return n}l.updateOverlaps=D;function N(i){let t,n=0;for(let o=0;o<i.length;o++){const e=i[o],r=e.bounds,s=i[o].neighbours;let f=0;for(let x=0;x<s.length;x++){const v=s[x],w=v.bounds;exports.Bounds.areOverlaping(w,r)&&(f+=1+(v.rank-e.rank))}f=f*s.length,f>n&&(n=f,t=e)}return t}l.getOverlapsWorstNode=N;function P(i){for(let t=0;t<i.length;t++){const o=i[t].bounds;for(let e=t+1;e<i.length;e++){const s=i[e].bounds;if(exports.Bounds.areOverlaping(s,o))return!0}}return!1}l.areOverlaping=P,(i=>{function t(e){const r=e.map(s=>s.particle);T.initializePointIndexes(r.map(s=>({particle:s,influences:r})));for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}}i.initializeAngles=t;function n(e){const r=T.updatePointIndexes(e);for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}return r}i.updateAngles=n;function o(e,r){for(let s=0;s<e.length;s++)e[s].updateParticle(r)}i.updateParticles=o})(l.Particles||(l.Particles={}))})(y||(y={}));function H(l,g){const A=new y.Zoom(l);if(g.length==0)return[];if(g.length==1)return[[A.min,[[A.min,exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)]]]];const d=new Map(g.map(u=>[u.id,new y.Tooltip])),h=y.createNodes(l,g),b=y.createNeighbourDeltas(A,h),p=A.min,c=A.getMax(b);y.Particles.initializeAngles(h),y.updateTooltips(h,d,A.addSteps(A.max,1));for(let u=c;u>=p;u=A.addSteps(u,-1)){const a=Math.pow(2,u),M=Math.round(u*A.scale);y.updateNeighbours(h,b,M);const I=y.getNeighbourGraphs(h);for(const D of I){y.updateBounds(D,a),y.Particles.updateParticles(D,a);const N=y.getOverlaps(D);for(;N.size>1;){const P=Array.from(N);for(;;){const n=y.Particles.updateAngles(P);if(y.updateBounds(P,a),n==!0||y.areOverlaping(P)==!1)break}if(y.updateOverlaps(N,P))continue;const t=y.getOverlapsWorstNode(P);if(t==null)break;y.updateCollapsed(t),N.delete(t)}}y.updateTooltips(h,d,Number(u.toFixed(1)))}return Array.from(d.values()).map(u=>[u.zoomAfterExpanded,u.zoomAfterAngleIndexes])}exports.getStates=H;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arenarium/maps",
3
- "version": "1.0.183",
3
+ "version": "1.0.185",
4
4
  "license": "MIT",
5
5
  "author": "arenarium.dev",
6
6
  "description": "Visualize complex map markers clearly.",