react-three-map 1.0.0-next.0 → 1.0.0-next.1
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/CHANGELOG.md +6 -0
- package/dist/cjs/main.js +41 -1259
- package/dist/es/main10.mjs +10 -71
- package/dist/es/main10.mjs.map +1 -1
- package/dist/es/main11.mjs +35 -12
- package/dist/es/main11.mjs.map +1 -1
- package/dist/es/main12.mjs +13 -12
- package/dist/es/main12.mjs.map +1 -1
- package/dist/es/main13.mjs +24 -42
- package/dist/es/main13.mjs.map +1 -1
- package/dist/es/main14.mjs +4 -13
- package/dist/es/main14.mjs.map +1 -1
- package/dist/es/main15.mjs +31 -22
- package/dist/es/main15.mjs.map +1 -1
- package/dist/es/main16.mjs +23 -87
- package/dist/es/main16.mjs.map +1 -1
- package/dist/es/main17.mjs +94 -14
- package/dist/es/main17.mjs.map +1 -1
- package/dist/es/main18.mjs +62 -22
- package/dist/es/main18.mjs.map +1 -1
- package/dist/es/main19.mjs +20 -27
- package/dist/es/main19.mjs.map +1 -1
- package/dist/es/main20.mjs +23 -8
- package/dist/es/main20.mjs.map +1 -1
- package/dist/es/main21.mjs +16 -34
- package/dist/es/main21.mjs.map +1 -1
- package/dist/es/main22.mjs +80 -12
- package/dist/es/main22.mjs.map +1 -1
- package/dist/es/main3.mjs +4 -13
- package/dist/es/main3.mjs.map +1 -1
- package/dist/es/main4.mjs +3 -3
- package/dist/es/main5.mjs +1 -1
- package/dist/es/main6.mjs +1 -1
- package/dist/es/main7.mjs +1 -1
- package/dist/es/main8.mjs +20 -87
- package/dist/es/main8.mjs.map +1 -1
- package/dist/es/main9.mjs +24 -80
- package/dist/es/main9.mjs.map +1 -1
- package/package.json +1 -1
- package/stories/package.json +1 -1
- package/stories/yarn.lock +19 -14
- package/dist/es/main23.mjs +0 -26
- package/dist/es/main23.mjs.map +0 -1
- package/dist/es/main24.mjs +0 -5
- package/dist/es/main24.mjs.map +0 -1
- package/dist/es/main25.mjs +0 -33
- package/dist/es/main25.mjs.map +0 -1
- package/dist/es/main26.mjs +0 -27
- package/dist/es/main26.mjs.map +0 -1
- package/dist/es/main27.mjs +0 -98
- package/dist/es/main27.mjs.map +0 -1
- package/dist/es/main28.mjs +0 -66
- package/dist/es/main28.mjs.map +0 -1
- package/dist/es/main29.mjs +0 -23
- package/dist/es/main29.mjs.map +0 -1
- package/dist/es/main30.mjs +0 -27
- package/dist/es/main30.mjs.map +0 -1
- package/dist/es/main31.mjs +0 -19
- package/dist/es/main31.mjs.map +0 -1
- package/dist/es/main32.mjs +0 -83
- package/dist/es/main32.mjs.map +0 -1
- package/dist/es/main33.mjs +0 -501
- package/dist/es/main33.mjs.map +0 -1
- package/dist/es/main34.mjs +0 -90
- package/dist/es/main34.mjs.map +0 -1
- package/dist/es/main35.mjs +0 -6
- package/dist/es/main35.mjs.map +0 -1
- package/dist/es/main36.mjs +0 -26
- package/dist/es/main36.mjs.map +0 -1
- package/dist/es/main37.mjs +0 -19
- package/dist/es/main37.mjs.map +0 -1
- package/dist/es/main38.mjs +0 -50
- package/dist/es/main38.mjs.map +0 -1
- package/dist/es/main39.mjs +0 -31
- package/dist/es/main39.mjs.map +0 -1
- package/dist/es/main40.mjs +0 -9
- package/dist/es/main40.mjs.map +0 -1
- package/dist/es/main41.mjs +0 -62
- package/dist/es/main41.mjs.map +0 -1
- package/dist/es/main42.mjs +0 -42
- package/dist/es/main42.mjs.map +0 -1
package/dist/es/main7.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MathUtils } from "three";
|
|
2
|
-
import { earthRadius } from "./
|
|
2
|
+
import { earthRadius } from "./main14.mjs";
|
|
3
3
|
function vector3ToCoords(position, origin) {
|
|
4
4
|
const [x, y, z] = position;
|
|
5
5
|
const latitude = origin.latitude + -z / earthRadius * MathUtils.RAD2DEG;
|
package/dist/es/main8.mjs
CHANGED
|
@@ -1,93 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const [mapInstance, setMapInstance] = useState(null);
|
|
12
|
-
const containerRef = useRef();
|
|
13
|
-
const { current: contextValue } = useRef({ mapLib: null, map: null });
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const mapLib = props.mapLib;
|
|
16
|
-
let isMounted = true;
|
|
17
|
-
let mapbox;
|
|
18
|
-
Promise.resolve(mapLib || import("mapbox-gl")).then((module) => {
|
|
19
|
-
if (!isMounted) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!module) {
|
|
23
|
-
throw new Error("Invalid mapLib");
|
|
24
|
-
}
|
|
25
|
-
const mapboxgl = "Map" in module ? module : module.default;
|
|
26
|
-
if (!mapboxgl.Map) {
|
|
27
|
-
throw new Error("Invalid mapLib");
|
|
28
|
-
}
|
|
29
|
-
setGlobals(mapboxgl, props);
|
|
30
|
-
if (!mapboxgl.supported || mapboxgl.supported(props)) {
|
|
31
|
-
if (props.reuseMaps) {
|
|
32
|
-
mapbox = Mapbox.reuse(props, containerRef.current);
|
|
33
|
-
}
|
|
34
|
-
if (!mapbox) {
|
|
35
|
-
mapbox = new Mapbox(mapboxgl.Map, props, containerRef.current);
|
|
36
|
-
}
|
|
37
|
-
contextValue.map = createRef(mapbox);
|
|
38
|
-
contextValue.mapLib = mapboxgl;
|
|
39
|
-
setMapInstance(mapbox);
|
|
40
|
-
mountedMapsContext == null ? void 0 : mountedMapsContext.onMapMount(contextValue.map, props.id);
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error("Map is not supported by this browser");
|
|
43
|
-
}
|
|
44
|
-
}).catch((error) => {
|
|
45
|
-
const { onError } = props;
|
|
46
|
-
if (onError) {
|
|
47
|
-
onError({
|
|
48
|
-
type: "error",
|
|
49
|
-
target: null,
|
|
50
|
-
error
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
console.error(error);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return () => {
|
|
57
|
-
isMounted = false;
|
|
58
|
-
if (mapbox) {
|
|
59
|
-
mountedMapsContext == null ? void 0 : mountedMapsContext.onMapUnmount(props.id);
|
|
60
|
-
if (props.reuseMaps) {
|
|
61
|
-
mapbox.recycle();
|
|
62
|
-
} else {
|
|
63
|
-
mapbox.destroy();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}, []);
|
|
68
|
-
useIsomorphicLayoutEffect(() => {
|
|
69
|
-
if (mapInstance) {
|
|
70
|
-
mapInstance.setProps(props);
|
|
71
|
-
}
|
|
1
|
+
import { useCoordsToMatrix } from "./main12.mjs";
|
|
2
|
+
import { useRender } from "./main16.mjs";
|
|
3
|
+
import { useRoot } from "./main17.mjs";
|
|
4
|
+
function useCanvasInLayer(props, fromLngLat, map) {
|
|
5
|
+
const { latitude, longitude, altitude, frameloop } = props;
|
|
6
|
+
const origin = useCoordsToMatrix({
|
|
7
|
+
latitude,
|
|
8
|
+
longitude,
|
|
9
|
+
altitude,
|
|
10
|
+
fromLngLat
|
|
72
11
|
});
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
12
|
+
const { onRemove, useThree, r3m } = useRoot(fromLngLat, map, props);
|
|
13
|
+
const render = useRender({ origin, frameloop, useThree, map, r3m });
|
|
14
|
+
return {
|
|
15
|
+
id: props.id,
|
|
16
|
+
beforeId: props.beforeId,
|
|
17
|
+
onRemove,
|
|
18
|
+
render,
|
|
19
|
+
type: "custom",
|
|
20
|
+
renderingMode: "3d"
|
|
82
21
|
};
|
|
83
|
-
return React.createElement("div", { id: props.id, ref: containerRef, style }, mapInstance && React.createElement(
|
|
84
|
-
MapContext.Provider,
|
|
85
|
-
{ value: contextValue },
|
|
86
|
-
React.createElement("div", { "mapboxgl-children": "", style: CHILD_CONTAINER_STYLE }, props.children)
|
|
87
|
-
));
|
|
88
22
|
}
|
|
89
|
-
React.forwardRef(_Map);
|
|
90
23
|
export {
|
|
91
|
-
|
|
24
|
+
useCanvasInLayer
|
|
92
25
|
};
|
|
93
26
|
//# sourceMappingURL=main8.mjs.map
|
package/dist/es/main8.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main8.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main8.mjs","sources":["../../src/core/canvas-in-layer/use-canvas-in-layer.tsx"],"sourcesContent":["import { CanvasProps } from \"../../api/canvas-props\";\nimport { FromLngLat, MapInstance } from \"../generic-map\";\nimport { useCoordsToMatrix } from \"../use-coords-to-matrix\";\nimport { useRender } from \"./use-render\";\nimport { useRoot } from \"./use-root\";\n\n/** get all the properties that you need to render as a map `<Layer>` */\nexport function useCanvasInLayer(props: CanvasProps,fromLngLat: FromLngLat, map: MapInstance) {\n\n const {latitude, longitude, altitude, frameloop } = props;\n\n const origin = useCoordsToMatrix({\n latitude, longitude, altitude, fromLngLat,\n });\n\n const { onRemove, useThree, r3m } = useRoot(fromLngLat, map, props);\n \n const render = useRender({origin, frameloop, useThree, map, r3m});\n \n return {\n id: props.id,\n beforeId: props.beforeId,\n onRemove,\n render,\n type: 'custom',\n renderingMode: '3d'\n } as const\n\n}"],"names":[],"mappings":";;;AAOgB,SAAA,iBAAiB,OAAmB,YAAwB,KAAkB;AAE5F,QAAM,EAAC,UAAU,WAAW,UAAU,cAAc;AAElD,QAAM,SAAS,kBAAkB;AAAA,IAC/B;AAAA,IAAU;AAAA,IAAW;AAAA,IAAU;AAAA,EAAA,CAChC;AAEK,QAAA,EAAE,UAAU,UAAU,IAAA,IAAQ,QAAQ,YAAY,KAAK,KAAK;AAE5D,QAAA,SAAS,UAAU,EAAC,QAAQ,WAAW,UAAU,KAAK,KAAI;AAEzD,SAAA;AAAA,IACL,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,eAAe;AAAA,EAAA;AAGrB;"}
|
package/dist/es/main9.mjs
CHANGED
|
@@ -1,86 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { memo,
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState, useEffect } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
const options = {
|
|
19
|
-
...props,
|
|
20
|
-
element: hasChildren ? document.createElement("div") : null
|
|
21
|
-
};
|
|
22
|
-
const mk = new mapLib.Marker(options);
|
|
23
|
-
mk.setLngLat([props.longitude, props.latitude]);
|
|
24
|
-
mk.getElement().addEventListener("click", (e) => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
(_b = (_a = thisRef.current.props).onClick) == null ? void 0 : _b.call(_a, {
|
|
27
|
-
type: "click",
|
|
28
|
-
target: mk,
|
|
29
|
-
originalEvent: e
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
mk.on("dragstart", (e) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const evt = e;
|
|
35
|
-
evt.lngLat = marker.getLngLat();
|
|
36
|
-
(_b = (_a = thisRef.current.props).onDragStart) == null ? void 0 : _b.call(_a, evt);
|
|
37
|
-
});
|
|
38
|
-
mk.on("drag", (e) => {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
const evt = e;
|
|
41
|
-
evt.lngLat = marker.getLngLat();
|
|
42
|
-
(_b = (_a = thisRef.current.props).onDrag) == null ? void 0 : _b.call(_a, evt);
|
|
43
|
-
});
|
|
44
|
-
mk.on("dragend", (e) => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
const evt = e;
|
|
47
|
-
evt.lngLat = marker.getLngLat();
|
|
48
|
-
(_b = (_a = thisRef.current.props).onDragEnd) == null ? void 0 : _b.call(_a, evt);
|
|
49
|
-
});
|
|
50
|
-
return mk;
|
|
51
|
-
}, []);
|
|
4
|
+
import { CanvasPortal } from "./main18.mjs";
|
|
5
|
+
const InitCanvasFC = memo((props) => {
|
|
6
|
+
const canvas = props.map.getCanvas();
|
|
7
|
+
const [el] = useState(() => {
|
|
8
|
+
const el2 = document.createElement("div");
|
|
9
|
+
el2.style.position = "absolute";
|
|
10
|
+
el2.style.top = "0";
|
|
11
|
+
el2.style.bottom = "0";
|
|
12
|
+
el2.style.left = "0";
|
|
13
|
+
el2.style.right = "0";
|
|
14
|
+
el2.style.pointerEvents = "none";
|
|
15
|
+
return el2;
|
|
16
|
+
});
|
|
52
17
|
useEffect(() => {
|
|
53
|
-
|
|
18
|
+
const parent = canvas.parentElement;
|
|
19
|
+
parent.appendChild(el);
|
|
54
20
|
return () => {
|
|
55
|
-
|
|
21
|
+
parent.removeChild(el);
|
|
56
22
|
};
|
|
57
23
|
}, []);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
marker.setLngLat([longitude, latitude]);
|
|
65
|
-
}
|
|
66
|
-
if (offset && !arePointsEqual(marker.getOffset(), offset)) {
|
|
67
|
-
marker.setOffset(offset);
|
|
68
|
-
}
|
|
69
|
-
if (marker.isDraggable() !== draggable) {
|
|
70
|
-
marker.setDraggable(draggable);
|
|
71
|
-
}
|
|
72
|
-
if (marker.getRotation() !== rotation) {
|
|
73
|
-
marker.setRotation(rotation);
|
|
74
|
-
}
|
|
75
|
-
if (marker.getRotationAlignment() !== rotationAlignment) {
|
|
76
|
-
marker.setRotationAlignment(rotationAlignment);
|
|
77
|
-
}
|
|
78
|
-
if (marker.getPitchAlignment() !== pitchAlignment) {
|
|
79
|
-
marker.setPitchAlignment(pitchAlignment);
|
|
80
|
-
}
|
|
81
|
-
if (marker.getPopup() !== popup) {
|
|
82
|
-
marker.setPopup(popup);
|
|
83
|
-
}
|
|
84
|
-
return createPortal(props.children, marker.getElement());
|
|
85
|
-
}));
|
|
24
|
+
return /* @__PURE__ */ jsx(Fragment, { children: createPortal(/* @__PURE__ */ jsx(CanvasPortal, { ...props }), el) });
|
|
25
|
+
});
|
|
26
|
+
InitCanvasFC.displayName = "InitCanvasFC";
|
|
27
|
+
export {
|
|
28
|
+
InitCanvasFC
|
|
29
|
+
};
|
|
86
30
|
//# sourceMappingURL=main9.mjs.map
|
package/dist/es/main9.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main9.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main9.mjs","sources":["../../src/core/canvas-overlay/init-canvas-fc.tsx"],"sourcesContent":["import { memo, useEffect, useState } from \"react\";\nimport { createPortal } from 'react-dom';\nimport { Matrix4Tuple } from \"three\";\nimport { CanvasProps } from \"../../api/canvas-props\";\nimport { FromLngLat, MapInstance } from \"../generic-map\";\nimport { CanvasPortal } from \"./canvas-portal\";\n\ninterface InitCanvasFCProps extends CanvasProps {\n map: MapInstance,\n setOnRender: (callback: () => (mx: Matrix4Tuple) => void) => void,\n frameloop?: 'always' | 'demand',\n fromLngLat: FromLngLat,\n}\nexport const InitCanvasFC = memo<InitCanvasFCProps>((props) => {\n const canvas = props.map.getCanvas() // eslint-disable-line @typescript-eslint/no-non-null-assertion\n\n const [el] = useState(() => {\n const el = document.createElement('div');\n el.style.position = 'absolute';\n el.style.top = '0';\n el.style.bottom = '0';\n el.style.left = '0';\n el.style.right = '0';\n el.style.pointerEvents = 'none';\n return el\n })\n\n useEffect(() => {\n const parent = canvas.parentElement!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n parent.appendChild(el);\n return () => {\n parent.removeChild(el);\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n return <>\n {createPortal((\n <CanvasPortal {...props} />\n ), el)}\n </>\n})\nInitCanvasFC.displayName = 'InitCanvasFC';\n"],"names":["el"],"mappings":";;;;AAaa,MAAA,eAAe,KAAwB,CAAC,UAAU;AACvD,QAAA,SAAS,MAAM,IAAI,UAAU;AAEnC,QAAM,CAAC,EAAE,IAAI,SAAS,MAAM;AACpBA,UAAAA,MAAK,SAAS,cAAc,KAAK;AACvCA,QAAG,MAAM,WAAW;AACpBA,QAAG,MAAM,MAAM;AACfA,QAAG,MAAM,SAAS;AAClBA,QAAG,MAAM,OAAO;AAChBA,QAAG,MAAM,QAAQ;AACjBA,QAAG,MAAM,gBAAgB;AAClBA,WAAAA;AAAAA,EAAA,CACR;AAED,YAAU,MAAM;AACd,UAAM,SAAS,OAAO;AACtB,WAAO,YAAY,EAAE;AACrB,WAAO,MAAM;AACX,aAAO,YAAY,EAAE;AAAA,IAAA;AAAA,EAEzB,GAAG,CAAE,CAAA;AACE,SAAA,oBAAA,UAAA,EACJ,uBACE,oBAAA,cAAA,EAAc,GAAG,MAAO,CAAA,GACxB,EAAE,EACP,CAAA;AACF,CAAC;AACD,aAAa,cAAc;"}
|
package/package.json
CHANGED
package/stories/package.json
CHANGED
package/stories/yarn.lock
CHANGED
|
@@ -821,16 +821,16 @@
|
|
|
821
821
|
rw "^1.3.3"
|
|
822
822
|
sort-object "^3.0.3"
|
|
823
823
|
|
|
824
|
-
"@maplibre/maplibre-gl-style-spec@^
|
|
825
|
-
version "
|
|
826
|
-
resolved "https://registry.yarnpkg.com/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-
|
|
827
|
-
integrity sha512-
|
|
824
|
+
"@maplibre/maplibre-gl-style-spec@^20.3.1":
|
|
825
|
+
version "20.4.0"
|
|
826
|
+
resolved "https://registry.yarnpkg.com/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-20.4.0.tgz#408339e051fb51e022b40af2235e0beb037937ea"
|
|
827
|
+
integrity sha512-AzBy3095fTFPjDjmWpR2w6HVRAZJ6hQZUCwk5Plz6EyfnfuQW1odeW5i2Ai47Y6TBA2hQnC+azscjBSALpaWgw==
|
|
828
828
|
dependencies:
|
|
829
829
|
"@mapbox/jsonlint-lines-primitives" "~2.0.2"
|
|
830
830
|
"@mapbox/unitbezier" "^0.0.1"
|
|
831
831
|
json-stringify-pretty-compact "^4.0.0"
|
|
832
832
|
minimist "^1.2.8"
|
|
833
|
-
quickselect "^
|
|
833
|
+
quickselect "^2.0.0"
|
|
834
834
|
rw "^1.3.3"
|
|
835
835
|
tinyqueue "^3.0.0"
|
|
836
836
|
|
|
@@ -1452,7 +1452,7 @@
|
|
|
1452
1452
|
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249"
|
|
1453
1453
|
integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==
|
|
1454
1454
|
|
|
1455
|
-
"@types/geojson@^7946.0.
|
|
1455
|
+
"@types/geojson@^7946.0.14", "@types/geojson@^7946.0.15":
|
|
1456
1456
|
version "7946.0.16"
|
|
1457
1457
|
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.16.tgz#8ebe53d69efada7044454e3305c19017d97ced2a"
|
|
1458
1458
|
integrity sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==
|
|
@@ -2252,7 +2252,7 @@ draco3d@^1.4.1:
|
|
|
2252
2252
|
resolved "https://registry.yarnpkg.com/draco3d/-/draco3d-1.5.6.tgz#0d570a9792e3a3a9fafbfea065b692940441c626"
|
|
2253
2253
|
integrity sha512-+3NaRjWktb5r61ZFoDejlykPEFKT5N/LkbXsaddlw6xNSXBanUYpFc2AXXpbJDilPHazcSreU/DpQIaxfX0NfQ==
|
|
2254
2254
|
|
|
2255
|
-
earcut@^3.0.0
|
|
2255
|
+
earcut@^3.0.0:
|
|
2256
2256
|
version "3.0.1"
|
|
2257
2257
|
resolved "https://registry.yarnpkg.com/earcut/-/earcut-3.0.1.tgz#f60b3f671c5657cca9d3e131c5527c5dde00ef38"
|
|
2258
2258
|
integrity sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==
|
|
@@ -3218,10 +3218,10 @@ mapbox-gl@^3.9.4:
|
|
|
3218
3218
|
tinyqueue "^3.0.0"
|
|
3219
3219
|
vt-pbf "^3.1.3"
|
|
3220
3220
|
|
|
3221
|
-
maplibre-gl@^
|
|
3222
|
-
version "
|
|
3223
|
-
resolved "https://registry.yarnpkg.com/maplibre-gl/-/maplibre-gl-
|
|
3224
|
-
integrity sha512-
|
|
3221
|
+
maplibre-gl@^4.7.1:
|
|
3222
|
+
version "4.7.1"
|
|
3223
|
+
resolved "https://registry.yarnpkg.com/maplibre-gl/-/maplibre-gl-4.7.1.tgz#06a524438ee2aafbe8bcd91002a4e01468ea5486"
|
|
3224
|
+
integrity sha512-lgL7XpIwsgICiL82ITplfS7IGwrB1OJIw/pCvprDp2dhmSSEBgmPzYRvwYYYvJGJD7fxUv1Tvpih4nZ6VrLuaA==
|
|
3225
3225
|
dependencies:
|
|
3226
3226
|
"@mapbox/geojson-rewind" "^0.5.2"
|
|
3227
3227
|
"@mapbox/jsonlint-lines-primitives" "^2.0.2"
|
|
@@ -3230,14 +3230,14 @@ maplibre-gl@^5.1.0:
|
|
|
3230
3230
|
"@mapbox/unitbezier" "^0.0.1"
|
|
3231
3231
|
"@mapbox/vector-tile" "^1.3.1"
|
|
3232
3232
|
"@mapbox/whoots-js" "^3.1.0"
|
|
3233
|
-
"@maplibre/maplibre-gl-style-spec" "^
|
|
3234
|
-
"@types/geojson" "^7946.0.
|
|
3233
|
+
"@maplibre/maplibre-gl-style-spec" "^20.3.1"
|
|
3234
|
+
"@types/geojson" "^7946.0.14"
|
|
3235
3235
|
"@types/geojson-vt" "3.2.5"
|
|
3236
3236
|
"@types/mapbox__point-geometry" "^0.1.4"
|
|
3237
3237
|
"@types/mapbox__vector-tile" "^1.3.4"
|
|
3238
3238
|
"@types/pbf" "^3.0.5"
|
|
3239
3239
|
"@types/supercluster" "^7.1.3"
|
|
3240
|
-
earcut "^3.0.
|
|
3240
|
+
earcut "^3.0.0"
|
|
3241
3241
|
geojson-vt "^4.0.2"
|
|
3242
3242
|
gl-matrix "^3.4.3"
|
|
3243
3243
|
global-prefix "^4.0.0"
|
|
@@ -4196,6 +4196,11 @@ queue-microtask@^1.2.2:
|
|
|
4196
4196
|
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
|
4197
4197
|
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
|
4198
4198
|
|
|
4199
|
+
quickselect@^2.0.0:
|
|
4200
|
+
version "2.0.0"
|
|
4201
|
+
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-2.0.0.tgz#f19680a486a5eefb581303e023e98faaf25dd018"
|
|
4202
|
+
integrity sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==
|
|
4203
|
+
|
|
4199
4204
|
quickselect@^3.0.0:
|
|
4200
4205
|
version "3.0.0"
|
|
4201
4206
|
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-3.0.0.tgz#a37fc953867d56f095a20ac71c6d27063d2de603"
|
package/dist/es/main23.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useThree, _roots } from "@react-three/fiber";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Matrix4 } from "three";
|
|
4
|
-
function useR3M() {
|
|
5
|
-
const r3m = useThree((s) => s.r3m);
|
|
6
|
-
return r3m;
|
|
7
|
-
}
|
|
8
|
-
function useInitR3M(props) {
|
|
9
|
-
const canvas = useThree((s) => s.gl.domElement);
|
|
10
|
-
useState(() => {
|
|
11
|
-
const store = _roots.get(canvas).store;
|
|
12
|
-
initR3M({ ...props, store });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function initR3M({ store, ...props }) {
|
|
16
|
-
const viewProjMx = new Matrix4().identity().toArray();
|
|
17
|
-
const r3m = { ...props, viewProjMx };
|
|
18
|
-
store.setState({ r3m });
|
|
19
|
-
return r3m;
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
initR3M,
|
|
23
|
-
useInitR3M,
|
|
24
|
-
useR3M
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=main23.mjs.map
|
package/dist/es/main23.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main23.mjs","sources":["../../src/core/use-r3m.ts"],"sourcesContent":["import { RootState, _roots, useThree } from \"@react-three/fiber\";\nimport { useState } from \"react\";\nimport { Matrix4, Matrix4Tuple } from \"three\";\nimport { UseBoundStore } from 'zustand';\nimport { FromLngLat, MapInstance } from \"./generic-map\";\n\nexport interface R3M<T extends MapInstance = MapInstance> {\n /** Map provider */\n map: T,\n /** view projection matrix coming from the map provider */\n viewProjMx: Matrix4Tuple,\n fromLngLat: FromLngLat,\n}\n\nexport function useR3M<T extends MapInstance> () {\n const r3m = useThree(s=>(s as any).r3m) as R3M<T>; // eslint-disable-line @typescript-eslint/no-explicit-any\n return r3m;\n}\n\n/** init `useR3M` hook */\nexport function useInitR3M<T extends MapInstance>(props: {\n map: T; fromLngLat: FromLngLat;\n}) {\n const canvas = useThree(s => s.gl.domElement);\n // to run only once\n useState(()=>{\n const store = _roots.get(canvas)!.store; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n initR3M({...props, store})\n })\n}\n\nexport function initR3M<T extends MapInstance>({store, ...props}: {\n map: T;\n fromLngLat: FromLngLat;\n store: UseBoundStore<RootState>;\n}) {\n const viewProjMx = new Matrix4().identity().toArray();\n const r3m : R3M<T> = { ...props, viewProjMx };\n store.setState({r3m} as any); // eslint-disable-line @typescript-eslint/no-explicit-any\n return r3m;\n}"],"names":[],"mappings":";;;AAcO,SAAS,SAAiC;AAC/C,QAAM,MAAM,SAAS,CAAI,MAAA,EAAU,GAAG;AAC/B,SAAA;AACT;AAGO,SAAS,WAAkC,OAE/C;AACD,QAAM,SAAS,SAAS,CAAK,MAAA,EAAE,GAAG,UAAU;AAE5C,WAAS,MAAI;AACX,UAAM,QAAQ,OAAO,IAAI,MAAM,EAAG;AAClC,YAAQ,EAAC,GAAG,OAAO,MAAM,CAAA;AAAA,EAAA,CAC1B;AACH;AAEO,SAAS,QAA+B,EAAC,OAAO,GAAG,SAIvD;AACD,QAAM,aAAa,IAAI,QAAA,EAAU,WAAW,QAAQ;AACpD,QAAM,MAAe,EAAE,GAAG,OAAO,WAAW;AACtC,QAAA,SAAS,EAAC,IAAA,CAAW;AACpB,SAAA;AACT;"}
|
package/dist/es/main24.mjs
DELETED
package/dist/es/main24.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main24.mjs","sources":["../../src/core/earth-radius.ts"],"sourcesContent":["export const earthRadius = 6371008.8;\n"],"names":[],"mappings":"AAAO,MAAM,cAAc;"}
|
package/dist/es/main25.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useThree, _roots } from "@react-three/fiber";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
function useCoords() {
|
|
4
|
-
const coords = useThree((s) => s.coords);
|
|
5
|
-
return coords;
|
|
6
|
-
}
|
|
7
|
-
function useSetCoords({ longitude, latitude, altitude }) {
|
|
8
|
-
const canvas = useThree((s) => s.gl.domElement);
|
|
9
|
-
useMemo(() => {
|
|
10
|
-
const store = _roots.get(canvas).store;
|
|
11
|
-
const coords = { longitude, latitude, altitude };
|
|
12
|
-
setCoords(store, coords);
|
|
13
|
-
}, [longitude, latitude, altitude]);
|
|
14
|
-
}
|
|
15
|
-
function useSetRootCoords(store, {
|
|
16
|
-
longitude,
|
|
17
|
-
latitude,
|
|
18
|
-
altitude
|
|
19
|
-
}) {
|
|
20
|
-
useMemo(() => {
|
|
21
|
-
setCoords(store, { longitude, latitude, altitude });
|
|
22
|
-
}, [longitude, latitude, altitude]);
|
|
23
|
-
}
|
|
24
|
-
function setCoords(store, coords) {
|
|
25
|
-
store.setState({ coords });
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
setCoords,
|
|
29
|
-
useCoords,
|
|
30
|
-
useSetCoords,
|
|
31
|
-
useSetRootCoords
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=main25.mjs.map
|
package/dist/es/main25.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main25.mjs","sources":["../../src/core/use-coords.tsx"],"sourcesContent":["import { RootState, _roots, useThree } from \"@react-three/fiber\";\nimport { useMemo } from \"react\";\nimport { UseBoundStore } from 'zustand';\nimport { Coords } from \"../api/coords\";\n\nexport function useCoords() {\n const coords = useThree(s=>(s as any).coords) as Coords; // eslint-disable-line @typescript-eslint/no-explicit-any\n return coords;\n}\n\nexport function useSetCoords({longitude, latitude, altitude}: Coords) {\n \n const canvas = useThree(s => s.gl.domElement);\n useMemo(()=>{\n const store = _roots.get(canvas)!.store; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n const coords : Coords = { longitude, latitude, altitude };\n setCoords(store, coords);\n }, [longitude, latitude, altitude]) // eslint-disable-line react-hooks/exhaustive-deps\n}\n\nexport function useSetRootCoords(store:UseBoundStore<RootState>, {\n longitude, latitude, altitude\n}: Coords) {\n useMemo(()=>{\n setCoords(store, {longitude, latitude, altitude});\n }, [longitude, latitude, altitude]) // eslint-disable-line react-hooks/exhaustive-deps\n}\n\nexport function setCoords(store:UseBoundStore<RootState>, coords: Coords) {\n store.setState({coords} as any) // eslint-disable-line @typescript-eslint/no-explicit-any\n}"],"names":[],"mappings":";;AAKO,SAAS,YAAY;AAC1B,QAAM,SAAS,SAAS,CAAI,MAAA,EAAU,MAAM;AACrC,SAAA;AACT;AAEO,SAAS,aAAa,EAAC,WAAW,UAAU,YAAmB;AAEpE,QAAM,SAAS,SAAS,CAAK,MAAA,EAAE,GAAG,UAAU;AAC5C,UAAQ,MAAI;AACV,UAAM,QAAQ,OAAO,IAAI,MAAM,EAAG;AAClC,UAAM,SAAkB,EAAE,WAAW,UAAU,SAAS;AACxD,cAAU,OAAO,MAAM;AAAA,EACtB,GAAA,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;AAEO,SAAS,iBAAiB,OAAgC;AAAA,EAC/D;AAAA,EAAW;AAAA,EAAU;AACvB,GAAW;AACT,UAAQ,MAAI;AACV,cAAU,OAAO,EAAC,WAAW,UAAU,SAAS,CAAA;AAAA,EAC/C,GAAA,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;AAEgB,SAAA,UAAU,OAAgC,QAAgB;AAClE,QAAA,SAAS,EAAC,OAAA,CAAc;AAChC;"}
|
package/dist/es/main26.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { syncCamera } from "./main21.mjs";
|
|
2
|
-
import { useFunction } from "./main20.mjs";
|
|
3
|
-
function useRender({
|
|
4
|
-
map,
|
|
5
|
-
origin,
|
|
6
|
-
useThree,
|
|
7
|
-
frameloop,
|
|
8
|
-
r3m
|
|
9
|
-
}) {
|
|
10
|
-
const render = useFunction((_gl, projViewMx) => {
|
|
11
|
-
const pVMx = "defaultProjectionData" in projViewMx ? Object.values(projViewMx.defaultProjectionData.mainMatrix) : projViewMx;
|
|
12
|
-
r3m.viewProjMx.splice(0, 16, ...pVMx);
|
|
13
|
-
const state = useThree.getState();
|
|
14
|
-
const camera = state.camera;
|
|
15
|
-
const { gl, advance } = state;
|
|
16
|
-
syncCamera(camera, origin, projViewMx);
|
|
17
|
-
gl.resetState();
|
|
18
|
-
advance(Date.now() * 1e-3, true);
|
|
19
|
-
if (!frameloop || frameloop === "always")
|
|
20
|
-
map.triggerRepaint();
|
|
21
|
-
});
|
|
22
|
-
return render;
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
useRender
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=main26.mjs.map
|
package/dist/es/main26.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main26.mjs","sources":["../../src/core/canvas-in-layer/use-render.ts"],"sourcesContent":["import { RootState } from \"@react-three/fiber\";\nimport { Matrix4Tuple, PerspectiveCamera } from \"three\";\nimport { UseBoundStore } from \"zustand\";\nimport { MapInstance } from \"../generic-map\";\nimport { syncCamera } from \"../sync-camera\";\nimport { useFunction } from \"../use-function\";\nimport { R3M } from \"../use-r3m\";\n\nexport function useRender({\n map, origin, useThree, frameloop, r3m,\n} :{\n map: MapInstance,\n origin: Matrix4Tuple,\n useThree: UseBoundStore<RootState>,\n frameloop?: 'always' | 'demand',\n r3m: R3M\n}) {\n const render = useFunction((_gl: WebGL2RenderingContext, projViewMx: number[] | {defaultProjectionData: {mainMatrix: Record<string, number>}}) => {\n const pVMx = 'defaultProjectionData' in projViewMx ? Object.values(projViewMx.defaultProjectionData.mainMatrix) : projViewMx;\n r3m.viewProjMx.splice(0, 16, ...pVMx)\n const state = useThree.getState();\n const camera = state.camera as PerspectiveCamera;\n const {gl, advance} = state;\n syncCamera(camera as PerspectiveCamera, origin, projViewMx as Matrix4Tuple);\n gl.resetState();\n advance(Date.now() * 0.001, true);\n if (!frameloop || frameloop === 'always') map.triggerRepaint();\n })\n return render;\n}"],"names":[],"mappings":";;AAQO,SAAS,UAAU;AAAA,EACxB;AAAA,EAAK;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAW;AACpC,GAMG;AACD,QAAM,SAAS,YAAY,CAAC,KAA6B,eAAyF;AAC1I,UAAA,OAAO,2BAA2B,aAAa,OAAO,OAAO,WAAW,sBAAsB,UAAU,IAAI;AAClH,QAAI,WAAW,OAAO,GAAG,IAAI,GAAG,IAAI;AAC9B,UAAA,QAAQ,SAAS;AACvB,UAAM,SAAS,MAAM;AACf,UAAA,EAAC,IAAI,QAAW,IAAA;AACX,eAAA,QAA6B,QAAQ,UAA0B;AAC1E,OAAG,WAAW;AACd,YAAQ,KAAK,IAAQ,IAAA,MAAO,IAAI;AAC5B,QAAA,CAAC,aAAa,cAAc;AAAU,UAAI,eAAe;AAAA,EAAA,CAC9D;AACM,SAAA;AACT;"}
|
package/dist/es/main27.mjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createRoot, _roots } from "@react-three/fiber";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import { events } from "./main30.mjs";
|
|
5
|
-
import { setCoords, useSetRootCoords } from "./main25.mjs";
|
|
6
|
-
import { useFunction } from "./main20.mjs";
|
|
7
|
-
import { initR3M } from "./main23.mjs";
|
|
8
|
-
function useRoot(fromLngLat, map, { frameloop, longitude, latitude, altitude, ...props }) {
|
|
9
|
-
const [{ root, useThree, canvas, r3m }] = useState(() => {
|
|
10
|
-
const canvas2 = map.getCanvas();
|
|
11
|
-
const gl = canvas2.getContext("webgl2") || canvas2.getContext("webgl");
|
|
12
|
-
const root2 = createRoot(canvas2);
|
|
13
|
-
root2.configure({
|
|
14
|
-
dpr: window.devicePixelRatio,
|
|
15
|
-
events,
|
|
16
|
-
...props,
|
|
17
|
-
frameloop: "never",
|
|
18
|
-
gl: {
|
|
19
|
-
context: gl,
|
|
20
|
-
autoClear: false,
|
|
21
|
-
antialias: true,
|
|
22
|
-
...props == null ? void 0 : props.gl
|
|
23
|
-
},
|
|
24
|
-
onCreated: (state) => {
|
|
25
|
-
state.gl.forceContextLoss = () => {
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
camera: {
|
|
29
|
-
matrixAutoUpdate: false,
|
|
30
|
-
near: 0
|
|
31
|
-
},
|
|
32
|
-
size: {
|
|
33
|
-
width: canvas2.clientWidth,
|
|
34
|
-
height: canvas2.clientHeight,
|
|
35
|
-
top: canvas2.offsetTop,
|
|
36
|
-
left: canvas2.offsetLeft,
|
|
37
|
-
updateStyle: false,
|
|
38
|
-
...props == null ? void 0 : props.size
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const store = _roots.get(canvas2).store;
|
|
42
|
-
const r3m2 = initR3M({ map, fromLngLat, store });
|
|
43
|
-
setCoords(store, { longitude, latitude, altitude });
|
|
44
|
-
if (frameloop === "demand") {
|
|
45
|
-
store.setState({
|
|
46
|
-
frameloop,
|
|
47
|
-
invalidate: () => {
|
|
48
|
-
map.triggerRepaint();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return { root: root2, useThree: store, map, canvas: canvas2, r3m: r3m2 };
|
|
53
|
-
});
|
|
54
|
-
const onResize = useFunction(() => {
|
|
55
|
-
const { setDpr, setSize } = useThree.getState();
|
|
56
|
-
setDpr(window.devicePixelRatio);
|
|
57
|
-
setSize(
|
|
58
|
-
canvas.clientWidth,
|
|
59
|
-
canvas.clientHeight,
|
|
60
|
-
false,
|
|
61
|
-
canvas.offsetTop,
|
|
62
|
-
canvas.offsetLeft
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
const onRemove = useFunction(() => {
|
|
66
|
-
root.unmount();
|
|
67
|
-
});
|
|
68
|
-
useSetRootCoords(useThree, { longitude, latitude, altitude });
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (frameloop !== "demand")
|
|
71
|
-
return;
|
|
72
|
-
const setState = useThree.setState;
|
|
73
|
-
const { invalidate } = useThree.getState();
|
|
74
|
-
setState({
|
|
75
|
-
frameloop,
|
|
76
|
-
invalidate: () => {
|
|
77
|
-
map.triggerRepaint();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return () => {
|
|
81
|
-
setState({ frameloop: "never", invalidate });
|
|
82
|
-
};
|
|
83
|
-
}, [frameloop]);
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
map.on("resize", onResize);
|
|
86
|
-
return () => {
|
|
87
|
-
map.off("resize", onResize);
|
|
88
|
-
};
|
|
89
|
-
}, []);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
root.render(/* @__PURE__ */ jsx(Fragment, { children: props.children }));
|
|
92
|
-
}, [props.children]);
|
|
93
|
-
return { onRemove, useThree, r3m };
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
useRoot
|
|
97
|
-
};
|
|
98
|
-
//# sourceMappingURL=main27.mjs.map
|
package/dist/es/main27.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main27.mjs","sources":["../../src/core/canvas-in-layer/use-root.tsx"],"sourcesContent":["import { _roots, createRoot } from \"@react-three/fiber\";\nimport { useEffect, useState } from \"react\";\nimport { CanvasProps } from \"../../api/canvas-props\";\nimport { events } from \"../events\";\nimport { FromLngLat, MapInstance } from \"../generic-map\";\nimport { setCoords, useSetRootCoords } from \"../use-coords\";\nimport { useFunction } from \"../use-function\";\nimport { initR3M } from \"../use-r3m\";\n\nexport function useRoot(\n fromLngLat: FromLngLat,\n map: MapInstance,\n { frameloop, longitude, latitude, altitude, ...props }: CanvasProps\n) {\n\n const [{ root, useThree, canvas, r3m }] = useState(() => {\n const canvas = map.getCanvas();\n const gl = (canvas.getContext('webgl2') || canvas.getContext('webgl')) as WebGLRenderingContext;\n\n const root = createRoot(canvas);\n root.configure({\n dpr: window.devicePixelRatio,\n events,\n ...props,\n frameloop: 'never',\n gl: {\n context: gl,\n autoClear: false,\n antialias: true,\n ...props?.gl,\n },\n onCreated: (state) => {\n state.gl.forceContextLoss = () => { }; // eslint-disable-line @typescript-eslint/no-empty-function\n },\n camera: {\n matrixAutoUpdate: false,\n near: 0,\n },\n size: {\n width: canvas.clientWidth,\n height: canvas.clientHeight,\n top: canvas.offsetTop,\n left: canvas.offsetLeft,\n updateStyle: false,\n ...props?.size,\n },\n });\n\n const store = _roots.get(canvas)!.store; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n\n const r3m = initR3M({ map, fromLngLat, store });\n setCoords(store, {longitude, latitude, altitude});\n\n if (frameloop === 'demand') {\n store.setState({\n frameloop,\n invalidate: () => {\n map.triggerRepaint();\n },\n })\n }\n\n return { root, useThree: store, map, canvas, r3m }\n\n })\n\n const onResize = useFunction(() => {\n\n const { setDpr, setSize } = useThree.getState();\n\n setDpr(window.devicePixelRatio);\n\n setSize(\n canvas.clientWidth,\n canvas.clientHeight,\n false,\n canvas.offsetTop,\n canvas.offsetLeft,\n );\n\n })\n\n const onRemove = useFunction(() => {\n root.unmount();\n })\n\n useSetRootCoords(useThree, {longitude, latitude, altitude});\n\n // on `frameloop` change\n useEffect(() => {\n if (frameloop !== 'demand') return;\n const setState = useThree.setState;\n const { invalidate } = useThree.getState();\n setState({\n frameloop,\n invalidate: () => {\n map.triggerRepaint();\n }\n });\n return () => {\n setState({ frameloop: 'never', invalidate })\n }\n }, [frameloop]) // eslint-disable-line react-hooks/exhaustive-deps\n\n // on mount / unmount\n useEffect(() => {\n map.on('resize', onResize);\n return () => {\n map.off('resize', onResize)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // root.render\n useEffect(() => {\n root.render(<>\n {props.children}\n </>);\n }, [props.children]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { onRemove, useThree, r3m };\n}"],"names":["canvas","root","r3m"],"mappings":";;;;;;;AASgB,SAAA,QACd,YACA,KACA,EAAE,WAAW,WAAW,UAAU,UAAU,GAAG,SAC/C;AAEM,QAAA,CAAC,EAAE,MAAM,UAAU,QAAQ,IAAK,CAAA,IAAI,SAAS,MAAM;AACjDA,UAAAA,UAAS,IAAI;AACnB,UAAM,KAAMA,QAAO,WAAW,QAAQ,KAAKA,QAAO,WAAW,OAAO;AAE9DC,UAAAA,QAAO,WAAWD,OAAM;AAC9BC,UAAK,UAAU;AAAA,MACb,KAAK,OAAO;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,MACH,WAAW;AAAA,MACX,IAAI;AAAA,QACF,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW;AAAA,QACX,GAAG,+BAAO;AAAA,MACZ;AAAA,MACA,WAAW,CAAC,UAAU;AACd,cAAA,GAAG,mBAAmB,MAAM;AAAA,QAAA;AAAA,MACpC;AAAA,MACA,QAAQ;AAAA,QACN,kBAAkB;AAAA,QAClB,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,OAAOD,QAAO;AAAA,QACd,QAAQA,QAAO;AAAA,QACf,KAAKA,QAAO;AAAA,QACZ,MAAMA,QAAO;AAAA,QACb,aAAa;AAAA,QACb,GAAG,+BAAO;AAAA,MACZ;AAAA,IAAA,CACD;AAED,UAAM,QAAQ,OAAO,IAAIA,OAAM,EAAG;AAElC,UAAME,OAAM,QAAQ,EAAE,KAAK,YAAY,OAAO;AAC9C,cAAU,OAAO,EAAC,WAAW,UAAU,SAAS,CAAA;AAEhD,QAAI,cAAc,UAAU;AAC1B,YAAM,SAAS;AAAA,QACb;AAAA,QACA,YAAY,MAAM;AAChB,cAAI,eAAe;AAAA,QACrB;AAAA,MAAA,CACD;AAAA,IACH;AAEO,WAAA,EAAE,MAAAD,OAAM,UAAU,OAAO,KAAK,QAAAD,SAAQ,KAAAE;EAAI,CAElD;AAEK,QAAA,WAAW,YAAY,MAAM;AAEjC,UAAM,EAAE,QAAQ,QAAQ,IAAI,SAAS,SAAS;AAE9C,WAAO,OAAO,gBAAgB;AAE9B;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,MACA,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EACT,CAED;AAEK,QAAA,WAAW,YAAY,MAAM;AACjC,SAAK,QAAQ;AAAA,EAAA,CACd;AAED,mBAAiB,UAAU,EAAC,WAAW,UAAU,SAAS,CAAA;AAG1D,YAAU,MAAM;AACd,QAAI,cAAc;AAAU;AAC5B,UAAM,WAAW,SAAS;AAC1B,UAAM,EAAE,WAAA,IAAe,SAAS,SAAS;AAChC,aAAA;AAAA,MACP;AAAA,MACA,YAAY,MAAM;AAChB,YAAI,eAAe;AAAA,MACrB;AAAA,IAAA,CACD;AACD,WAAO,MAAM;AACX,eAAS,EAAE,WAAW,SAAS,WAAY,CAAA;AAAA,IAAA;AAAA,EAC7C,GACC,CAAC,SAAS,CAAC;AAGd,YAAU,MAAM;AACV,QAAA,GAAG,UAAU,QAAQ;AACzB,WAAO,MAAM;AACP,UAAA,IAAI,UAAU,QAAQ;AAAA,IAAA;AAAA,EAE9B,GAAG,CAAE,CAAA;AAGL,YAAU,MAAM;AACd,SAAK,OAAO,oBAAA,UAAA,EACT,UAAM,MAAA,SACT,CAAA,CAAG;AAAA,EAAA,GACF,CAAC,MAAM,QAAQ,CAAC;AAEZ,SAAA,EAAE,UAAU,UAAU;AAC/B;"}
|