world.ts 0.2.6 → 0.2.7
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/index.js +55 -51
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ const Rt = (e, t) => {
|
|
|
116
116
|
},
|
|
117
117
|
dispose: () => [...t.values()].forEach((r) => r.dispose())
|
|
118
118
|
};
|
|
119
|
-
},
|
|
119
|
+
}, yi = (e) => {
|
|
120
120
|
const t = e.getContext("webgl2");
|
|
121
121
|
if (!t)
|
|
122
122
|
throw new Error("No WebGL2");
|
|
@@ -438,7 +438,7 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
438
438
|
return Yt(z(), et, tt, gt);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
|
-
}, _n = 100,
|
|
441
|
+
}, _n = 100, wi = (e, t, n) => {
|
|
442
442
|
const {
|
|
443
443
|
enabled: i = () => !0,
|
|
444
444
|
draggable: r = () => !0,
|
|
@@ -693,7 +693,7 @@ void main(void) {
|
|
|
693
693
|
uv_out = uv;
|
|
694
694
|
color_out = color;
|
|
695
695
|
}`;
|
|
696
|
-
const
|
|
696
|
+
const Ti = (e, t = {}) => {
|
|
697
697
|
const { gl: n } = e;
|
|
698
698
|
let i, r = [0, 0];
|
|
699
699
|
const s = k({ gl: n, type: "f32", target: "array" }), o = k({ gl: n, type: "f32", target: "array" }), c = k({ gl: n, type: "u16", target: "element" });
|
|
@@ -794,10 +794,10 @@ const wi = (e, t = {}) => {
|
|
|
794
794
|
} };
|
|
795
795
|
}, o = s(), c = s(!0);
|
|
796
796
|
return { renderProgram: o, depthProgram: c };
|
|
797
|
-
},
|
|
797
|
+
}, gi = (e) => ({
|
|
798
798
|
children: e,
|
|
799
799
|
dispose: () => e.forEach((n) => n.dispose())
|
|
800
|
-
}),
|
|
800
|
+
}), Ri = (e) => {
|
|
801
801
|
const { keys: t, create: n } = e, i = /* @__PURE__ */ new Map();
|
|
802
802
|
return {
|
|
803
803
|
get children() {
|
|
@@ -813,11 +813,11 @@ const wi = (e, t = {}) => {
|
|
|
813
813
|
},
|
|
814
814
|
dispose: () => Object.values(i).forEach((o) => o.dispose())
|
|
815
815
|
};
|
|
816
|
-
},
|
|
816
|
+
}, Ai = (e) => ({
|
|
817
817
|
render: e,
|
|
818
818
|
dispose: () => {
|
|
819
819
|
}
|
|
820
|
-
}),
|
|
820
|
+
}), Si = () => ({ dispose: () => {
|
|
821
821
|
} });
|
|
822
822
|
var An = `#version 300 es
|
|
823
823
|
|
|
@@ -903,7 +903,7 @@ void main(void) {
|
|
|
903
903
|
color_out = color;
|
|
904
904
|
distance_out = distance;
|
|
905
905
|
}`;
|
|
906
|
-
const
|
|
906
|
+
const Mi = (e, t = {}) => {
|
|
907
907
|
const { gl: n } = e;
|
|
908
908
|
let i = 0;
|
|
909
909
|
const r = k({ gl: n, type: "i32", target: "array" }), s = k({ gl: n, type: "u16", target: "element" }), o = k({ gl: n, type: "f32", target: "array" }), c = k({ gl: n, type: "f32", target: "array" }), { renderProgram: a, depthProgram: f } = Mn(e, {
|
|
@@ -919,7 +919,7 @@ const Si = (e, t = {}) => {
|
|
|
919
919
|
index: w = 0
|
|
920
920
|
}) => {
|
|
921
921
|
h(), d();
|
|
922
|
-
const A = t.color?.() ?? [1, 1, 1, 1], _ = t.width?.() ?? 1, T = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, S = t.depthWidthPixels?.(), b = t.dashSize?.() ??
|
|
922
|
+
const A = t.color?.() ?? [1, 1, 1, 1], _ = t.width?.() ?? 1, T = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, S = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
|
|
923
923
|
if (ge(n, x, t))
|
|
924
924
|
return;
|
|
925
925
|
(x ? f : a).execute({
|
|
@@ -1094,7 +1094,7 @@ void main(void) {
|
|
|
1094
1094
|
|
|
1095
1095
|
color_out = color;
|
|
1096
1096
|
}`;
|
|
1097
|
-
const
|
|
1097
|
+
const bi = (e, t = {}) => {
|
|
1098
1098
|
const { gl: n } = e;
|
|
1099
1099
|
let i = 0;
|
|
1100
1100
|
const r = k({ gl: n, type: "f32", target: "array" }), s = k({ gl: n, type: "u16", target: "element" }), { renderProgram: o, depthProgram: c } = Pn(e, {
|
|
@@ -1526,7 +1526,7 @@ void main(void) {
|
|
|
1526
1526
|
gl_Position = transform(position);
|
|
1527
1527
|
color_out = color;
|
|
1528
1528
|
}`;
|
|
1529
|
-
const
|
|
1529
|
+
const Ui = (e, t = {}) => {
|
|
1530
1530
|
const { gl: n } = e;
|
|
1531
1531
|
let i = 0;
|
|
1532
1532
|
const r = k({ gl: n, type: "i32", target: "array" }), s = k({ gl: n, type: "u16", target: "element" }), { renderProgram: o, depthProgram: c } = Jn(e, {
|
|
@@ -2602,7 +2602,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2602
2602
|
let n = (t - 1) / (j - 2), i = (e - 1) / (j - 2), r = 0;
|
|
2603
2603
|
return t === 0 && (n = 0, r = -Le), t === j && (n = 1, r = -Le), e === 0 && (i = 0, r = -Le), e === j && (i = 1, r = -Le), [n, i, r];
|
|
2604
2604
|
})
|
|
2605
|
-
),
|
|
2605
|
+
), Li = (e, t = {}) => {
|
|
2606
2606
|
const { gl: n } = e;
|
|
2607
2607
|
let i, r;
|
|
2608
2608
|
const s = ae(
|
|
@@ -2737,23 +2737,26 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2737
2737
|
e[(n + 1) % e.length] ?? [0, 0]
|
|
2738
2738
|
)
|
|
2739
2739
|
).reduce((t, n) => t + n, 0) / e.length
|
|
2740
|
-
),
|
|
2740
|
+
), Ni = {
|
|
2741
2741
|
pickable: !0,
|
|
2742
2742
|
depth: !0,
|
|
2743
2743
|
polygonOffset: 0
|
|
2744
|
-
},
|
|
2744
|
+
}, di = (e, t) => {
|
|
2745
2745
|
let n;
|
|
2746
2746
|
return () => {
|
|
2747
|
-
const i = e();
|
|
2747
|
+
const i = e.map((s) => s());
|
|
2748
2748
|
if (n) {
|
|
2749
2749
|
const [s, o] = n;
|
|
2750
|
-
if (s === i)
|
|
2750
|
+
if (s.every((c, a) => c === i[a]))
|
|
2751
2751
|
return o;
|
|
2752
2752
|
}
|
|
2753
2753
|
const r = t(i);
|
|
2754
2754
|
return n = [i, r], r;
|
|
2755
2755
|
};
|
|
2756
|
-
},
|
|
2756
|
+
}, ae = (e, t) => di([e], (n) => {
|
|
2757
|
+
const [i] = n;
|
|
2758
|
+
return t(i);
|
|
2759
|
+
}), Ae = (e) => {
|
|
2757
2760
|
const {
|
|
2758
2761
|
onClick: t,
|
|
2759
2762
|
onRightClick: n,
|
|
@@ -2780,9 +2783,9 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2780
2783
|
const o = t();
|
|
2781
2784
|
return n = n ?? o, n = e({ time: s, current: n, target: o }), n;
|
|
2782
2785
|
};
|
|
2783
|
-
},
|
|
2786
|
+
}, mi = ce(
|
|
2784
2787
|
({ time: e, current: t, target: n }) => (Math.abs(n - t) < Se ? t = n : t = t + (n - t) * (1 - Math.exp(-Be * e)), t)
|
|
2785
|
-
),
|
|
2788
|
+
), pi = ce(
|
|
2786
2789
|
({ time: e, current: t, target: n }) => (ln(t, n) < Se ? sn(t, n) : t = an(
|
|
2787
2790
|
me(),
|
|
2788
2791
|
t,
|
|
@@ -2792,7 +2795,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2792
2795
|
1 - Math.exp(-Be * e)
|
|
2793
2796
|
)
|
|
2794
2797
|
), t)
|
|
2795
|
-
),
|
|
2798
|
+
), Ii = ce(
|
|
2796
2799
|
({ time: e, current: t, target: n }) => (Kt(t, n) < Se ? kt(t, n) : t = Ht(
|
|
2797
2800
|
ee(),
|
|
2798
2801
|
t,
|
|
@@ -2802,7 +2805,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2802
2805
|
1 - Math.exp(-Be * e)
|
|
2803
2806
|
)
|
|
2804
2807
|
), t)
|
|
2805
|
-
),
|
|
2808
|
+
), Di = ce(
|
|
2806
2809
|
({ time: e, current: t, target: n }) => {
|
|
2807
2810
|
const i = Te(L(t), L(n));
|
|
2808
2811
|
return i * H < Se || i > 1e5 / H ? jt(t, n) : t = se(
|
|
@@ -2817,7 +2820,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2817
2820
|
)
|
|
2818
2821
|
), t;
|
|
2819
2822
|
}
|
|
2820
|
-
),
|
|
2823
|
+
), Oi = (e) => {
|
|
2821
2824
|
let t = [0, 0, 0], n = [0, 0, 0], i, r;
|
|
2822
2825
|
return ce(({ time: o, current: c, target: a }) => {
|
|
2823
2826
|
if (a === c || o > 1 || Te(L(a), L(c)) > 1e3 / H)
|
|
@@ -2856,7 +2859,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2856
2859
|
)
|
|
2857
2860
|
), t = f, c;
|
|
2858
2861
|
})(e);
|
|
2859
|
-
},
|
|
2862
|
+
}, vi = ce(
|
|
2860
2863
|
({ time: e, current: t, target: n }) => (t = vn(
|
|
2861
2864
|
Ne(
|
|
2862
2865
|
He(),
|
|
@@ -2865,10 +2868,10 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2865
2868
|
Math.PI * e
|
|
2866
2869
|
)
|
|
2867
2870
|
), tn(be(t), be(n)) < Se && (n = t), t)
|
|
2868
|
-
),
|
|
2869
|
-
const t =
|
|
2871
|
+
), xi = 10, Ci = (e) => {
|
|
2872
|
+
const t = vi(() => e().orientation), n = pi(() => e().offset), i = mi(() => e().fieldOfView);
|
|
2870
2873
|
return ce(({ time: s, current: o, target: c }) => {
|
|
2871
|
-
const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-
|
|
2874
|
+
const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-xi * s), u = Math.exp(
|
|
2872
2875
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
2873
2876
|
), h = o.distance > a ? 1 : o.distance / a, d = se(
|
|
2874
2877
|
ne(
|
|
@@ -2894,7 +2897,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2894
2897
|
fieldOfView: i()
|
|
2895
2898
|
};
|
|
2896
2899
|
})(e);
|
|
2897
|
-
},
|
|
2900
|
+
}, Ei = (e) => {
|
|
2898
2901
|
const t = e.createTexture();
|
|
2899
2902
|
e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
|
|
2900
2903
|
const n = e.createRenderbuffer();
|
|
@@ -2943,7 +2946,7 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2943
2946
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
2944
2947
|
}
|
|
2945
2948
|
};
|
|
2946
|
-
},
|
|
2949
|
+
}, _i = (e, {
|
|
2947
2950
|
view: t,
|
|
2948
2951
|
screen: n,
|
|
2949
2952
|
pick: i
|
|
@@ -2991,11 +2994,11 @@ const j = 34, oi = 22, ai = ie(0, j).flatMap(
|
|
|
2991
2994
|
} };
|
|
2992
2995
|
};
|
|
2993
2996
|
bt(Array);
|
|
2994
|
-
const
|
|
2997
|
+
const Xi = ({ gl: e }, t) => {
|
|
2995
2998
|
const { view: n, layers: i } = t;
|
|
2996
2999
|
let r = !0, s = [0, 0];
|
|
2997
3000
|
e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
|
|
2998
|
-
const o =
|
|
3001
|
+
const o = Ei(e), { canvas: c } = e, a = ([p = 0, x = 0]) => {
|
|
2999
3002
|
p = p || 1, x = x || 1, s = [p, x], c.width = p * devicePixelRatio, c.height = x * devicePixelRatio, o.resize([c.width, c.height]);
|
|
3000
3003
|
};
|
|
3001
3004
|
a([c.width, c.height]);
|
|
@@ -3033,7 +3036,7 @@ const Ci = ({ gl: e }, t) => {
|
|
|
3033
3036
|
S * devicePixelRatio
|
|
3034
3037
|
]), [U = 0, M = 0] = w(p), N = se(_(A([U, M, b, 1]))), D = P === 0 ? void 0 : T ?? Oe(i())[P - 1];
|
|
3035
3038
|
return { point: p, position: N, layer: D };
|
|
3036
|
-
}, v =
|
|
3039
|
+
}, v = _i(e, {
|
|
3037
3040
|
view: n,
|
|
3038
3041
|
screen: () => s,
|
|
3039
3042
|
pick: y
|
|
@@ -3049,30 +3052,31 @@ const Ci = ({ gl: e }, t) => {
|
|
|
3049
3052
|
}, Oe = (e) => e.flatMap((t) => [...Oe(t.children ?? []), t]);
|
|
3050
3053
|
export {
|
|
3051
3054
|
ae as cache,
|
|
3055
|
+
di as cacheAll,
|
|
3052
3056
|
H as circumference,
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3057
|
+
Ti as createBillboardLayer,
|
|
3058
|
+
gi as createContainer,
|
|
3059
|
+
yi as createContext,
|
|
3060
|
+
Ri as createDynamicContainer,
|
|
3061
|
+
Si as createEmptyLayer,
|
|
3062
|
+
Mi as createLineLayer,
|
|
3063
|
+
bi as createMeshLayer,
|
|
3064
|
+
wi as createMouseControl,
|
|
3061
3065
|
Ae as createMouseEvents,
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3066
|
+
mi as createNumberTransition,
|
|
3067
|
+
vi as createOrientationTransition,
|
|
3068
|
+
Ui as createPolygonLayer,
|
|
3069
|
+
Di as createPositionTransition,
|
|
3070
|
+
Oi as createPositionVelocityTransition,
|
|
3071
|
+
Ai as createRenderLayer,
|
|
3072
|
+
Li as createTerrainLayer,
|
|
3069
3073
|
ce as createTransition,
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
+
pi as createVec2Transition,
|
|
3075
|
+
Ii as createVec4Transition,
|
|
3076
|
+
Ci as createViewTransition,
|
|
3077
|
+
Xi as createWorld,
|
|
3074
3078
|
Rt as debounce,
|
|
3075
|
-
|
|
3079
|
+
Ni as defaultLayerOptions,
|
|
3076
3080
|
ut as defaultView,
|
|
3077
3081
|
dn as degrees,
|
|
3078
3082
|
se as geodetic,
|