react-babylon-map 0.0.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.
Files changed (211) hide show
  1. package/.claude/settings.local.json +78 -0
  2. package/demo.html +161 -0
  3. package/dist/cjs/main.js +520 -0
  4. package/dist/es/main.mjs +20 -0
  5. package/dist/es/main.mjs.map +1 -0
  6. package/dist/es/main10.mjs +33 -0
  7. package/dist/es/main10.mjs.map +1 -0
  8. package/dist/es/main11.mjs +12 -0
  9. package/dist/es/main11.mjs.map +1 -0
  10. package/dist/es/main12.mjs +14 -0
  11. package/dist/es/main12.mjs.map +1 -0
  12. package/dist/es/main13.mjs +12 -0
  13. package/dist/es/main13.mjs.map +1 -0
  14. package/dist/es/main14.mjs +5 -0
  15. package/dist/es/main14.mjs.map +1 -0
  16. package/dist/es/main15.mjs +12 -0
  17. package/dist/es/main15.mjs.map +1 -0
  18. package/dist/es/main16.mjs +25 -0
  19. package/dist/es/main16.mjs.map +1 -0
  20. package/dist/es/main17.mjs +54 -0
  21. package/dist/es/main17.mjs.map +1 -0
  22. package/dist/es/main18.mjs +88 -0
  23. package/dist/es/main18.mjs.map +1 -0
  24. package/dist/es/main19.mjs +18 -0
  25. package/dist/es/main19.mjs.map +1 -0
  26. package/dist/es/main2.mjs +9 -0
  27. package/dist/es/main2.mjs.map +1 -0
  28. package/dist/es/main20.mjs +21 -0
  29. package/dist/es/main20.mjs.map +1 -0
  30. package/dist/es/main21.mjs +61 -0
  31. package/dist/es/main21.mjs.map +1 -0
  32. package/dist/es/main3.mjs +46 -0
  33. package/dist/es/main3.mjs.map +1 -0
  34. package/dist/es/main4.mjs +23 -0
  35. package/dist/es/main4.mjs.map +1 -0
  36. package/dist/es/main5.mjs +69 -0
  37. package/dist/es/main5.mjs.map +1 -0
  38. package/dist/es/main6.mjs +35 -0
  39. package/dist/es/main6.mjs.map +1 -0
  40. package/dist/es/main7.mjs +65 -0
  41. package/dist/es/main7.mjs.map +1 -0
  42. package/dist/es/main8.mjs +14 -0
  43. package/dist/es/main8.mjs.map +1 -0
  44. package/dist/es/main9.mjs +26 -0
  45. package/dist/es/main9.mjs.map +1 -0
  46. package/dist/maplibre/cjs/main.js +520 -0
  47. package/dist/maplibre/es/main.mjs +20 -0
  48. package/dist/maplibre/es/main.mjs.map +1 -0
  49. package/dist/maplibre/es/main10.mjs +33 -0
  50. package/dist/maplibre/es/main10.mjs.map +1 -0
  51. package/dist/maplibre/es/main11.mjs +12 -0
  52. package/dist/maplibre/es/main11.mjs.map +1 -0
  53. package/dist/maplibre/es/main12.mjs +14 -0
  54. package/dist/maplibre/es/main12.mjs.map +1 -0
  55. package/dist/maplibre/es/main13.mjs +12 -0
  56. package/dist/maplibre/es/main13.mjs.map +1 -0
  57. package/dist/maplibre/es/main14.mjs +5 -0
  58. package/dist/maplibre/es/main14.mjs.map +1 -0
  59. package/dist/maplibre/es/main15.mjs +12 -0
  60. package/dist/maplibre/es/main15.mjs.map +1 -0
  61. package/dist/maplibre/es/main16.mjs +25 -0
  62. package/dist/maplibre/es/main16.mjs.map +1 -0
  63. package/dist/maplibre/es/main17.mjs +54 -0
  64. package/dist/maplibre/es/main17.mjs.map +1 -0
  65. package/dist/maplibre/es/main18.mjs +88 -0
  66. package/dist/maplibre/es/main18.mjs.map +1 -0
  67. package/dist/maplibre/es/main19.mjs +18 -0
  68. package/dist/maplibre/es/main19.mjs.map +1 -0
  69. package/dist/maplibre/es/main2.mjs +9 -0
  70. package/dist/maplibre/es/main2.mjs.map +1 -0
  71. package/dist/maplibre/es/main20.mjs +61 -0
  72. package/dist/maplibre/es/main20.mjs.map +1 -0
  73. package/dist/maplibre/es/main21.mjs +21 -0
  74. package/dist/maplibre/es/main21.mjs.map +1 -0
  75. package/dist/maplibre/es/main3.mjs +46 -0
  76. package/dist/maplibre/es/main3.mjs.map +1 -0
  77. package/dist/maplibre/es/main4.mjs +23 -0
  78. package/dist/maplibre/es/main4.mjs.map +1 -0
  79. package/dist/maplibre/es/main5.mjs +69 -0
  80. package/dist/maplibre/es/main5.mjs.map +1 -0
  81. package/dist/maplibre/es/main6.mjs +35 -0
  82. package/dist/maplibre/es/main6.mjs.map +1 -0
  83. package/dist/maplibre/es/main7.mjs +65 -0
  84. package/dist/maplibre/es/main7.mjs.map +1 -0
  85. package/dist/maplibre/es/main8.mjs +14 -0
  86. package/dist/maplibre/es/main8.mjs.map +1 -0
  87. package/dist/maplibre/es/main9.mjs +26 -0
  88. package/dist/maplibre/es/main9.mjs.map +1 -0
  89. package/dist/maplibre/types/api/canvas-props.d.ts +9 -0
  90. package/dist/maplibre/types/api/coordinates.d.ts +13 -0
  91. package/dist/maplibre/types/api/coords-to-vector-3.d.ts +3 -0
  92. package/dist/maplibre/types/api/coords.d.ts +5 -0
  93. package/dist/maplibre/types/api/index.d.ts +7 -0
  94. package/dist/maplibre/types/api/near-coordinates.d.ts +13 -0
  95. package/dist/maplibre/types/api/use-map.d.ts +3 -0
  96. package/dist/maplibre/types/api/vector-3-to-coords.d.ts +2 -0
  97. package/dist/maplibre/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +15 -0
  98. package/dist/maplibre/types/core/canvas-in-layer/use-render.d.ts +15 -0
  99. package/dist/maplibre/types/core/canvas-in-layer/use-root.d.ts +11 -0
  100. package/dist/maplibre/types/core/canvas-overlay/canvas-portal.d.ts +10 -0
  101. package/dist/maplibre/types/core/canvas-overlay/init-canvas-fc.d.ts +11 -0
  102. package/dist/maplibre/types/core/canvas-overlay/render.d.ts +1 -0
  103. package/dist/maplibre/types/core/canvas-overlay/sync-camera-fc.d.ts +12 -0
  104. package/dist/maplibre/types/core/coords-to-matrix.d.ts +9 -0
  105. package/dist/maplibre/types/core/earth-radius.d.ts +1 -0
  106. package/dist/maplibre/types/core/generic-map.d.ts +49 -0
  107. package/dist/maplibre/types/core/matrix-utils.d.ts +7 -0
  108. package/dist/maplibre/types/core/sync-camera.d.ts +7 -0
  109. package/dist/maplibre/types/core/use-babylon-map.d.ts +32 -0
  110. package/dist/maplibre/types/core/use-coords-to-matrix.d.ts +6 -0
  111. package/dist/maplibre/types/core/use-coords.d.ts +5 -0
  112. package/dist/maplibre/types/core/use-function.d.ts +1 -0
  113. package/dist/maplibre/types/maplibre/canvas.d.ts +4 -0
  114. package/dist/maplibre/types/maplibre.index.d.ts +4 -0
  115. package/dist/types/api/canvas-props.d.ts +9 -0
  116. package/dist/types/api/coordinates.d.ts +13 -0
  117. package/dist/types/api/coords-to-vector-3.d.ts +3 -0
  118. package/dist/types/api/coords.d.ts +5 -0
  119. package/dist/types/api/index.d.ts +7 -0
  120. package/dist/types/api/near-coordinates.d.ts +13 -0
  121. package/dist/types/api/use-map.d.ts +3 -0
  122. package/dist/types/api/vector-3-to-coords.d.ts +2 -0
  123. package/dist/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +15 -0
  124. package/dist/types/core/canvas-in-layer/use-render.d.ts +15 -0
  125. package/dist/types/core/canvas-in-layer/use-root.d.ts +11 -0
  126. package/dist/types/core/canvas-overlay/canvas-portal.d.ts +10 -0
  127. package/dist/types/core/canvas-overlay/init-canvas-fc.d.ts +11 -0
  128. package/dist/types/core/canvas-overlay/render.d.ts +1 -0
  129. package/dist/types/core/canvas-overlay/sync-camera-fc.d.ts +12 -0
  130. package/dist/types/core/coords-to-matrix.d.ts +9 -0
  131. package/dist/types/core/earth-radius.d.ts +1 -0
  132. package/dist/types/core/generic-map.d.ts +49 -0
  133. package/dist/types/core/matrix-utils.d.ts +7 -0
  134. package/dist/types/core/sync-camera.d.ts +7 -0
  135. package/dist/types/core/use-babylon-map.d.ts +32 -0
  136. package/dist/types/core/use-coords-to-matrix.d.ts +6 -0
  137. package/dist/types/core/use-coords.d.ts +5 -0
  138. package/dist/types/core/use-function.d.ts +1 -0
  139. package/dist/types/mapbox/canvas.d.ts +4 -0
  140. package/dist/types/mapbox.index.d.ts +4 -0
  141. package/package.json +58 -0
  142. package/plan.md +719 -0
  143. package/src/api/canvas-props.ts +10 -0
  144. package/src/api/coordinates.tsx +83 -0
  145. package/src/api/coords-to-vector-3.ts +39 -0
  146. package/src/api/coords.tsx +6 -0
  147. package/src/api/index.ts +7 -0
  148. package/src/api/near-coordinates.tsx +87 -0
  149. package/src/api/use-map.ts +8 -0
  150. package/src/api/vector-3-to-coords.ts +13 -0
  151. package/src/core/canvas-in-layer/use-canvas-in-layer.tsx +27 -0
  152. package/src/core/canvas-in-layer/use-render.ts +43 -0
  153. package/src/core/canvas-in-layer/use-root.tsx +82 -0
  154. package/src/core/canvas-overlay/canvas-portal.tsx +98 -0
  155. package/src/core/canvas-overlay/init-canvas-fc.tsx +45 -0
  156. package/src/core/canvas-overlay/render.tsx +1 -0
  157. package/src/core/canvas-overlay/sync-camera-fc.tsx +83 -0
  158. package/src/core/coords-to-matrix.ts +21 -0
  159. package/src/core/earth-radius.ts +1 -0
  160. package/src/core/events.ts +55 -0
  161. package/src/core/generic-map.ts +59 -0
  162. package/src/core/map-engine.tsx +70 -0
  163. package/src/core/matrix-utils.ts +22 -0
  164. package/src/core/sync-camera.ts +29 -0
  165. package/src/core/use-babylon-map.ts +46 -0
  166. package/src/core/use-coords-to-matrix.ts +13 -0
  167. package/src/core/use-coords.tsx +22 -0
  168. package/src/core/use-function.ts +10 -0
  169. package/src/mapbox/canvas.tsx +59 -0
  170. package/src/mapbox.index.ts +7 -0
  171. package/src/maplibre/canvas.tsx +59 -0
  172. package/src/maplibre.index.ts +7 -0
  173. package/src/vite-env.d.ts +1 -0
  174. package/stories/.ladle/components.tsx +50 -0
  175. package/stories/.ladle/style.css +63 -0
  176. package/stories/package.json +31 -0
  177. package/stories/pnpm-lock.yaml +5450 -0
  178. package/stories/sandbox.config.json +3 -0
  179. package/stories/src/adaptive-dpr.tsx +34 -0
  180. package/stories/src/billboard.stories.tsx +111 -0
  181. package/stories/src/buildings-3d.stories.tsx +280 -0
  182. package/stories/src/canvas/mapbox.stories.tsx +113 -0
  183. package/stories/src/canvas/maplibre.stories.tsx +93 -0
  184. package/stories/src/comparison.stories.tsx +161 -0
  185. package/stories/src/extrude/chaillot.ts +8 -0
  186. package/stories/src/exude-coordinates.stories.tsx +139 -0
  187. package/stories/src/free-3d-buildings/get-buildings-data.ts +49 -0
  188. package/stories/src/html-on-top.stories.tsx +156 -0
  189. package/stories/src/ifc/ifc-to-babylon.ts +97 -0
  190. package/stories/src/ifc/ifc.main.ts +904 -0
  191. package/stories/src/ifc/ifc2bb.ts +343 -0
  192. package/stories/src/ifc/model.ifc +14155 -0
  193. package/stories/src/ifc.stories.tsx +276 -0
  194. package/stories/src/mapbox/story-mapbox.tsx +97 -0
  195. package/stories/src/maplibre/story-maplibre.tsx +36 -0
  196. package/stories/src/multi-coordinates.stories.tsx +115 -0
  197. package/stories/src/pivot-controls.stories.tsx +148 -0
  198. package/stories/src/postprocessing.stories.tsx +125 -0
  199. package/stories/src/render-on-demand.stories.tsx +76 -0
  200. package/stories/src/story-map.tsx +44 -0
  201. package/stories/src/sunlight.stories.tsx +215 -0
  202. package/stories/src/vite-env.d.ts +1 -0
  203. package/stories/tsconfig.json +32 -0
  204. package/stories/tsconfig.node.json +10 -0
  205. package/stories/vite.config.ts +27 -0
  206. package/tsconfig.json +31 -0
  207. package/tsconfig.mapbox.json +7 -0
  208. package/tsconfig.maplibre.json +7 -0
  209. package/tsconfig.node.json +10 -0
  210. package/tsconfig.types.json +25 -0
  211. package/vite.config.ts +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main7.mjs","sources":["../../../src/api/near-coordinates.tsx"],"sourcesContent":["import { Color4, FreeCamera, HemisphericLight, Scene, Vector3 } from '@babylonjs/core';\nimport { memo, useEffect, useRef, useState } from 'react';\nimport { useBabylonMap, BabylonMapContext } from '../core/use-babylon-map';\nimport type { BabylonMap } from '../core/use-babylon-map';\nimport { useCoords } from '../core/use-coords';\nimport { coordsToVector3 } from './coords-to-vector-3';\n\nexport interface NearCoordinatesProps {\n longitude: number;\n latitude: number;\n altitude?: number;\n children?: React.ReactNode;\n}\n\n/**\n * Place 3D content at a nearby coordinate (relative to the Canvas origin).\n * Uses the sub-scene approach like Coordinates but computes a relative offset\n * for the camera's world matrix.\n */\nexport const NearCoordinates = memo<NearCoordinatesProps>(({ children, ...coords }) => {\n const { latitude, longitude, altitude } = useCoords();\n const babylonMap = useBabylonMap();\n\n const pos = coordsToVector3(coords, { latitude, longitude, altitude });\n\n // Create a sub-scene for this coordinate portal\n const [subScene] = useState(() => {\n if (!babylonMap.engine) return null;\n const sub = new Scene(babylonMap.engine);\n sub.autoClear = false;\n sub.clearColor = new Color4(0, 0, 0, 0);\n return sub;\n });\n\n const cameraRef = useRef<FreeCamera | null>(null);\n\n // Create camera + default light in sub-scene\n useEffect(() => {\n if (!subScene) return;\n const cam = new FreeCamera('nearCoordsCam', new Vector3(pos[0], pos[1], pos[2]), subScene);\n cam.inputs.clear();\n cam.minZ = 0;\n cameraRef.current = cam;\n\n const light = new HemisphericLight('nearCoordsLight', new Vector3(0, 1, 0), subScene);\n light.intensity = 1;\n\n return () => { cam.dispose(); light.dispose(); };\n }, [subScene]);\n\n // Update camera position when offset changes\n useEffect(() => {\n if (!cameraRef.current) return;\n cameraRef.current.position.set(pos[0], pos[1], pos[2]);\n }, [pos]);\n\n // Render the sub-scene each frame\n useEffect(() => {\n if (!subScene || !babylonMap.scene) return;\n const mainScene = babylonMap.scene;\n\n const observer = mainScene.onBeforeRenderObservable.add(() => {\n if (!cameraRef.current) return;\n // Use the same projection as the main scene but offset by local position\n cameraRef.current.freezeProjectionMatrix(babylonMap.scene!.activeCamera!.getProjectionMatrix());\n babylonMap.engine?.wipeCaches(true);\n subScene.render(false);\n });\n\n return () => {\n mainScene.onBeforeRenderObservable.remove(observer);\n };\n }, [subScene, babylonMap.scene, babylonMap]);\n\n // Provide child context pointing at the sub-scene\n const childMap: BabylonMap = {\n ...babylonMap,\n scene: subScene || undefined,\n };\n\n return (\n <BabylonMapContext.Provider value={childMap}>\n {children}\n </BabylonMapContext.Provider>\n );\n});\nNearCoordinates.displayName = 'NearCoordinates';\n"],"names":[],"mappings":";;;;;;AAmBO,MAAM,kBAAkB,KAA2B,CAAC,EAAE,UAAU,GAAG,aAAa;AACrF,QAAM,EAAE,UAAU,WAAW,aAAa,UAAU;AACpD,QAAM,aAAa;AAEnB,QAAM,MAAM,gBAAgB,QAAQ,EAAE,UAAU,WAAW,UAAU;AAGrE,QAAM,CAAC,QAAQ,IAAI,SAAS,MAAM;AAChC,QAAI,CAAC,WAAW;AAAe,aAAA;AAC/B,UAAM,MAAM,IAAI,MAAM,WAAW,MAAM;AACvC,QAAI,YAAY;AAChB,QAAI,aAAa,IAAI,OAAO,GAAG,GAAG,GAAG,CAAC;AAC/B,WAAA;AAAA,EAAA,CACR;AAEK,QAAA,YAAY,OAA0B,IAAI;AAGhD,YAAU,MAAM;AACd,QAAI,CAAC;AAAU;AACf,UAAM,MAAM,IAAI,WAAW,iBAAiB,IAAI,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,QAAQ;AACzF,QAAI,OAAO;AACX,QAAI,OAAO;AACX,cAAU,UAAU;AAEd,UAAA,QAAQ,IAAI,iBAAiB,mBAAmB,IAAI,QAAQ,GAAG,GAAG,CAAC,GAAG,QAAQ;AACpF,UAAM,YAAY;AAElB,WAAO,MAAM;AAAE,UAAI,QAAQ;AAAG,YAAM,QAAQ;AAAA,IAAA;AAAA,EAAG,GAC9C,CAAC,QAAQ,CAAC;AAGb,YAAU,MAAM;AACd,QAAI,CAAC,UAAU;AAAS;AACd,cAAA,QAAQ,SAAS,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAAA,EAAA,GACpD,CAAC,GAAG,CAAC;AAGR,YAAU,MAAM;AACV,QAAA,CAAC,YAAY,CAAC,WAAW;AAAO;AACpC,UAAM,YAAY,WAAW;AAE7B,UAAM,WAAW,UAAU,yBAAyB,IAAI,MAAM;;AAC5D,UAAI,CAAC,UAAU;AAAS;AAExB,gBAAU,QAAQ,uBAAuB,WAAW,MAAO,aAAc,qBAAqB;AACnF,uBAAA,WAAA,mBAAQ,WAAW;AAC9B,eAAS,OAAO,KAAK;AAAA,IAAA,CACtB;AAED,WAAO,MAAM;AACD,gBAAA,yBAAyB,OAAO,QAAQ;AAAA,IAAA;AAAA,KAEnD,CAAC,UAAU,WAAW,OAAO,UAAU,CAAC;AAG3C,QAAM,WAAuB;AAAA,IAC3B,GAAG;AAAA,IACH,OAAO,YAAY;AAAA,EAAA;AAGrB,6BACG,kBAAkB,UAAlB,EAA2B,OAAO,UAChC,SACH,CAAA;AAEJ,CAAC;AACD,gBAAgB,cAAc;"}
@@ -0,0 +1,14 @@
1
+ import { earthRadius } from "./main14.mjs";
2
+ const DEG2RAD = Math.PI / 180;
3
+ const RAD2DEG = 180 / Math.PI;
4
+ function vector3ToCoords(position, origin) {
5
+ const [x, y, z] = position;
6
+ const latitude = origin.latitude + -z / earthRadius * RAD2DEG;
7
+ const longitude = origin.longitude + x / earthRadius * RAD2DEG / Math.cos(origin.latitude * DEG2RAD);
8
+ const altitude = (origin.altitude || 0) + y;
9
+ return { latitude, longitude, altitude };
10
+ }
11
+ export {
12
+ vector3ToCoords
13
+ };
14
+ //# sourceMappingURL=main8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main8.mjs","sources":["../../../src/api/vector-3-to-coords.ts"],"sourcesContent":["import { earthRadius } from '../core/earth-radius';\nimport { Coords } from './coords';\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\nexport function vector3ToCoords(position: [number, number, number], origin: Coords): Coords {\n const [x, y, z] = position;\n const latitude = origin.latitude + (-z / earthRadius) * RAD2DEG;\n const longitude = origin.longitude + (x / earthRadius) * RAD2DEG / Math.cos(origin.latitude * DEG2RAD);\n const altitude = (origin.altitude || 0) + y;\n return { latitude, longitude, altitude };\n}\n"],"names":[],"mappings":";AAGA,MAAM,UAAU,KAAK,KAAK;AAC1B,MAAM,UAAU,MAAM,KAAK;AAEX,SAAA,gBAAgB,UAAoC,QAAwB;AAC1F,QAAM,CAAC,GAAG,GAAG,CAAC,IAAI;AAClB,QAAM,WAAW,OAAO,WAAY,CAAC,IAAI,cAAe;AAClD,QAAA,YAAY,OAAO,YAAa,IAAI,cAAe,UAAU,KAAK,IAAI,OAAO,WAAW,OAAO;AAC/F,QAAA,YAAY,OAAO,YAAY,KAAK;AACnC,SAAA,EAAE,UAAU,WAAW;AAChC;"}
@@ -0,0 +1,26 @@
1
+ import { useCoordsToMatrix } from "./main13.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
11
+ });
12
+ const { onRemove, scene, camera, babylonMap } = useRoot(fromLngLat, map, props);
13
+ const render = useRender({ origin, frameloop, scene, camera, map, babylonMap });
14
+ return {
15
+ id: props.id,
16
+ beforeId: props.beforeId,
17
+ onRemove,
18
+ render,
19
+ type: "custom",
20
+ renderingMode: "3d"
21
+ };
22
+ }
23
+ export {
24
+ useCanvasInLayer
25
+ };
26
+ //# sourceMappingURL=main9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main9.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 needed to render as a map `<Layer>` */\nexport function useCanvasInLayer(props: CanvasProps, fromLngLat: FromLngLat, map: MapInstance) {\n const { latitude, longitude, altitude, frameloop } = props;\n\n const origin = useCoordsToMatrix({\n latitude, longitude, altitude, fromLngLat,\n });\n\n const { onRemove, scene, camera, babylonMap } = useRoot(fromLngLat, map, props);\n\n const render = useRender({ origin, frameloop, scene, camera, map, babylonMap });\n\n return {\n id: props.id,\n beforeId: props.beforeId,\n onRemove,\n render,\n type: 'custom' as const,\n renderingMode: '3d' as const,\n };\n}\n"],"names":[],"mappings":";;;AAOgB,SAAA,iBAAiB,OAAoB,YAAwB,KAAkB;AAC7F,QAAM,EAAE,UAAU,WAAW,UAAU,cAAc;AAErD,QAAM,SAAS,kBAAkB;AAAA,IAC/B;AAAA,IAAU;AAAA,IAAW;AAAA,IAAU;AAAA,EAAA,CAChC;AAEK,QAAA,EAAE,UAAU,OAAO,QAAQ,eAAe,QAAQ,YAAY,KAAK,KAAK;AAExE,QAAA,SAAS,UAAU,EAAE,QAAQ,WAAW,OAAO,QAAQ,KAAK,WAAA,CAAY;AAEvE,SAAA;AAAA,IACL,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,eAAe;AAAA,EAAA;AAEnB;"}
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { Coords } from './coords';
3
+ export interface CanvasProps extends Coords, PropsWithChildren {
4
+ id?: string;
5
+ beforeId?: string;
6
+ frameloop?: 'always' | 'demand';
7
+ /** render on a separated `<canvas>` that sits on top of the map provider */
8
+ overlay?: boolean;
9
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface CoordinatesProps {
3
+ longitude: number;
4
+ latitude: number;
5
+ altitude?: number;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Place 3D content at specific geographic coordinates inside a `<Canvas>`.
10
+ * Creates a sub-scene with its own camera synced to the given geo position,
11
+ * mirroring react-three-map's createPortal approach.
12
+ */
13
+ export declare const Coordinates: import("react").NamedExoticComponent<CoordinatesProps>;
@@ -0,0 +1,3 @@
1
+ import { Coords } from './coords';
2
+ export declare function averageMercatorScale(originLat: number, pointLat: number, steps?: number): number;
3
+ export declare function coordsToVector3(point: Coords, origin: Coords): [number, number, number];
@@ -0,0 +1,5 @@
1
+ export interface Coords {
2
+ longitude: number;
3
+ latitude: number;
4
+ altitude?: number;
5
+ }
@@ -0,0 +1,7 @@
1
+ export * from './canvas-props';
2
+ export * from './coordinates';
3
+ export * from './coords';
4
+ export * from './coords-to-vector-3';
5
+ export * from './near-coordinates';
6
+ export * from './vector-3-to-coords';
7
+ export { useBabylonMap, BabylonMapContext } from '../core/use-babylon-map';
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface NearCoordinatesProps {
3
+ longitude: number;
4
+ latitude: number;
5
+ altitude?: number;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Place 3D content at a nearby coordinate (relative to the Canvas origin).
10
+ * Uses the sub-scene approach like Coordinates but computes a relative offset
11
+ * for the camera's world matrix.
12
+ */
13
+ export declare const NearCoordinates: import("react").NamedExoticComponent<NearCoordinatesProps>;
@@ -0,0 +1,3 @@
1
+ import { MapInstance } from '../core/generic-map';
2
+ /** Access the underlying map instance from inside a `<Canvas>`. */
3
+ export declare const useMap: <T extends MapInstance = MapInstance>() => T;
@@ -0,0 +1,2 @@
1
+ import { Coords } from './coords';
2
+ export declare function vector3ToCoords(position: [number, number, number], origin: Coords): Coords;
@@ -0,0 +1,15 @@
1
+ import { CanvasProps } from '../../api/canvas-props';
2
+ import { FromLngLat, MapInstance } from '../generic-map';
3
+ /** Get all the properties needed to render as a map `<Layer>` */
4
+ export declare function useCanvasInLayer(props: CanvasProps, fromLngLat: FromLngLat, map: MapInstance): {
5
+ id: string | undefined;
6
+ beforeId: string | undefined;
7
+ onRemove: () => void;
8
+ render: (_gl: WebGL2RenderingContext, projViewMx: number[] | {
9
+ defaultProjectionData: {
10
+ mainMatrix: Record<string, number>;
11
+ };
12
+ }) => void;
13
+ type: "custom";
14
+ renderingMode: "3d";
15
+ };
@@ -0,0 +1,15 @@
1
+ import { FreeCamera, Matrix, Scene } from '@babylonjs/core';
2
+ import { MapInstance } from '../generic-map';
3
+ import { BabylonMap } from '../use-babylon-map';
4
+ export declare function useRender({ map, origin, scene, camera, frameloop, babylonMap, }: {
5
+ map: MapInstance;
6
+ origin: Matrix;
7
+ scene: Scene;
8
+ camera: FreeCamera;
9
+ frameloop?: 'always' | 'demand';
10
+ babylonMap: BabylonMap;
11
+ }): (_gl: WebGL2RenderingContext, projViewMx: number[] | {
12
+ defaultProjectionData: {
13
+ mainMatrix: Record<string, number>;
14
+ };
15
+ }) => void;
@@ -0,0 +1,11 @@
1
+ import { Engine, FreeCamera, Scene } from '@babylonjs/core';
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { BabylonMap } from '../use-babylon-map';
4
+ import { FromLngLat, MapInstance } from '../generic-map';
5
+ export declare function useRoot(fromLngLat: FromLngLat, map: MapInstance, { longitude, latitude, altitude, frameloop, ...props }: CanvasProps): {
6
+ onRemove: () => void;
7
+ engine: Engine;
8
+ scene: Scene;
9
+ camera: FreeCamera;
10
+ babylonMap: BabylonMap<MapInstance>;
11
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { FromLngLat, MapInstance } from '../generic-map';
4
+ interface CanvasPortalProps extends CanvasProps {
5
+ setOnRender: (callback: () => (mx: number[]) => void) => void;
6
+ map: MapInstance;
7
+ fromLngLat: FromLngLat;
8
+ }
9
+ export declare const CanvasPortal: import("react").NamedExoticComponent<CanvasPortalProps>;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { FromLngLat, MapInstance } from '../generic-map';
4
+ interface InitCanvasFCProps extends CanvasProps {
5
+ map: MapInstance;
6
+ setOnRender: (callback: () => (mx: number[]) => void) => void;
7
+ frameloop?: 'always' | 'demand';
8
+ fromLngLat: FromLngLat;
9
+ }
10
+ export declare const InitCanvasFC: import("react").NamedExoticComponent<InitCanvasFCProps>;
11
+ export {};
@@ -0,0 +1 @@
1
+ export type Render = (gl: WebGLRenderingContext, matrix: number[]) => void;
@@ -0,0 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ import { Coords } from '../../api/coords';
3
+ import { MapInstance } from '../generic-map';
4
+ interface SyncCameraFCProps extends Coords {
5
+ setOnRender?: (callback: () => (mx: number[]) => void) => void;
6
+ onReady?: () => void;
7
+ map: MapInstance;
8
+ canvasRef: RefObject<HTMLCanvasElement | null>;
9
+ }
10
+ /** React component to sync the Babylon camera with the map provider on each render. */
11
+ export declare const SyncCameraFC: import("react").NamedExoticComponent<SyncCameraFCProps>;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Matrix } from '@babylonjs/core';
2
+ import { FromLngLat } from './generic-map';
3
+ import { Coords } from '../api/coords';
4
+ /** Calculate Babylon.js Matrix from coordinates.
5
+ * Returns a Babylon Matrix (world transform at the given geo coord).
6
+ * Matches the pattern from MapLibre + Babylon.js integration demo. */
7
+ export declare function coordsToMatrix({ longitude, latitude, altitude, fromLngLat }: Coords & {
8
+ fromLngLat: FromLngLat;
9
+ }): Matrix;
@@ -0,0 +1 @@
1
+ export declare const earthRadius = 6371008.8;
@@ -0,0 +1,49 @@
1
+ /** Generic interface of Mapbox/Maplibre `LayerProps` */
2
+ export interface LayerProps {
3
+ id: string;
4
+ type: 'custom';
5
+ renderingMode: '3d';
6
+ onRemove?(map: MapInstance, gl: WebGLRenderingContext): void;
7
+ onAdd?(map: MapInstance, gl: WebGLRenderingContext): void;
8
+ prerender?(gl: WebGLRenderingContext, matrix: number[]): void;
9
+ render(gl: WebGLRenderingContext, matrix: number[]): void;
10
+ }
11
+ /** Generic interface of Mapbox/Maplibre `LngLatLike` */
12
+ export type LngLatLike = {
13
+ lng: number;
14
+ lat: number;
15
+ } | {
16
+ lon: number;
17
+ lat: number;
18
+ } | [
19
+ number,
20
+ number
21
+ ];
22
+ /** Generic interface of Mapbox/Maplibre `static MercatorCoordinate.fromLngLat` */
23
+ export type FromLngLat = (lngLatLike: LngLatLike, altitude?: number) => MercatorCoordinate;
24
+ /** Generic interface of Mapbox/Maplibre typeof `MercatorCoordinate` */
25
+ export interface MercatorCoordinate {
26
+ x: number;
27
+ y: number;
28
+ z?: number;
29
+ meterInMercatorCoordinateUnits(): number;
30
+ }
31
+ /** Generic interface of Mapbox/Maplibre `Map` */
32
+ export interface MapInstance {
33
+ getCanvas(): HTMLCanvasElement;
34
+ /** MapLibre only */
35
+ getPixelRatio?: () => number;
36
+ triggerRepaint(): void;
37
+ on<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): void;
38
+ off<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): void;
39
+ }
40
+ /** Generic interface of Mapbox/Maplibre `MapEventType` */
41
+ export type MapEventType = {
42
+ resize: MapEvent;
43
+ };
44
+ /** Generic interface of `MapLibreEvent` or `MapBoxEvent` */
45
+ export interface MapEvent<TOrig = unknown> {
46
+ type: string;
47
+ target: MapInstance;
48
+ originalEvent: TOrig;
49
+ }
@@ -0,0 +1,7 @@
1
+ import { Matrix } from '@babylonjs/core';
2
+ /** Column-major (MapLibre) → transposed flat array (Babylon row-major layout) */
3
+ export declare function transposeMatrix(m: number[]): number[];
4
+ /** MapLibre column-major matrix → Babylon.js Matrix */
5
+ export declare function columnMajorToBabylonMatrix(m: number[]): Matrix;
6
+ /** Extract a flat column-major array from a Babylon Matrix (for MapLibre interop) */
7
+ export declare function babylonMatrixToColumnMajor(m: Matrix): number[];
@@ -0,0 +1,7 @@
1
+ import { FreeCamera, Matrix } from '@babylonjs/core';
2
+ /** Synchronise a Babylon camera with the map's view-projection matrix.
3
+ * @param camera The Babylon camera to update.
4
+ * @param origin Babylon world matrix for the Canvas origin.
5
+ * @param mapCamMx Flat array from MapLibre's view-projection (column-major).
6
+ */
7
+ export declare function syncCamera(camera: FreeCamera, origin: Matrix, mapCamMx: number[]): void;
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ import { Engine, Scene } from '@babylonjs/core';
3
+ import { FromLngLat, MapInstance } from './generic-map';
4
+ /** Context object shared between both rendering modes. */
5
+ export interface BabylonMap<T extends MapInstance = MapInstance> {
6
+ /** Map provider instance */
7
+ map: T;
8
+ /** Column-major view-projection matrix from the map provider */
9
+ viewProjMx: number[];
10
+ /** Mercator coordinate factory */
11
+ fromLngLat: FromLngLat;
12
+ /** Babylon Engine (may be null during init) */
13
+ engine?: Engine;
14
+ /** Babylon Scene (may be null during init) */
15
+ scene?: Scene;
16
+ /** Current origin coordinates (set by Canvas) */
17
+ coords?: {
18
+ longitude: number;
19
+ latitude: number;
20
+ altitude?: number;
21
+ };
22
+ }
23
+ export declare const BabylonMapContext: import("react").Context<BabylonMap<MapInstance> | null>;
24
+ /** Access the current BabylonMap context (map, scene, engine, viewProjMx). */
25
+ export declare function useBabylonMap<T extends MapInstance = MapInstance>(): BabylonMap<T>;
26
+ /** Initialise / update the BabylonMap context value. */
27
+ export declare function createBabylonMap<T extends MapInstance>(opts: {
28
+ map: T;
29
+ fromLngLat: FromLngLat;
30
+ engine?: Engine;
31
+ scene?: Scene;
32
+ }): BabylonMap<T>;
@@ -0,0 +1,6 @@
1
+ import { Matrix } from '@babylonjs/core';
2
+ import { coordsToMatrix } from './coords-to-matrix';
3
+ type Props = Parameters<typeof coordsToMatrix>[0];
4
+ /** Calculate a Babylon Matrix from coordinates (memoised). */
5
+ export declare function useCoordsToMatrix({ latitude, longitude, altitude, fromLngLat }: Props): Matrix;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Coords } from '../api/coords';
2
+ /** Read the current coordinates from context. */
3
+ export declare function useCoords(): Coords;
4
+ /** Update the coordinates stored on the context. */
5
+ export declare function useSetCoords({ longitude, latitude, altitude }: Coords): void;
@@ -0,0 +1 @@
1
+ export declare const useFunction: <T extends (...args: any[]) => any>(callback: T) => T;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { CanvasProps } from '../api/canvas-props';
3
+ /** `react-babylon-map` canvas inside `MapLibre` */
4
+ export declare const Canvas: import("react").NamedExoticComponent<CanvasProps>;
@@ -0,0 +1,4 @@
1
+ import type { Map } from 'maplibre-gl';
2
+ export * from './api';
3
+ export * from './maplibre/canvas';
4
+ export declare const useMap: () => Map;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { Coords } from './coords';
3
+ export interface CanvasProps extends Coords, PropsWithChildren {
4
+ id?: string;
5
+ beforeId?: string;
6
+ frameloop?: 'always' | 'demand';
7
+ /** render on a separated `<canvas>` that sits on top of the map provider */
8
+ overlay?: boolean;
9
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface CoordinatesProps {
3
+ longitude: number;
4
+ latitude: number;
5
+ altitude?: number;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Place 3D content at specific geographic coordinates inside a `<Canvas>`.
10
+ * Creates a sub-scene with its own camera synced to the given geo position,
11
+ * mirroring react-three-map's createPortal approach.
12
+ */
13
+ export declare const Coordinates: import("react").NamedExoticComponent<CoordinatesProps>;
@@ -0,0 +1,3 @@
1
+ import { Coords } from './coords';
2
+ export declare function averageMercatorScale(originLat: number, pointLat: number, steps?: number): number;
3
+ export declare function coordsToVector3(point: Coords, origin: Coords): [number, number, number];
@@ -0,0 +1,5 @@
1
+ export interface Coords {
2
+ longitude: number;
3
+ latitude: number;
4
+ altitude?: number;
5
+ }
@@ -0,0 +1,7 @@
1
+ export * from './canvas-props';
2
+ export * from './coordinates';
3
+ export * from './coords';
4
+ export * from './coords-to-vector-3';
5
+ export * from './near-coordinates';
6
+ export * from './vector-3-to-coords';
7
+ export { useBabylonMap, BabylonMapContext } from '../core/use-babylon-map';
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface NearCoordinatesProps {
3
+ longitude: number;
4
+ latitude: number;
5
+ altitude?: number;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Place 3D content at a nearby coordinate (relative to the Canvas origin).
10
+ * Uses the sub-scene approach like Coordinates but computes a relative offset
11
+ * for the camera's world matrix.
12
+ */
13
+ export declare const NearCoordinates: import("react").NamedExoticComponent<NearCoordinatesProps>;
@@ -0,0 +1,3 @@
1
+ import { MapInstance } from '../core/generic-map';
2
+ /** Access the underlying map instance from inside a `<Canvas>`. */
3
+ export declare const useMap: <T extends MapInstance = MapInstance>() => T;
@@ -0,0 +1,2 @@
1
+ import { Coords } from './coords';
2
+ export declare function vector3ToCoords(position: [number, number, number], origin: Coords): Coords;
@@ -0,0 +1,15 @@
1
+ import { CanvasProps } from '../../api/canvas-props';
2
+ import { FromLngLat, MapInstance } from '../generic-map';
3
+ /** Get all the properties needed to render as a map `<Layer>` */
4
+ export declare function useCanvasInLayer(props: CanvasProps, fromLngLat: FromLngLat, map: MapInstance): {
5
+ id: string | undefined;
6
+ beforeId: string | undefined;
7
+ onRemove: () => void;
8
+ render: (_gl: WebGL2RenderingContext, projViewMx: number[] | {
9
+ defaultProjectionData: {
10
+ mainMatrix: Record<string, number>;
11
+ };
12
+ }) => void;
13
+ type: "custom";
14
+ renderingMode: "3d";
15
+ };
@@ -0,0 +1,15 @@
1
+ import { FreeCamera, Matrix, Scene } from '@babylonjs/core';
2
+ import { MapInstance } from '../generic-map';
3
+ import { BabylonMap } from '../use-babylon-map';
4
+ export declare function useRender({ map, origin, scene, camera, frameloop, babylonMap, }: {
5
+ map: MapInstance;
6
+ origin: Matrix;
7
+ scene: Scene;
8
+ camera: FreeCamera;
9
+ frameloop?: 'always' | 'demand';
10
+ babylonMap: BabylonMap;
11
+ }): (_gl: WebGL2RenderingContext, projViewMx: number[] | {
12
+ defaultProjectionData: {
13
+ mainMatrix: Record<string, number>;
14
+ };
15
+ }) => void;
@@ -0,0 +1,11 @@
1
+ import { Engine, FreeCamera, Scene } from '@babylonjs/core';
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { BabylonMap } from '../use-babylon-map';
4
+ import { FromLngLat, MapInstance } from '../generic-map';
5
+ export declare function useRoot(fromLngLat: FromLngLat, map: MapInstance, { longitude, latitude, altitude, frameloop, ...props }: CanvasProps): {
6
+ onRemove: () => void;
7
+ engine: Engine;
8
+ scene: Scene;
9
+ camera: FreeCamera;
10
+ babylonMap: BabylonMap<MapInstance>;
11
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { FromLngLat, MapInstance } from '../generic-map';
4
+ interface CanvasPortalProps extends CanvasProps {
5
+ setOnRender: (callback: () => (mx: number[]) => void) => void;
6
+ map: MapInstance;
7
+ fromLngLat: FromLngLat;
8
+ }
9
+ export declare const CanvasPortal: import("react").NamedExoticComponent<CanvasPortalProps>;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { CanvasProps } from '../../api/canvas-props';
3
+ import { FromLngLat, MapInstance } from '../generic-map';
4
+ interface InitCanvasFCProps extends CanvasProps {
5
+ map: MapInstance;
6
+ setOnRender: (callback: () => (mx: number[]) => void) => void;
7
+ frameloop?: 'always' | 'demand';
8
+ fromLngLat: FromLngLat;
9
+ }
10
+ export declare const InitCanvasFC: import("react").NamedExoticComponent<InitCanvasFCProps>;
11
+ export {};
@@ -0,0 +1 @@
1
+ export type Render = (gl: WebGLRenderingContext, matrix: number[]) => void;
@@ -0,0 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ import { Coords } from '../../api/coords';
3
+ import { MapInstance } from '../generic-map';
4
+ interface SyncCameraFCProps extends Coords {
5
+ setOnRender?: (callback: () => (mx: number[]) => void) => void;
6
+ onReady?: () => void;
7
+ map: MapInstance;
8
+ canvasRef: RefObject<HTMLCanvasElement | null>;
9
+ }
10
+ /** React component to sync the Babylon camera with the map provider on each render. */
11
+ export declare const SyncCameraFC: import("react").NamedExoticComponent<SyncCameraFCProps>;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Matrix } from '@babylonjs/core';
2
+ import { FromLngLat } from './generic-map';
3
+ import { Coords } from '../api/coords';
4
+ /** Calculate Babylon.js Matrix from coordinates.
5
+ * Returns a Babylon Matrix (world transform at the given geo coord).
6
+ * Matches the pattern from MapLibre + Babylon.js integration demo. */
7
+ export declare function coordsToMatrix({ longitude, latitude, altitude, fromLngLat }: Coords & {
8
+ fromLngLat: FromLngLat;
9
+ }): Matrix;
@@ -0,0 +1 @@
1
+ export declare const earthRadius = 6371008.8;
@@ -0,0 +1,49 @@
1
+ /** Generic interface of Mapbox/Maplibre `LayerProps` */
2
+ export interface LayerProps {
3
+ id: string;
4
+ type: 'custom';
5
+ renderingMode: '3d';
6
+ onRemove?(map: MapInstance, gl: WebGLRenderingContext): void;
7
+ onAdd?(map: MapInstance, gl: WebGLRenderingContext): void;
8
+ prerender?(gl: WebGLRenderingContext, matrix: number[]): void;
9
+ render(gl: WebGLRenderingContext, matrix: number[]): void;
10
+ }
11
+ /** Generic interface of Mapbox/Maplibre `LngLatLike` */
12
+ export type LngLatLike = {
13
+ lng: number;
14
+ lat: number;
15
+ } | {
16
+ lon: number;
17
+ lat: number;
18
+ } | [
19
+ number,
20
+ number
21
+ ];
22
+ /** Generic interface of Mapbox/Maplibre `static MercatorCoordinate.fromLngLat` */
23
+ export type FromLngLat = (lngLatLike: LngLatLike, altitude?: number) => MercatorCoordinate;
24
+ /** Generic interface of Mapbox/Maplibre typeof `MercatorCoordinate` */
25
+ export interface MercatorCoordinate {
26
+ x: number;
27
+ y: number;
28
+ z?: number;
29
+ meterInMercatorCoordinateUnits(): number;
30
+ }
31
+ /** Generic interface of Mapbox/Maplibre `Map` */
32
+ export interface MapInstance {
33
+ getCanvas(): HTMLCanvasElement;
34
+ /** MapLibre only */
35
+ getPixelRatio?: () => number;
36
+ triggerRepaint(): void;
37
+ on<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): void;
38
+ off<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): void;
39
+ }
40
+ /** Generic interface of Mapbox/Maplibre `MapEventType` */
41
+ export type MapEventType = {
42
+ resize: MapEvent;
43
+ };
44
+ /** Generic interface of `MapLibreEvent` or `MapBoxEvent` */
45
+ export interface MapEvent<TOrig = unknown> {
46
+ type: string;
47
+ target: MapInstance;
48
+ originalEvent: TOrig;
49
+ }
@@ -0,0 +1,7 @@
1
+ import { Matrix } from '@babylonjs/core';
2
+ /** Column-major (MapLibre) → transposed flat array (Babylon row-major layout) */
3
+ export declare function transposeMatrix(m: number[]): number[];
4
+ /** MapLibre column-major matrix → Babylon.js Matrix */
5
+ export declare function columnMajorToBabylonMatrix(m: number[]): Matrix;
6
+ /** Extract a flat column-major array from a Babylon Matrix (for MapLibre interop) */
7
+ export declare function babylonMatrixToColumnMajor(m: Matrix): number[];
@@ -0,0 +1,7 @@
1
+ import { FreeCamera, Matrix } from '@babylonjs/core';
2
+ /** Synchronise a Babylon camera with the map's view-projection matrix.
3
+ * @param camera The Babylon camera to update.
4
+ * @param origin Babylon world matrix for the Canvas origin.
5
+ * @param mapCamMx Flat array from MapLibre's view-projection (column-major).
6
+ */
7
+ export declare function syncCamera(camera: FreeCamera, origin: Matrix, mapCamMx: number[]): void;