@arenarium/maps 1.0.183 → 1.0.184

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.
package/dist/api.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var E=Object.defineProperty;var v=(l,o,n)=>o in l?E(l,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[o]=n;var h=(l,o,n)=>v(l,typeof o!="symbol"?o+"":o,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./states-O4d3qSXC.cjs");class B{constructor(o,n,i){h(this,"x");h(this,"y");h(this,"width");h(this,"height");h(this,"zoom");h(this,"angles");h(this,"expanded");h(this,"angle");h(this,"bounds");const c=f.Mercator.project(n.lat,n.lng,o.mapSize);this.x=c.x,this.y=c.y,this.width=n.width+2*n.margin,this.height=n.height+2*n.margin,this.zoom=i[0],this.angles=i[1].map(g=>[g[0],f.Angles.DEGREES[g[1]]]),this.expanded=!1,this.angle=0,this.bounds=void 0}getBounds(o,n){let{offsetX:i,offsetY:c}=f.Rectangle.getOffsets(this.width,this.height,n),g=-i,u=this.width-g,b=-c,e=this.height-b;return{x:this.x,y:this.y,left:g/o,right:u/o,top:b/o,bottom:e/o}}}function M(l,o,n){var b;if(o.length!=n.length)throw new Error("Data and states length must be the same");const i=new Array(o.length);for(let e=0;e<o.length;e++){const a=n[e];if(isNaN(a[0]))throw new Error("State zoom is not a number");if(a[1]==null||a[1].length==0)throw new Error("State angles is empty");if(a[0]!=a[1][0][0])throw new Error("State expand zoom and start angles zoom are not the same");const d=new B(l,o[e],n[e]);i[e]=d}const c=l.zoomMin,g=l.zoomMax,u=1/l.zoomScale;for(let e=c;e<=g;e+=u){const a=Math.pow(2,e);for(let d=0;d<i.length;d++){const t=i[d];if(t.expanded=t.zoom<e,t.expanded==!1)continue;const r=(b=t.angles.findLast(s=>s[0]<e))==null?void 0:b[1];if(r==null)throw new Error("Angle not found");t.angle=r,t.bounds=t.getBounds(a,r)}for(let d=0;d<i.length;d++){const t=i[d];if(t.bounds!=null)for(let r=d+1;r<i.length;r++){const s=i[r];if(s.bounds!=null&&f.Bounds.areOverlaping(t.bounds,s.bounds)){console.log("OVERLAP",e,o[d],o[r],t.angle,s.angle);const m=t.bounds.x-t.bounds.left,w=t.bounds.y-t.bounds.top,x=t.bounds.x+t.bounds.right,y=t.bounds.y+t.bounds.bottom;console.log(`B1: (${m}, ${w}), (${m}, ${y}), (${x}, ${w}), (${x}, ${y})`);const z=s.bounds.x-s.bounds.left,S=s.bounds.y-s.bounds.top,$=s.bounds.x+s.bounds.right,p=s.bounds.y+s.bounds.bottom;throw console.log(`B2: (${z}, ${S}), (${z}, ${p}), (${$}, ${S}), (${$}, ${p})`),new Error("Bounds overlaping")}}}}}exports.getStates=f.getStates;exports.testStates=M;
1
+ "use strict";var E=Object.defineProperty;var v=(l,o,n)=>o in l?E(l,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[o]=n;var h=(l,o,n)=>v(l,typeof o!="symbol"?o+"":o,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./states-D6BEdwDG.cjs");class B{constructor(o,n,i){h(this,"x");h(this,"y");h(this,"width");h(this,"height");h(this,"zoom");h(this,"angles");h(this,"expanded");h(this,"angle");h(this,"bounds");const c=f.Mercator.project(n.lat,n.lng,o.mapSize);this.x=c.x,this.y=c.y,this.width=n.width+2*n.margin,this.height=n.height+2*n.margin,this.zoom=i[0],this.angles=i[1].map(g=>[g[0],f.Angles.DEGREES[g[1]]]),this.expanded=!1,this.angle=0,this.bounds=void 0}getBounds(o,n){let{offsetX:i,offsetY:c}=f.Rectangle.getOffsets(this.width,this.height,n),g=-i,u=this.width-g,b=-c,e=this.height-b;return{x:this.x,y:this.y,left:g/o,right:u/o,top:b/o,bottom:e/o}}}function M(l,o,n){var b;if(o.length!=n.length)throw new Error("Data and states length must be the same");const i=new Array(o.length);for(let e=0;e<o.length;e++){const a=n[e];if(isNaN(a[0]))throw new Error("State zoom is not a number");if(a[1]==null||a[1].length==0)throw new Error("State angles is empty");if(a[0]!=a[1][0][0])throw new Error("State expand zoom and start angles zoom are not the same");const d=new B(l,o[e],n[e]);i[e]=d}const c=l.zoomMin,g=l.zoomMax,u=1/l.zoomScale;for(let e=c;e<=g;e+=u){const a=Math.pow(2,e);for(let d=0;d<i.length;d++){const t=i[d];if(t.expanded=t.zoom<e,t.expanded==!1)continue;const r=(b=t.angles.findLast(s=>s[0]<e))==null?void 0:b[1];if(r==null)throw new Error("Angle not found");t.angle=r,t.bounds=t.getBounds(a,r)}for(let d=0;d<i.length;d++){const t=i[d];if(t.bounds!=null)for(let r=d+1;r<i.length;r++){const s=i[r];if(s.bounds!=null&&f.Bounds.areOverlaping(t.bounds,s.bounds)){console.log("OVERLAP",e,o[d],o[r],t.angle,s.angle);const m=t.bounds.x-t.bounds.left,w=t.bounds.y-t.bounds.top,x=t.bounds.x+t.bounds.right,y=t.bounds.y+t.bounds.bottom;console.log(`B1: (${m}, ${w}), (${m}, ${y}), (${x}, ${w}), (${x}, ${y})`);const z=s.bounds.x-s.bounds.left,S=s.bounds.y-s.bounds.top,$=s.bounds.x+s.bounds.right,p=s.bounds.y+s.bounds.bottom;throw console.log(`B2: (${z}, ${S}), (${z}, ${p}), (${$}, ${S}), (${$}, ${p})`),new Error("Bounds overlaping")}}}}}exports.getStates=f.getStates;exports.testStates=M;
package/dist/api.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var E = Object.defineProperty;
2
2
  var S = (l, o, n) => o in l ? E(l, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[o] = n;
3
3
  var d = (l, o, n) => S(l, typeof o != "symbol" ? o + "" : o, n);
4
- import { B as v, M as B, A, R as M } from "./states-CxxqUf8M.js";
5
- import { g as G } from "./states-CxxqUf8M.js";
4
+ import { B as v, M as B, A, R as M } from "./states-CqXqpk4z.js";
5
+ import { g as G } from "./states-CqXqpk4z.js";
6
6
  class R {
7
7
  constructor(o, n, i) {
8
8
  d(this, "x");