leaflet-city-mapper 0.0.4 → 0.0.5

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 (621) hide show
  1. package/README.md +23 -11
  2. package/cucumber.mjs +9 -9
  3. package/dist/leaflet-city-mapper-src.js +3353 -2377
  4. package/dist/leaflet-city-mapper-src.js.map +4 -4
  5. package/dist/leaflet-city-mapper-worker-src.js +955 -0
  6. package/dist/leaflet-city-mapper-worker-src.js.map +7 -0
  7. package/dist/leaflet-city-mapper-worker.js +2 -0
  8. package/dist/leaflet-city-mapper-worker.js.map +7 -0
  9. package/dist/leaflet-city-mapper.js +3 -3
  10. package/dist/leaflet-city-mapper.js.map +4 -4
  11. package/libs/leaflet.js +1 -1
  12. package/package.json +3 -2
  13. package/src/{camera → animations}/cancelCameraAnimation.js +5 -3
  14. package/src/{core → animations}/cancelGridFade.js +3 -2
  15. package/src/animations/endZoom.js +27 -0
  16. package/src/{camera → animations}/mapAnimateCamera.js +7 -5
  17. package/src/{scene → animations}/onZoomAnim.js +5 -4
  18. package/src/{scene → animations}/renderPendingZoomAnimation.js +4 -2
  19. package/src/{camera → animations}/runCameraAnimations.js +8 -6
  20. package/src/{core → animations}/runGridFades.js +4 -3
  21. package/src/{camera → animations}/scheduleCameraAnimation.js +3 -2
  22. package/src/animations/scheduleGridFade.js +16 -0
  23. package/src/{scene → animations}/startZoom.js +3 -2
  24. package/src/{rendering → animations}/synchronizeZoomView.js +10 -8
  25. package/src/{rendering → animations}/updateZoomCamera.js +11 -8
  26. package/src/archives/decodeDirectory.js +1 -1
  27. package/src/archives/findTile.js +3 -3
  28. package/src/archives/getDirectoryEntries.js +5 -4
  29. package/src/archives/getHeader.js +10 -6
  30. package/src/archives/getTileData.js +3 -3
  31. package/src/archives/getZxy.js +8 -7
  32. package/src/archives/loadDirectory.js +3 -3
  33. package/src/archives/loadSource.js +3 -2
  34. package/src/archives/{read.js → readArchiveRange.js} +7 -5
  35. package/src/camera/cameraMapReady.js +3 -2
  36. package/src/camera/cleanupCameraMap.js +8 -6
  37. package/src/camera/fitCameraBounds.js +3 -3
  38. package/src/camera/initializeCameraMap.js +6 -4
  39. package/src/camera/mapCamera.js +1 -1
  40. package/src/camera/mapContainerPointToLayerPoint.js +2 -2
  41. package/src/camera/mapGetBearing.js +3 -2
  42. package/src/camera/mapGetBounds.js +2 -2
  43. package/src/camera/mapGetBoundsZoom.js +2 -2
  44. package/src/camera/mapGetPitch.js +3 -2
  45. package/src/camera/mapLayerPointToContainerPoint.js +2 -2
  46. package/src/camera/mapLimitCenter.js +1 -1
  47. package/src/camera/mapLimitOffset.js +1 -1
  48. package/src/camera/mapPanBy.js +2 -2
  49. package/src/camera/mapPanInside.js +1 -1
  50. package/src/camera/mapResetNorthPitch.js +1 -1
  51. package/src/camera/mapSetBearing.js +1 -1
  52. package/src/camera/mapSetPitch.js +1 -1
  53. package/src/camera/mapSetPitchAndBearing.js +5 -3
  54. package/src/{rendering → camera}/updateMapCamera.js +19 -15
  55. package/src/{scene/updateCamera.js → camera/updateSceneCamera.js} +1 -1
  56. package/src/camera/updateSky.js +10 -9
  57. package/src/collision/collider.js +23 -9
  58. package/src/collision/insideMesh.js +53 -0
  59. package/src/collision/insideWalker.js +46 -0
  60. package/src/collision/trafficCollision.js +60 -0
  61. package/src/{utils → colors}/parseColor.js +1 -1
  62. package/src/controls/addCameraHandler.js +5 -3
  63. package/src/controls/adjustCameraDrag.js +4 -3
  64. package/src/controls/cameraControls.js +8 -5
  65. package/src/controls/cameraDragClick.js +7 -7
  66. package/src/controls/cameraDragContextMenu.js +1 -1
  67. package/src/controls/cameraDragDown.js +2 -2
  68. package/src/controls/cameraDragEnd.js +1 -1
  69. package/src/controls/cameraDragMove.js +2 -2
  70. package/src/controls/changeCameraTouch.js +6 -3
  71. package/src/controls/cleanupCameraTouch.js +7 -5
  72. package/src/controls/dragCamera.js +1 -1
  73. package/src/controls/endCameraTouchEvent.js +1 -1
  74. package/src/controls/moveCameraTouch.js +5 -3
  75. package/src/controls/removeCameraDrag.js +1 -1
  76. package/src/controls/shiftRotateWheel.js +1 -1
  77. package/src/controls/startCameraTouch.js +6 -4
  78. package/src/core/adjustCameraMarkerPan.js +3 -3
  79. package/src/core/cameraCircleBounds.js +1 -1
  80. package/src/core/cameraMarkerDrag.js +1 -1
  81. package/src/core/cameraMarkerOnDrag.js +1 -1
  82. package/src/core/closestCameraLayerPoint.js +1 -1
  83. package/src/core/initializeGridContainer.js +1 -1
  84. package/src/core/initializeNativeLayer.js +9 -8
  85. package/src/core/layerCallInitHooks.js +4 -3
  86. package/src/core/markerSetIcon.js +1 -1
  87. package/src/core/markerSetPos.js +2 -2
  88. package/src/core/markerSetRotation.js +1 -1
  89. package/src/core/markerUpdateZIndex.js +5 -4
  90. package/src/core/popupAdjustPan.js +1 -1
  91. package/src/core/popupUpdatePosition.js +1 -1
  92. package/src/core/redrawPath.js +1 -1
  93. package/src/core/removeLayer.js +4 -3
  94. package/src/core/tooltipSetPosition.js +1 -1
  95. package/src/core/updateGridOpacity.js +3 -3
  96. package/src/core/whenReady.js +11 -0
  97. package/src/geometry/addBridges.js +13 -8
  98. package/src/{sources → geometry}/addGeneratedTriangle.js +1 -1
  99. package/src/{sources/addTriangle.js → geometry/appendAreaTriangle.js} +5 -5
  100. package/src/geometry/assembleAreaGeometry.js +41 -0
  101. package/src/{core → geometry}/boundsQuad.js +1 -1
  102. package/src/geometry/bridgePolygon.js +3 -3
  103. package/src/geometry/buildExtrudedPolygon.js +10 -0
  104. package/src/geometry/buildProjectedPoint.js +21 -0
  105. package/src/{sources/buildAreaPolygon.js → geometry/buildProjectedPolygon.js} +25 -29
  106. package/src/geometry/circleGeometry.js +1 -1
  107. package/src/geometry/computeBounds.js +19 -8
  108. package/src/geometry/conformModelToTerrain.js +17 -11
  109. package/src/{models → geometry}/createModelGeometry.js +5 -4
  110. package/src/geometry/disk.js +1 -1
  111. package/src/geometry/indexBridge.js +5 -4
  112. package/src/geometry/lampPostGeometry.js +2 -2
  113. package/src/geometry/lightGeometry.js +1 -1
  114. package/src/geometry/lineJoin.js +1 -1
  115. package/src/{core → geometry}/markerQuadCorners.js +9 -6
  116. package/src/geometry/nativeGeometry.js +1 -1
  117. package/src/geometry/polygon.js +1 -1
  118. package/src/geometry/roofCoverage.js +11 -8
  119. package/src/geometry/roofFootprint.js +13 -10
  120. package/src/geometry/segment.js +1 -1
  121. package/src/{shadows → geometry}/shadowBounds.js +1 -1
  122. package/src/geometry/surface.js +1 -1
  123. package/src/{terrain → geometry}/terrainBuffers.js +7 -5
  124. package/src/geometry/terrainTileGeometry.js +19 -0
  125. package/src/geometry/treeGeometry.js +2 -2
  126. package/src/globals/geometryWorkerUrl.js +3 -0
  127. package/src/globals/nativeMethodHandlers.js +14 -14
  128. package/src/{scene → gpu}/initializeRendererResources.js +10 -9
  129. package/src/gpu/initializeSharedRenderer.js +52 -0
  130. package/src/gpu/mountRenderer.js +26 -0
  131. package/src/{scene → gpu}/releaseRenderer.js +2 -2
  132. package/src/gpu/rendererDeviceError.js +16 -0
  133. package/src/gpu/rendererDeviceLost.js +16 -0
  134. package/src/{rendering/reportCompilation.js → gpu/reportShaderCompilation.js} +3 -3
  135. package/src/gpu/requestAdapter.js +12 -0
  136. package/src/gpu/requestDevice.js +9 -0
  137. package/src/index.js +8 -13
  138. package/src/layer-controls/layerCountTitle.js +6 -0
  139. package/src/layer-controls/renderLayerCount.js +20 -0
  140. package/src/{scene → layer-controls}/updateLayerCount.js +24 -22
  141. package/src/lighting/lightGrid.js +1 -1
  142. package/src/lighting/updatePointLights.js +13 -10
  143. package/src/{rendering → materials}/createProgram.js +13 -12
  144. package/src/{models/materialFor.js → materials/modelMaterialFor.js} +3 -3
  145. package/src/materials/terrainRasterProgram.js +58 -0
  146. package/src/models/applyModelTransform.js +8 -7
  147. package/src/models/createModelContext.js +3 -3
  148. package/src/models/loadModel.js +17 -12
  149. package/src/models/loadModelResources.js +7 -6
  150. package/src/models/modelNode.js +4 -5
  151. package/src/{core → native}/disposeNativeLayer.js +10 -10
  152. package/src/{core → native}/handleNativeMapEvent.js +5 -4
  153. package/src/{core → native}/initNativeGPU.js +9 -6
  154. package/src/native/isCurrentNativeLayer.js +7 -0
  155. package/src/{core → native}/nativeEventSource.js +3 -3
  156. package/src/{core → native}/nativeEvents.js +1 -1
  157. package/src/{core → native}/nativeLayer.js +16 -37
  158. package/src/{core → native}/nativeLayerMethod.js +14 -5
  159. package/src/{core → native}/pruneNativeResources.js +5 -5
  160. package/src/{core → native}/putNativeMesh.js +3 -3
  161. package/src/{core → native}/quadNativeMesh.js +1 -1
  162. package/src/native/readyNativeGPU.js +10 -0
  163. package/src/{core → native}/refreshNativeLayer.js +8 -7
  164. package/src/{core → native}/refreshNativeLayerContract.js +3 -2
  165. package/src/{core → native}/removeNativeEvents.js +1 -1
  166. package/src/{core → native}/removeTargets.js +3 -2
  167. package/src/native/reorderNativeLayer.js +17 -0
  168. package/src/{core → native}/styleNativeMesh.js +3 -2
  169. package/src/{core → native}/syncGridLayer.js +1 -1
  170. package/src/{core → native}/syncImageOverlay.js +1 -1
  171. package/src/{core → native}/syncMarker.js +1 -1
  172. package/src/{core → native}/syncVectorLayer.js +2 -2
  173. package/src/{core → native}/synchronizeNativeLayer.js +4 -3
  174. package/src/native/updateNativeLayerView.js +10 -0
  175. package/src/picking/findFeature.js +13 -9
  176. package/src/picking/hit.js +16 -8
  177. package/src/picking/onClick.js +3 -2
  178. package/src/picking/onPointerLeave.js +3 -2
  179. package/src/picking/onPointerMove.js +12 -6
  180. package/src/picking/raycast.js +29 -24
  181. package/src/picking/setHighlight.js +9 -8
  182. package/src/picking/shouldSkipOther.js +3 -2
  183. package/src/picking/showFeature.js +19 -14
  184. package/src/{camera/angles.js → projections/cameraAngles.js} +2 -2
  185. package/src/{camera → projections}/groundBounds.js +2 -2
  186. package/src/projections/localPosition.js +11 -0
  187. package/src/{camera/project.js → projections/projectCameraPoint.js} +2 -2
  188. package/src/{sources → projections}/projectRing.js +8 -9
  189. package/src/projections/projectTreePoint.js +17 -0
  190. package/src/{camera/animationPoint.js → projections/transformZoomAnimationPoint.js} +3 -2
  191. package/src/projections/walkerLocalPosition.js +18 -0
  192. package/src/raster/addRasterTile.js +38 -28
  193. package/src/raster/createRasterMesh.js +24 -19
  194. package/src/raster/finishRasterAttachment.js +17 -0
  195. package/src/raster/finishRasterTile.js +22 -19
  196. package/src/raster/initRaster.js +24 -15
  197. package/src/raster/isRasterLoading.js +8 -0
  198. package/src/raster/loadRasterTile.js +8 -7
  199. package/src/raster/onPMTileAdd.js +9 -8
  200. package/src/raster/onPMTileRemove.js +6 -5
  201. package/src/raster/pruneRasterTiles.js +19 -13
  202. package/src/raster/pumpRasterTiles.js +8 -6
  203. package/src/raster/readyRaster.js +3 -2
  204. package/src/raster/registerTerrainTile.js +8 -6
  205. package/src/raster/releaseRasterTile.js +14 -11
  206. package/src/raster/releaseRasterTiles.js +13 -10
  207. package/src/raster/removeRasterTile.js +8 -6
  208. package/src/raster/retainRasterTiles.js +5 -4
  209. package/src/raster/setPMTileOpacity.js +4 -4
  210. package/src/raster/setPMTileZIndex.js +4 -4
  211. package/src/raster/setRasterOpacity.js +8 -6
  212. package/src/raster/setRasterTerrain.js +12 -9
  213. package/src/raster/setRasterZIndex.js +8 -6
  214. package/src/raster/updateAttachedTiles.js +6 -5
  215. package/src/raster/updateRasterTiles.js +20 -15
  216. package/src/rendering/collectFrameMeshes.js +16 -9
  217. package/src/rendering/collectVisibleMesh.js +18 -9
  218. package/src/rendering/createMesh.js +11 -9
  219. package/src/rendering/disposeMesh.js +3 -3
  220. package/src/rendering/drawGeometry.js +9 -7
  221. package/src/rendering/drawSceneMeshes.js +9 -7
  222. package/src/rendering/prepareFrameBuffer.js +6 -5
  223. package/src/rendering/prepareFrameMeshes.js +9 -6
  224. package/src/rendering/prepareFrameUniforms.js +9 -6
  225. package/src/rendering/prepareMeshUniforms.js +1 -1
  226. package/src/rendering/render.js +39 -32
  227. package/src/rendering/resizeRenderer.js +17 -15
  228. package/src/rendering/revealRoofMesh.js +25 -6
  229. package/src/scene/{layerLayerAdd.js → addRegisteredLayer.js} +13 -9
  230. package/src/scene/addSceneLayer.js +4 -3
  231. package/src/scene/attachLayer.js +7 -6
  232. package/src/scene/attachSharedScene.js +69 -0
  233. package/src/scene/callLayer.js +7 -5
  234. package/src/scene/cancelUpdate.js +6 -5
  235. package/src/scene/failAttachment.js +6 -5
  236. package/src/scene/get3DEvents.js +5 -3
  237. package/src/scene/getLocation.js +3 -2
  238. package/src/scene/init3D.js +28 -26
  239. package/src/scene/initializeLayer.js +6 -4
  240. package/src/scene/isNativeLayer.js +3 -2
  241. package/src/scene/layerInitialize.js +11 -6
  242. package/src/scene/onAdd3DLayer.js +30 -24
  243. package/src/scene/onMapChange.js +5 -4
  244. package/src/scene/onRemove3DLayer.js +53 -35
  245. package/src/scene/ready3D.js +22 -13
  246. package/src/scene/releaseSharedScene.js +31 -25
  247. package/src/scene/removeLayerEvents.js +12 -9
  248. package/src/scene/removeSceneLayer.js +3 -2
  249. package/src/scene/renderPendingMapChange.js +7 -4
  250. package/src/scene/renderPendingUpdates.js +9 -6
  251. package/src/scene/restoreObject.js +15 -13
  252. package/src/scene/scheduleSceneUpdate.js +25 -0
  253. package/src/shaders/materialShaders.js +2 -2
  254. package/src/shadows/bindSunlight.js +4 -3
  255. package/src/shadows/drawShadowMeshes.js +4 -3
  256. package/src/shadows/renderSunlight.js +6 -5
  257. package/src/shadows/resizeSunlight.js +7 -6
  258. package/src/shadows/shadowMatrix.js +2 -2
  259. package/src/sources/attachAreaMesh.js +25 -20
  260. package/src/sources/buildArea.js +19 -11
  261. package/src/sources/buildAreaFeature.js +14 -5
  262. package/src/sources/buildAreaPoint.js +3 -21
  263. package/src/sources/extrusionStyle.js +2 -2
  264. package/src/sources/initializeGeoJSON.js +3 -2
  265. package/src/sources/pendingSourceAreas.js +3 -2
  266. package/src/sources/prepareAreaGeometryJob.js +33 -0
  267. package/src/sources/pumpSourceAreas.js +37 -0
  268. package/src/sources/releaseArea.js +10 -8
  269. package/src/sources/setGeoJSONData.js +4 -3
  270. package/src/sources/sourceAreaContext.js +18 -17
  271. package/src/sources/updateArea.js +25 -21
  272. package/src/sources/{updateStatus.js → updateSourceStatus.js} +5 -4
  273. package/src/sunlight/{addTo.js → addTimeControlToMap.js} +1 -1
  274. package/src/sunlight/addTimeLayer.js +3 -2
  275. package/src/sunlight/atmosphere.js +2 -2
  276. package/src/sunlight/initSunlight.js +5 -5
  277. package/src/sunlight/{initialize.js → initializeTimeControl.js} +5 -3
  278. package/src/sunlight/onAddSun.js +5 -4
  279. package/src/sunlight/onRemoveSun.js +1 -1
  280. package/src/sunlight/removeSun.js +7 -5
  281. package/src/sunlight/removeTimeLayer.js +3 -2
  282. package/src/sunlight/requestSunlightRender.js +9 -0
  283. package/src/sunlight/updateCelestialDisc.js +1 -1
  284. package/src/sunlight/updateSky.js +4 -2
  285. package/src/sunlight/updateSun.js +8 -6
  286. package/src/sunlight/useSelectedTime.js +4 -3
  287. package/src/terrain/applyTerrain.js +16 -13
  288. package/src/terrain/clearLayerTerrain.js +3 -2
  289. package/src/terrain/getElevation.js +9 -5
  290. package/src/terrain/initTerrain.js +11 -6
  291. package/src/terrain/loadTerrain.js +29 -20
  292. package/src/terrain/loadTerrainTiles.js +4 -3
  293. package/src/terrain/mapElevationOf.js +7 -0
  294. package/src/terrain/onTerrainAdd.js +14 -10
  295. package/src/terrain/onTerrainChange.js +4 -3
  296. package/src/terrain/onTerrainRemove.js +35 -21
  297. package/src/terrain/readyTerrainOf.js +7 -0
  298. package/src/terrain/setLayerTerrain.js +3 -2
  299. package/src/terrain/setTerrainHeight.js +19 -14
  300. package/src/terrain/terrainElevation.js +1 -1
  301. package/src/terrain/terrainTileQueue.js +11 -9
  302. package/src/{core → textures}/addImageState.js +1 -1
  303. package/src/{core/addRasterImage.js → textures/attachRasterImage.js} +1 -1
  304. package/src/{rendering → textures}/collectRoofTiles.js +3 -2
  305. package/src/{rendering → textures}/composeRoofAtlas.js +9 -7
  306. package/src/textures/destroyTexture.js +10 -0
  307. package/src/{models/textureFor.js → textures/modelTextureFor.js} +5 -4
  308. package/src/{core → textures}/nativeImageError.js +1 -1
  309. package/src/{core → textures}/nativeImageRefresh.js +2 -2
  310. package/src/{core/textureFor.js → textures/nativeTextureFor.js} +7 -6
  311. package/src/{rendering → textures}/rebuildRoofAtlas.js +12 -9
  312. package/src/{core → textures}/removeImageState.js +1 -1
  313. package/src/{rendering → textures}/resizeRoofTexture.js +5 -4
  314. package/src/textures/updateRoofAtlas.js +23 -0
  315. package/src/textures/updateRoofRaster.js +29 -0
  316. package/src/{core → textures}/uploadCanvasTexture.js +2 -2
  317. package/src/traffic/addTraffic.js +1 -1
  318. package/src/traffic/disposeTrafficObject.js +5 -3
  319. package/src/traffic/drawTrafficRoute.js +1 -1
  320. package/src/traffic/groundTraffic.js +6 -6
  321. package/src/traffic/initTraffic.js +3 -3
  322. package/src/traffic/loadedTrafficLanes.js +1 -1
  323. package/src/traffic/locateTraffic.js +3 -3
  324. package/src/traffic/placeTraffic.js +2 -1
  325. package/src/traffic/prepareTraffic.js +4 -3
  326. package/src/traffic/rebaseTraffic.js +3 -2
  327. package/src/traffic/rebuildTrafficMesh.js +1 -1
  328. package/src/traffic/removeTraffic.js +1 -1
  329. package/src/traffic/startTraffic.js +1 -1
  330. package/src/traffic/tickTraffic.js +4 -3
  331. package/src/traffic/trafficNow.js +3 -2
  332. package/src/traffic/updateTraffic.js +3 -2
  333. package/src/traffic/updateTrafficLights.js +4 -2
  334. package/src/vehicles/boatBenches.js +1 -1
  335. package/src/vehicles/boatModel.js +1 -1
  336. package/src/vehicles/busModel.js +1 -1
  337. package/src/vehicles/carModel.js +1 -1
  338. package/src/vehicles/metroModel.js +1 -1
  339. package/src/vehicles/tramModel.js +1 -1
  340. package/src/walk/{step.js → animateWalker.js} +15 -8
  341. package/src/walk/createWalk.js +15 -11
  342. package/src/walk/initWalk.js +4 -4
  343. package/src/walk/landWalker.js +38 -0
  344. package/src/walk/moveWalker.js +5 -4
  345. package/src/walk/{onAdd.js → onAddWalkControl.js} +3 -1
  346. package/src/walk/{onRemove.js → onRemoveWalkControl.js} +1 -1
  347. package/src/walk/{onKey.js → onWalkKey.js} +1 -1
  348. package/src/walk/{onTerrain.js → onWalkTerrain.js} +1 -1
  349. package/src/walk/{place.js → placeWalker.js} +2 -2
  350. package/src/walk/resolveWalkerPosition.js +28 -0
  351. package/src/walk/{start.js → startWalking.js} +8 -5
  352. package/src/walk/{stop.js → stopWalking.js} +4 -4
  353. package/src/walk/{toggle.js → toggleWalking.js} +2 -2
  354. package/src/weakmaps/addedByLayer.js +1 -0
  355. package/src/weakmaps/archiveHeaderByLayer.js +1 -0
  356. package/src/weakmaps/areasByLayer.js +1 -0
  357. package/src/weakmaps/bridgeMeshByLayer.js +1 -0
  358. package/src/weakmaps/bridgesByLayer.js +1 -0
  359. package/src/weakmaps/cameraAnimationByMap.js +1 -0
  360. package/src/weakmaps/cameraBearingByMap.js +1 -0
  361. package/src/weakmaps/cameraByLayer.js +1 -0
  362. package/src/weakmaps/cameraDraggableByMap.js +1 -0
  363. package/src/weakmaps/cameraFields.js +37 -0
  364. package/src/weakmaps/cameraFrameByMap.js +1 -0
  365. package/src/weakmaps/cameraHandlersByMap.js +1 -0
  366. package/src/weakmaps/cameraMaps.js +1 -0
  367. package/src/weakmaps/cameraPitchByMap.js +1 -0
  368. package/src/weakmaps/cameraReadyByMap.js +1 -0
  369. package/src/weakmaps/cameraTouchStateByMap.js +1 -0
  370. package/src/weakmaps/cameraViewByMap.js +1 -0
  371. package/src/weakmaps/cameraZIndexOffsetByLayer.js +1 -0
  372. package/src/weakmaps/containerByLayer.js +1 -0
  373. package/src/weakmaps/controlByLayer.js +1 -0
  374. package/src/weakmaps/countStatusByLayer.js +1 -0
  375. package/src/weakmaps/cursorByLayer.js +1 -0
  376. package/src/weakmaps/demByLayer.js +1 -0
  377. package/src/weakmaps/directoriesByLayer.js +1 -0
  378. package/src/weakmaps/etagByLayer.js +1 -0
  379. package/src/weakmaps/eventMapByLayer.js +1 -0
  380. package/src/weakmaps/eventsByLayer.js +1 -0
  381. package/src/weakmaps/fadeFrameByLayer.js +1 -0
  382. package/src/weakmaps/fadeVersionByLayer.js +1 -0
  383. package/src/weakmaps/frameByLayer.js +1 -0
  384. package/src/weakmaps/geojsonByLayer.js +1 -0
  385. package/src/weakmaps/geometryWorkersByMap.js +1 -0
  386. package/src/weakmaps/groupByLayer.js +1 -0
  387. package/src/weakmaps/headerByLayer.js +1 -0
  388. package/src/weakmaps/highlightedFeatureByLayer.js +1 -0
  389. package/src/weakmaps/hoveredFeatureByLayer.js +1 -0
  390. package/src/weakmaps/inflightByLayer.js +1 -0
  391. package/src/weakmaps/kindByLayer.js +1 -0
  392. package/src/weakmaps/layersByLayer.js +1 -0
  393. package/src/weakmaps/loadingTilesByLayer.js +1 -0
  394. package/src/weakmaps/locationByLayer.js +1 -0
  395. package/src/weakmaps/modelByLayer.js +1 -0
  396. package/src/weakmaps/modelUrlByLayer.js +1 -0
  397. package/src/weakmaps/nativeGPUBackByMap.js +1 -0
  398. package/src/weakmaps/nativeGPUByLayer.js +1 -0
  399. package/src/weakmaps/nativeGPUOrderByMap.js +1 -0
  400. package/src/weakmaps/pitchSkyByMap.js +1 -0
  401. package/src/weakmaps/pointerEventsByLayer.js +1 -0
  402. package/src/weakmaps/pruneAfterByLayer.js +1 -0
  403. package/src/weakmaps/pruneVersionByLayer.js +1 -0
  404. package/src/weakmaps/pruneWantedByLayer.js +1 -0
  405. package/src/weakmaps/queuedByLayer.js +1 -0
  406. package/src/weakmaps/rasterGeometryByLayer.js +1 -0
  407. package/src/weakmaps/rasterProgramByLayer.js +1 -0
  408. package/src/weakmaps/rasterTilesByLayer.js +1 -0
  409. package/src/weakmaps/rasterVersionByLayer.js +1 -0
  410. package/src/weakmaps/raycasterByLayer.js +1 -0
  411. package/src/weakmaps/readyByLayer.js +1 -0
  412. package/src/weakmaps/rendererByLayer.js +1 -0
  413. package/src/weakmaps/rendererReadyByLayer.js +1 -0
  414. package/src/weakmaps/roofRasterByLayer.js +1 -0
  415. package/src/weakmaps/roofRastersByLayer.js +1 -0
  416. package/src/weakmaps/rootByLayer.js +1 -0
  417. package/src/weakmaps/rotateControlByMap.js +1 -0
  418. package/src/weakmaps/sceneFields.js +159 -0
  419. package/src/weakmaps/sceneLayers.js +1 -0
  420. package/src/weakmaps/sceneOriginByLayer.js +1 -0
  421. package/src/weakmaps/shadowMeshesByLayer.js +1 -0
  422. package/src/weakmaps/sharedByLayer.js +1 -0
  423. package/src/weakmaps/sizeByLayer.js +1 -0
  424. package/src/weakmaps/state3dByLayer.js +1 -0
  425. package/src/weakmaps/sunlightByMap.js +1 -0
  426. package/src/weakmaps/terrain3DByLayer.js +1 -0
  427. package/src/weakmaps/terrain3DByMap.js +1 -0
  428. package/src/weakmaps/terrainArchiveByLayer.js +1 -0
  429. package/src/weakmaps/terrainBaseYByLayer.js +1 -0
  430. package/src/weakmaps/terrainBoundsByLayer.js +1 -0
  431. package/src/weakmaps/terrainControllerByLayer.js +1 -0
  432. package/src/weakmaps/terrainGridsByLayer.js +1 -0
  433. package/src/weakmaps/terrainLoadingByLayer.js +1 -0
  434. package/src/weakmaps/terrainOriginElevationByLayer.js +1 -0
  435. package/src/weakmaps/terrainPromiseByLayer.js +1 -0
  436. package/src/weakmaps/terrainReadyByLayer.js +1 -0
  437. package/src/weakmaps/terrainRequestByLayer.js +1 -0
  438. package/src/weakmaps/terrainSourceByLayer.js +1 -0
  439. package/src/weakmaps/terrainTilesByLayer.js +1 -0
  440. package/src/weakmaps/terrainZoomByLayer.js +1 -0
  441. package/src/weakmaps/tileZoomByLayer.js +1 -0
  442. package/src/weakmaps/timeControlByMap.js +1 -0
  443. package/src/weakmaps/tooltipByLayer.js +1 -0
  444. package/src/weakmaps/touchPitchByMap.js +1 -0
  445. package/src/weakmaps/touchRotateByMap.js +1 -0
  446. package/src/weakmaps/typeByLayer.js +1 -0
  447. package/src/weakmaps/urlByLayer.js +1 -0
  448. package/src/weakmaps/visibleMeshesByLayer.js +1 -0
  449. package/src/weakmaps/walkerByLayer.js +1 -0
  450. package/src/weakmaps/wantedRasterTilesByLayer.js +1 -0
  451. package/src/weakmaps/zoomLevelByLayer.js +1 -0
  452. package/src/weakmaps/zoomTransitionsByLayer.js +1 -0
  453. package/src/weakmaps/zoomViewByLayer.js +1 -0
  454. package/src/workers/acquireGeometryWorker.js +32 -0
  455. package/src/workers/buildAreaInWorker.js +36 -0
  456. package/src/workers/closeGeometryWorkers.js +11 -0
  457. package/src/workers/geometryWorker.js +14 -0
  458. package/src/workers/settleGeometryWorker.js +10 -0
  459. package/src/workers/startGeometryWorker.js +16 -0
  460. package/src/core/bringNativeLayerToBack.js +0 -8
  461. package/src/core/bringNativeLayerToFront.js +0 -8
  462. package/src/core/current.js +0 -6
  463. package/src/core/localPosition.js +0 -10
  464. package/src/core/readyNativeGPU.js +0 -9
  465. package/src/core/reorderNativeLayer.js +0 -9
  466. package/src/core/scheduleGridFade.js +0 -14
  467. package/src/core/updateNativeLayerView.js +0 -9
  468. package/src/geometry/dot.js +0 -6
  469. package/src/geometry/push.js +0 -3
  470. package/src/globals/cameraByMap.js +0 -1
  471. package/src/raster/finishAttachment.js +0 -15
  472. package/src/raster/isLoading.js +0 -7
  473. package/src/raster/terrainTileGeometry.js +0 -16
  474. package/src/rendering/destroyTexture.js +0 -9
  475. package/src/rendering/sortMeshes.js +0 -6
  476. package/src/rendering/updateRoofAtlas.js +0 -20
  477. package/src/rendering/updateRoofRaster.js +0 -25
  478. package/src/scene/attach.js +0 -54
  479. package/src/scene/endZoom.js +0 -23
  480. package/src/scene/initializeSharedRenderer.js +0 -45
  481. package/src/scene/layerCountTitle.js +0 -4
  482. package/src/scene/mountRenderer.js +0 -25
  483. package/src/scene/ready.js +0 -9
  484. package/src/scene/renderLayerCount.js +0 -13
  485. package/src/scene/rendererDeviceError.js +0 -14
  486. package/src/scene/rendererDeviceLost.js +0 -14
  487. package/src/scene/requestAdapter.js +0 -12
  488. package/src/scene/requestDevice.js +0 -9
  489. package/src/scene/update.js +0 -23
  490. package/src/sources/projectedTree.js +0 -19
  491. package/src/sources/pump.js +0 -44
  492. package/src/sunlight/render.js +0 -9
  493. package/src/terrain/rasterProgram.js +0 -51
  494. package/src/walk/land.js +0 -32
  495. package/src/walk/local.js +0 -18
  496. /package/src/{camera → animations}/mapStopPitchBearingAnimation.js +0 -0
  497. /package/src/{core → animations}/runMarkerPanFrame.js +0 -0
  498. /package/src/{core → animations}/scheduleMarkerPan.js +0 -0
  499. /package/src/archives/{varint.js → readVarint.js} +0 -0
  500. /package/src/{sunlight → astronomy}/horizontalPosition.js +0 -0
  501. /package/src/{sunlight → astronomy}/moonPosition.js +0 -0
  502. /package/src/{sunlight → astronomy}/solarPosition.js +0 -0
  503. /package/src/{sunlight → astronomy}/solarTime.js +0 -0
  504. /package/src/{scene → camera}/createSceneCamera.js +0 -0
  505. /package/src/{sunlight/rgb.js → colors/formatRGB.js} +0 -0
  506. /package/src/{utils/channel.js → colors/hslChannel.js} +0 -0
  507. /package/src/{sunlight/mix.js → colors/mixColor.js} +0 -0
  508. /package/src/{utils → colors}/toSRGB.js +0 -0
  509. /package/src/controls/{editable.js → isEditableTarget.js} +0 -0
  510. /package/src/geometry/{nativeTriangle.js → appendNativeTriangle.js} +0 -0
  511. /package/src/{traffic → geometry}/appendRouteDash.js +0 -0
  512. /package/src/{traffic → geometry}/appendRouteSegment.js +0 -0
  513. /package/src/geometry/{build.js → buildGeometryParts.js} +0 -0
  514. /package/src/geometry/{lampRing.js → createLampRing.js} +0 -0
  515. /package/src/{raster/createGeometry.js → geometry/createRasterQuadGeometry.js} +0 -0
  516. /package/src/geometry/{treeRing.js → createTreeRing.js} +0 -0
  517. /package/src/geometry/{cross.js → crossVector.js} +0 -0
  518. /package/src/{sources → geometry}/generateTreeGeometry.js +0 -0
  519. /package/src/{sources → geometry}/instanceAreaGeometry.js +0 -0
  520. /package/src/{traffic/along.js → geometry/interpolateRoute.js} +0 -0
  521. /package/src/{core → geometry}/markerImageBounds.js +0 -0
  522. /package/src/{shadows → geometry}/meshShadowBounds.js +0 -0
  523. /package/src/geometry/{below.js → offsetBelowGround.js} +0 -0
  524. /package/src/{scene → geometry}/restoreGeometry.js +0 -0
  525. /package/src/{traffic → geometry}/routeGeometry.js +0 -0
  526. /package/src/geometry/{sub.js → subtractVector.js} +0 -0
  527. /package/src/{terrain → geometry}/terrainGrid.js +0 -0
  528. /package/src/geometry/{visit.js → visitNativeCoordinates.js} +0 -0
  529. /package/src/{scene → gpu}/showWebGPUWarning.js +0 -0
  530. /package/src/{scene → layer-controls}/placeEntry.js +0 -0
  531. /package/src/{scene → layer-controls}/placeEntryElement.js +0 -0
  532. /package/src/{scene → layer-controls}/placeUnderEntry.js +0 -0
  533. /package/src/{scene → layer-controls}/removeEntry.js +0 -0
  534. /package/src/{scene → layer-controls}/replaceEntry.js +0 -0
  535. /package/src/{scene → layer-controls}/runPlacements.js +0 -0
  536. /package/src/{scene → layer-controls}/underEntry.js +0 -0
  537. /package/src/lighting/{visitCells.js → visitLightGridCells.js} +0 -0
  538. /package/src/{rendering → materials}/createProgramLayout.js +0 -0
  539. /package/src/{rendering → materials}/createProgramUniforms.js +0 -0
  540. /package/src/{rendering → materials}/prepareMeshCutout.js +0 -0
  541. /package/src/{shaders → materials}/validateRoofMaterial.js +0 -0
  542. /package/src/{core → native}/beforeNativeRender.js +0 -0
  543. /package/src/{core → native}/bypassNativeEvent.js +0 -0
  544. /package/src/{core → native}/compareNativeHits.js +0 -0
  545. /package/src/{core → native}/forwardNativeError.js +0 -0
  546. /package/src/{core → native}/hideTargets.js +0 -0
  547. /package/src/{core → native}/nativeAddLatLng.js +0 -0
  548. /package/src/{core → native}/nativeBringToBack.js +0 -0
  549. /package/src/{core → native}/nativeBringToFront.js +0 -0
  550. /package/src/{core → native}/nativeRedraw.js +0 -0
  551. /package/src/{core → native}/nativeSetBounds.js +0 -0
  552. /package/src/{core → native}/nativeSetIcon.js +0 -0
  553. /package/src/{core → native}/nativeSetLatLng.js +0 -0
  554. /package/src/{core → native}/nativeSetLatLngs.js +0 -0
  555. /package/src/{core → native}/nativeSetOpacity.js +0 -0
  556. /package/src/{core → native}/nativeSetRadius.js +0 -0
  557. /package/src/{core → native}/nativeSetStyle.js +0 -0
  558. /package/src/{core → native}/nativeSetUrl.js +0 -0
  559. /package/src/{core → native}/nativeSetZIndex.js +0 -0
  560. /package/src/{core → native}/nativeSetZIndexOffset.js +0 -0
  561. /package/src/{core → native}/refreshNativeEvent.js +0 -0
  562. /package/src/{core → native}/rejectNativeReady.js +0 -0
  563. /package/src/{core → native}/resolveNativeReady.js +0 -0
  564. /package/src/{core → native}/restoreNativeEvents.js +0 -0
  565. /package/src/{core → native}/updateNativeHover.js +0 -0
  566. /package/src/{camera/displayPoint.js → projections/displayContainerPoint.js} +0 -0
  567. /package/src/{core → projections}/localPixel.js +0 -0
  568. /package/src/{core → projections}/localPixelForGeometry.js +0 -0
  569. /package/src/{core → projections}/markerCameraIconPoint.js +0 -0
  570. /package/src/{geometry/bridgeLocal.js → projections/projectBridgePoint.js} +0 -0
  571. /package/src/{sunlight → projections}/projectCelestialBody.js +0 -0
  572. /package/src/{camera/pointOf.js → projections/toPoint.js} +0 -0
  573. /package/src/{camera → projections}/verticalGroundY.js +0 -0
  574. /package/src/raster/{reportError.js → reportRasterError.js} +0 -0
  575. /package/src/scene/{emptyNode.js → createSceneNode.js} +0 -0
  576. /package/src/scene/{reportError.js → reportLayerError.js} +0 -0
  577. /package/src/sunlight/{onAdd.js → onAddTimeControl.js} +0 -0
  578. /package/src/sunlight/{remove.js → removeTimeControl.js} +0 -0
  579. /package/src/terrain/{sample.js → sampleTerrainTile.js} +0 -0
  580. /package/src/{rendering → textures}/bindMeshTextures.js +0 -0
  581. /package/src/{rendering → textures}/compareRoofTiles.js +0 -0
  582. /package/src/{rendering/destroyAfterSubmission.js → textures/destroyTextureAfterSubmission.js} +0 -0
  583. /package/src/{rendering → textures}/ensureRoofBlit.js +0 -0
  584. /package/src/{models/loadImage.js → textures/loadModelImage.js} +0 -0
  585. /package/src/{models/textureSampler.js → textures/modelTextureSampler.js} +0 -0
  586. /package/src/{rendering → textures}/prepareMeshTextures.js +0 -0
  587. /package/src/{scene → textures}/restoreMaterialTextures.js +0 -0
  588. /package/src/{rendering → textures}/textureBinding.js +0 -0
  589. /package/src/{rendering → textures}/uploadMeshTexture.js +0 -0
  590. /package/src/{core → textures}/uploadNativeImage.js +0 -0
  591. /package/src/{rendering → textures}/uploadRoofTile.js +0 -0
  592. /package/src/traffic/{toLanes.js → featuresToTrafficLanes.js} +0 -0
  593. /package/src/traffic/{tooltip.js → trafficTooltip.js} +0 -0
  594. /package/src/{scene → transforms}/composeLocalTransform.js +0 -0
  595. /package/src/{models/nodeMatrix.js → transforms/modelNodeMatrix.js} +0 -0
  596. /package/src/{core → transforms}/transformNativePoint.js +0 -0
  597. /package/src/{scene → transforms}/updateWorldMatrix.js +0 -0
  598. /package/src/{scene → transforms}/worldMatrixChanged.js +0 -0
  599. /package/src/vehicles/{carriage.js → buildCarriage.js} +0 -0
  600. /package/src/vehicles/{mirror.js → mirrorVehiclePart.js} +0 -0
  601. /package/src/walk/{initialize.js → initializeWalkControl.js} +0 -0
  602. /package/src/walk/{blocked.js → isWalkBlocked.js} +0 -0
  603. /package/src/walk/{onBlur.js → onWalkBlur.js} +0 -0
  604. /package/src/walk/{onPointer.js → onWalkPointer.js} +0 -0
  605. /package/src/{globals → weakmaps}/boundsMethods.js +0 -0
  606. /package/src/{globals → weakmaps}/closestMethods.js +0 -0
  607. /package/src/{globals → weakmaps}/colliders.js +0 -0
  608. /package/src/{globals → weakmaps}/dragByHandler.js +0 -0
  609. /package/src/{globals → weakmaps}/dragStates.js +0 -0
  610. /package/src/{globals → weakmaps}/gridInitializers.js +0 -0
  611. /package/src/{globals → weakmaps}/imageStates.js +0 -0
  612. /package/src/{globals → weakmaps}/nativeEventMaps.js +0 -0
  613. /package/src/{globals → weakmaps}/nativeRenderByLayer.js +0 -0
  614. /package/src/{globals → weakmaps}/rendererDevices.js +0 -0
  615. /package/src/{globals → weakmaps}/renderers.js +0 -0
  616. /package/src/{globals → weakmaps}/sceneByLayer.js +0 -0
  617. /package/src/{globals → weakmaps}/sunByMap.js +0 -0
  618. /package/src/{globals → weakmaps}/sunlightByControl.js +0 -0
  619. /package/src/{globals → weakmaps}/touchByContainer.js +0 -0
  620. /package/src/{globals → weakmaps}/trafficByLayer.js +0 -0
  621. /package/src/{globals → weakmaps}/walkByMap.js +0 -0
@@ -4,8 +4,8 @@ import { mapMethods } from '../globals/mapMethods.js';
4
4
  import { mapGetPitch } from './mapGetPitch.js';
5
5
  import { mapGetBearing } from './mapGetBearing.js';
6
6
 
7
- import { groundBounds } from './groundBounds.js';
8
- import { animationPoint } from './animationPoint.js';
7
+ import { groundBounds } from '../projections/groundBounds.js';
8
+ import { animationPoint } from '../projections/transformZoomAnimationPoint.js';
9
9
 
10
10
  export function mapGetBounds() {
11
11
  if (!mapGetPitch(this) && !mapGetBearing(this)) return mapMethods.value.getBounds.call(this);
@@ -6,8 +6,8 @@ import { mapGetPitch } from './mapGetPitch.js';
6
6
  import { mapGetBearing } from './mapGetBearing.js';
7
7
 
8
8
  import { fitCameraBounds } from './fitCameraBounds.js';
9
- import { pointOf } from './pointOf.js';
10
- import { groundBounds } from './groundBounds.js';
9
+ import { pointOf } from '../projections/toPoint.js';
10
+ import { groundBounds } from '../projections/groundBounds.js';
11
11
 
12
12
  export function mapGetBoundsZoom(bounds, inside, padding) {
13
13
  if (!mapGetPitch(this) && !mapGetBearing(this)) return mapMethods.value.getBoundsZoom.call(this, bounds, inside, padding);
@@ -1,4 +1,5 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
1
+ import { cameraPitchByMap } from '../weakmaps/cameraPitchByMap.js';
2
2
 
3
3
 
4
- export function mapGetPitch(map) { return cameraByMap.get(map)?._cameraPitch ?? 0; }
4
+
5
+ export function mapGetPitch(map) { return cameraPitchByMap.get(map) ?? 0; }
@@ -1,7 +1,7 @@
1
1
  import { mapMethods } from '../globals/mapMethods.js';
2
2
 
3
- import { project } from './project.js';
4
- import { animationPoint } from './animationPoint.js';
3
+ import { project } from '../projections/projectCameraPoint.js';
4
+ import { animationPoint } from '../projections/transformZoomAnimationPoint.js';
5
5
 
6
6
  export function mapLayerPointToContainerPoint(point) {
7
7
  return project(this, animationPoint(this, mapMethods.value.layerPointToContainerPoint.call(this, point)));
@@ -4,7 +4,7 @@ import { mapMethods } from '../globals/mapMethods.js';
4
4
  import { mapGetPitch } from './mapGetPitch.js';
5
5
  import { mapGetBearing } from './mapGetBearing.js';
6
6
 
7
- import { groundBounds } from './groundBounds.js';
7
+ import { groundBounds } from '../projections/groundBounds.js';
8
8
 
9
9
  export function mapLimitCenter(center, zoom, bounds) {
10
10
  if (!bounds || !this._loaded || !mapGetPitch(this) && !mapGetBearing(this)) {
@@ -3,7 +3,7 @@ import { mapMethods } from '../globals/mapMethods.js';
3
3
  import { mapGetPitch } from './mapGetPitch.js';
4
4
  import { mapGetBearing } from './mapGetBearing.js';
5
5
 
6
- import { project } from './project.js';
6
+ import { project } from '../projections/projectCameraPoint.js';
7
7
 
8
8
  export function mapLimitOffset(offset, bounds) {
9
9
  if (!bounds || !mapGetPitch(this) && !mapGetBearing(this)) return mapMethods.value._limitOffset.call(this, offset, bounds);
@@ -1,7 +1,7 @@
1
1
  import { mapMethods } from '../globals/mapMethods.js';
2
2
 
3
- import { project } from './project.js';
4
- import { pointOf } from './pointOf.js';
3
+ import { project } from '../projections/projectCameraPoint.js';
4
+ import { pointOf } from '../projections/toPoint.js';
5
5
 
6
6
  export function mapPanBy(offset, options) {
7
7
  const half = this.getSize().divideBy(2);
@@ -4,7 +4,7 @@ import { cameraZeroPadding } from '../globals/cameraZeroPadding.js';
4
4
  import { mapGetPitch } from './mapGetPitch.js';
5
5
  import { mapGetBearing } from './mapGetBearing.js';
6
6
 
7
- import { pointOf } from './pointOf.js';
7
+ import { pointOf } from '../projections/toPoint.js';
8
8
 
9
9
  export function mapPanInside(latlng, options = /* alloc */ {}) {
10
10
  if (!mapGetPitch(this) && !mapGetBearing(this)) return mapMethods.value.panInside.call(this, latlng, options);
@@ -1,4 +1,4 @@
1
1
  import { cameraAnimatedOptions } from '../globals/cameraAnimatedOptions.js';
2
- import { mapAnimateCamera } from './mapAnimateCamera.js';
2
+ import { mapAnimateCamera } from '../animations/mapAnimateCamera.js';
3
3
 
4
4
  export function mapResetNorthPitch(map, options = cameraAnimatedOptions) { return mapAnimateCamera(map, 0, 0, options); }
@@ -1,3 +1,3 @@
1
- import { mapAnimateCamera } from './mapAnimateCamera.js';
1
+ import { mapAnimateCamera } from '../animations/mapAnimateCamera.js';
2
2
  import { mapGetPitch } from './mapGetPitch.js';
3
3
  export function mapSetBearing(map, bearing, options) { return mapAnimateCamera(map, mapGetPitch(map), bearing, options); }
@@ -1,3 +1,3 @@
1
- import { mapAnimateCamera } from './mapAnimateCamera.js';
1
+ import { mapAnimateCamera } from '../animations/mapAnimateCamera.js';
2
2
  import { mapGetBearing } from './mapGetBearing.js';
3
3
  export function mapSetPitch(map, pitch, options) { return mapAnimateCamera(map, pitch, mapGetBearing(map), options); }
@@ -1,4 +1,6 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
1
+ import { cameraBearingByMap } from '../weakmaps/cameraBearingByMap.js';
2
+ import { cameraPitchByMap } from '../weakmaps/cameraPitchByMap.js';
3
+
2
4
 
3
5
  import { mapGetPitch } from './mapGetPitch.js';
4
6
  import { mapGetBearing } from './mapGetBearing.js';
@@ -11,8 +13,8 @@ export function mapSetPitchAndBearing(map, pitch, bearing) {
11
13
  throw /* alloc */ new TypeError('maxPitch must be between 0 and 180 degrees');
12
14
  }
13
15
  const previousPitch = mapGetPitch(map), previousBearing = mapGetBearing(map);
14
- cameraByMap.get(map)._cameraPitch = Math.max(0, Math.min(map.options.maxPitch, pitch));
15
- cameraByMap.get(map)._cameraBearing = ((bearing % 360) + 360) % 360;
16
+ cameraPitchByMap.set(map, Math.max(0, Math.min(map.options.maxPitch, pitch)));
17
+ cameraBearingByMap.set(map, ((bearing % 360) + 360) % 360);
16
18
  if (map._loaded) {
17
19
  updateSky.call(map);
18
20
  if (previousBearing !== mapGetBearing(map)) map.fire('rotate', /* alloc */ { bearing: mapGetBearing(map) });
@@ -1,35 +1,39 @@
1
+ import { cameraByLayer } from '../weakmaps/cameraByLayer.js';
2
+ import { sceneOriginByLayer } from '../weakmaps/sceneOriginByLayer.js';
3
+ import { cameraViewByMap } from '../weakmaps/cameraViewByMap.js';
4
+
5
+
1
6
  import { radians } from '../globals/radians.js';
2
7
  import { cameraFov } from '../globals/cameraFov.js';
3
8
  import { earthCirc } from '../globals/earthCirc.js';
4
- import { cameraByMap } from '../globals/cameraByMap.js';
5
- import { sceneByLayer } from '../globals/sceneByLayer.js';
9
+ import { mapElevationOf } from '../terrain/mapElevationOf.js';
6
10
  import { mapMethods } from '../globals/mapMethods.js';
7
- import { walkByMap } from '../globals/walkByMap.js';
8
- import { mapGetPitch } from '../camera/mapGetPitch.js';
9
- import { mapGetBearing } from '../camera/mapGetBearing.js';
11
+ import { walkByMap } from '../weakmaps/walkByMap.js';
12
+ import { mapGetPitch } from './mapGetPitch.js';
13
+ import { mapGetBearing } from './mapGetBearing.js';
10
14
 
11
- import { updateCamera } from "../scene/updateCamera.js";
12
- import { getElevation } from "../terrain/getElevation.js";
15
+ import { updateCamera } from "./updateSceneCamera.js";
13
16
 
14
- import { animationPoint } from '../camera/animationPoint.js';
17
+ import { animationPoint } from '../projections/transformZoomAnimationPoint.js';
15
18
 
16
- export function updateMapCamera(backend, size) {
17
- const map = backend._map;
19
+ export function updateMapCamera(layer, size) {
20
+ const map = layer._map;
18
21
  // Match the map's perspective, including the intermediate view of an animated zoom.
19
- const zoom = cameraByMap.get(map)._cameraView?.zoom ?? map.getZoom();
20
- const pixelsPerMeter = map.options.crs.scale(zoom) / (earthCirc * Math.cos(sceneByLayer.get(backend)._sceneOrigin.lat * radians));
22
+ const zoom = cameraViewByMap.get(map)?.zoom ?? map.getZoom();
23
+ const pixelsPerMeter = map.options.crs.scale(zoom) /
24
+ (earthCirc * Math.cos(sceneOriginByLayer.get(layer).lat * radians));
21
25
  const origin = animationPoint(map, mapMethods.value.layerPointToContainerPoint.call(map,
22
- map.project(sceneByLayer.get(backend)._sceneOrigin).subtract(map.getPixelOrigin())));
26
+ map.project(sceneOriginByLayer.get(layer)).subtract(map.getPixelOrigin())));
23
27
  const distance = size.y * 1.5 / pixelsPerMeter;
24
28
  const targetX = (size.x / 2 - origin.x) / pixelsPerMeter;
25
29
  // CSS zoom keeps the logical view's ground plane until zoomend.
26
30
  const walker = walkByMap.get(map)?.control?._walk;
27
- const targetY = ((cameraByMap.get(map)._terrain3D ? getElevation(cameraByMap.get(map)._terrain3D, map.getCenter()): undefined) ?? 0) +
31
+ const targetY = (mapElevationOf(map, map.getCenter()) ?? 0) +
28
32
  (walker?.saved ? walker.state.height : 0);
29
33
  const targetZ = (size.y / 2 - origin.y) / pixelsPerMeter;
30
34
  const pitch = mapGetPitch(map) * radians;
31
35
  const bearing = mapGetBearing(map) * radians;
32
- const camera = sceneByLayer.get(backend).camera;
36
+ const camera = cameraByLayer.get(layer);
33
37
  camera.fov = cameraFov;
34
38
  camera.aspect = size.x / size.y;
35
39
  camera.near = Math.max(0.1, distance / 10000);
@@ -9,7 +9,7 @@ export function updateCamera(camera) {
9
9
  camera.projectionTransform ||= /* alloc */ new DOMMatrix();
10
10
  camera.projectionViewTransform ||= /* alloc */ new DOMMatrix();
11
11
  const { position, target, up, x, y, z, viewMatrix, projectionMatrix, projectionViewMatrix } = camera;
12
- let i, value;
12
+ let value;
13
13
  z[0] = position[0] - target[0], z[1] = position[1] - target[1], z[2] = position[2] - target[2];
14
14
  const zLength = Math.hypot(z[0], z[1], z[2]) || 1;
15
15
  z[0] /= zLength, z[1] /= zLength, z[2] /= zLength;
@@ -1,6 +1,7 @@
1
+ import { pitchSkyByMap } from '../weakmaps/pitchSkyByMap.js';
2
+
1
3
  import { L } from '../globals/L.js';
2
4
  import { radians } from '../globals/radians.js';
3
- import { cameraByMap } from '../globals/cameraByMap.js';
4
5
 
5
6
  import { mapGetPitch } from './mapGetPitch.js';
6
7
 
@@ -9,14 +10,14 @@ export function updateSky() {
9
10
  const height = this.getSize().y, pitch = mapGetPitch(this) * radians;
10
11
  const far = height * this.options.pitchMaxDistance, distance = height * 1.5;
11
12
  const top = height / 2 - far * Math.abs(Math.cos(pitch)) * distance / (distance + Math.sin(pitch) * far);
12
- if (top > 0 && !cameraByMap.get(this)._pitchSky) {
13
- cameraByMap.get(this)._pitchSky = L.DomUtil.create('div', 'leaflet-pitch-sky', this.getContainer());
14
- cameraByMap.get(this)._pitchSky.setAttribute('aria-hidden', 'true');
15
- cameraByMap.get(this)._pitchSky.style.cssText = 'position:absolute;inset:0 0 auto;height:0;z-index:0;pointer-events:none;background:var(--leaflet-sky-background,linear-gradient(#9ec5e8,#dfe9f0))';
13
+ if (top > 0 && !pitchSkyByMap.get(this)) {
14
+ pitchSkyByMap.set(this, L.DomUtil.create('div', 'leaflet-pitch-sky', this.getContainer()));
15
+ pitchSkyByMap.get(this).setAttribute('aria-hidden', 'true');
16
+ pitchSkyByMap.get(this).style.cssText = 'position:absolute;inset:0 0 auto;height:0;z-index:0;pointer-events:none;background:var(--leaflet-sky-background,linear-gradient(#9ec5e8,#dfe9f0))';
16
17
  }
17
- if (cameraByMap.get(this)._pitchSky) {
18
- cameraByMap.get(this)._pitchSky.style.inset = pitch > Math.PI / 2 ? 'auto 0 0' : '0 0 auto';
19
- cameraByMap.get(this)._pitchSky.style.height = `${Math.max(0, Math.ceil(top))}px`;
20
- cameraByMap.get(this)._pitchSky.style.display = top > 0 ? '' : 'none';
18
+ if (pitchSkyByMap.get(this)) {
19
+ pitchSkyByMap.get(this).style.inset = pitch > Math.PI / 2 ? 'auto 0 0' : '0 0 auto';
20
+ pitchSkyByMap.get(this).style.height = `${Math.max(0, Math.ceil(top))}px`;
21
+ pitchSkyByMap.get(this).style.display = top > 0 ? '' : 'none';
21
22
  }
22
23
  }
@@ -1,27 +1,38 @@
1
- import { colliders } from '../globals/colliders.js';
2
- import { transformTriangle } from './transformTriangle.js';
1
+ import { colliders } from '../weakmaps/colliders.js';
3
2
  import { indexTriangle } from './indexTriangle.js';
3
+ import { readTriangle } from './readTriangle.js';
4
4
 
5
5
 
6
6
  export function collider(mesh) {
7
7
  let c = colliders.get(mesh.geometry);
8
8
  if (c) return c;
9
- const m = mesh.worldMatrix, { position: { data: p }, index, normal, uv } = mesh.geometry.attributes;
9
+ const m = mesh.worldMatrix, { position: { data: p }, index, normal, uv, instanceOffset } = mesh.geometry.attributes;
10
10
 
11
- const count = index ? index.count : p.length / 3;
11
+ const vertices = index ? index.count : p.length / 3;
12
+ const count = vertices * (instanceOffset?.count ?? 1);
12
13
  const tri = /* alloc */ [];
13
14
  const nrm = /* alloc */ [];
14
15
  const cells = /* alloc */ new Map();
16
+ const a = /* alloc */ [0, 0, 0], b = /* alloc */ [0, 0, 0], d = /* alloc */ [0, 0, 0];
15
17
  const v = /* alloc */ [];
16
18
 
17
- let i, first, j, ex, ey, ez, fx, fy, fz, nx, nz, ny, length, a, h, t;
19
+ let i, first, j, ex, ey, ez, fx, fy, fz, nx, nz, ny, length, h, t, maxX = -Infinity;
18
20
  for (i = 0; i < count; i += 3) {
19
- first = index ? index.data[i] : i;
21
+ first = index ? index.data[i % vertices] : i % vertices;
20
22
  // Streetlight halos (uv.x <= 2, see scene/picking.js) are light, not matter.
21
23
  if (mesh.program.nightLight && uv && uv.data[first * 2] <= 2) {
22
24
  continue;
23
25
  }
24
- transformTriangle(v, p, index, i, m);
26
+ readTriangle(mesh, i, a, b, d);
27
+ v[0] = m[0] * a[0] + m[4] * a[1] + m[8] * a[2] + m[12];
28
+ v[1] = m[1] * a[0] + m[5] * a[1] + m[9] * a[2] + m[13];
29
+ v[2] = m[2] * a[0] + m[6] * a[1] + m[10] * a[2] + m[14];
30
+ v[3] = m[0] * b[0] + m[4] * b[1] + m[8] * b[2] + m[12];
31
+ v[4] = m[1] * b[0] + m[5] * b[1] + m[9] * b[2] + m[13];
32
+ v[5] = m[2] * b[0] + m[6] * b[1] + m[10] * b[2] + m[14];
33
+ v[6] = m[0] * d[0] + m[4] * d[1] + m[8] * d[2] + m[12];
34
+ v[7] = m[1] * d[0] + m[5] * d[1] + m[9] * d[2] + m[13];
35
+ v[8] = m[2] * d[0] + m[6] * d[1] + m[10] * d[2] + m[14];
25
36
  ex = v[3] - v[0], ey = v[4] - v[1], ez = v[5] - v[2], fx = v[6] - v[0], fy = v[7] - v[1], fz = v[8] - v[2];
26
37
 
27
38
  nx = ey * fz - ez * fy, nz = ex * fy - ey * fx;
@@ -34,13 +45,15 @@ export function collider(mesh) {
34
45
 
35
46
  if (normal) {
36
47
  // The stored normal tells the outside, whatever the winding.
37
- j = first * 3, a = normal.data;
38
- if ((m[0] * a[j] + m[4] * a[j + 1] + m[8] * a[j + 2]) * nx + (m[2] * a[j] + m[6] * a[j + 1] + m[10] * a[j + 2]) * nz < 0) { nx = -nx; nz = -nz; }
48
+ j = first * 3;
49
+ if ((m[0] * normal.data[j] + m[4] * normal.data[j + 1] + m[8] * normal.data[j + 2]) * nx +
50
+ (m[2] * normal.data[j] + m[6] * normal.data[j + 1] + m[10] * normal.data[j + 2]) * nz < 0) { nx = -nx; nz = -nz; }
39
51
  }
40
52
 
41
53
  h = Math.hypot(nx, nz), t = nrm.length / 2;
42
54
 
43
55
  tri.push(...v);
56
+ maxX = Math.max(maxX, v[0], v[3], v[6]);
44
57
  nrm.push(nx / h, nz / h);
45
58
 
46
59
  indexTriangle(cells, v, t);
@@ -49,6 +62,7 @@ export function collider(mesh) {
49
62
  tri: Float32Array.from(tri),
50
63
  nrm: Float32Array.from(nrm),
51
64
  cells,
65
+ maxX,
52
66
  origin: /* alloc */ [m[12], m[13], m[14]]
53
67
  };
54
68
  colliders.set(mesh.geometry, c);
@@ -0,0 +1,53 @@
1
+ import { CELL } from '../globals/CELL.js';
2
+
3
+ import { collider } from './collider.js';
4
+ import { horizontalRay } from './horizontalRay.js';
5
+ import { computeBounds } from '../geometry/computeBounds.js';
6
+
7
+ export function insideMesh(mesh, x, y, z, seen, intersections) {
8
+ const geometry = mesh.geometry;
9
+ if (!mesh.visible || !geometry?.attributes?.position?.data || mesh.program?.depthTest === false) return false;
10
+ if (!geometry.bounds) computeBounds(geometry);
11
+ const bounds = geometry.bounds;
12
+ const world = mesh.worldMatrix;
13
+ const center = bounds.center;
14
+ const cx = world[0] * center[0] + world[4] * center[1] + world[8] * center[2] + world[12];
15
+ const cy = world[1] * center[0] + world[5] * center[1] + world[9] * center[2] + world[13];
16
+ const cz = world[2] * center[0] + world[6] * center[1] + world[10] * center[2] + world[14];
17
+ const radius = bounds.radius * Math.max(
18
+ Math.hypot(world[0], world[1], world[2]),
19
+ Math.hypot(world[4], world[5], world[6]),
20
+ Math.hypot(world[8], world[9], world[10])
21
+ );
22
+ if (Math.hypot(cx - x, cy - y, cz - z) > radius) return false;
23
+ const shape = collider(mesh);
24
+ const end = Math.floor(shape.maxX / CELL);
25
+ if (x >= shape.maxX) return false;
26
+ const iz = Math.floor(z / CELL);
27
+ const hits = intersections;
28
+ hits.length = 0;
29
+ seen.clear();
30
+ let ix, cell, triangle, distance;
31
+ for (ix = Math.floor(x / CELL); ix <= end; ix++) {
32
+ cell = shape.cells.get(`${ix},${iz}`);
33
+ if (!cell) continue;
34
+ for (triangle of cell) {
35
+ if (seen.has(triangle)) continue;
36
+ seen.add(triangle);
37
+ distance = horizontalRay(shape.tri, triangle, x, y, z, 1, 0);
38
+ if (distance > 1e-4) hits.push(distance);
39
+ }
40
+ }
41
+ for (ix = 1; ix < hits.length; ix++) {
42
+ distance = hits[ix];
43
+ let j = ix - 1;
44
+ while (j >= 0 && hits[j] > distance) hits[j + 1] = hits[j--];
45
+ hits[j + 1] = distance;
46
+ }
47
+ let crossings = 0, previous = -Infinity;
48
+ for (distance of hits) {
49
+ if (distance - previous > 1e-4) crossings++;
50
+ previous = distance;
51
+ }
52
+ return crossings % 2 === 1;
53
+ }
@@ -0,0 +1,46 @@
1
+ import { kindByLayer } from '../weakmaps/kindByLayer.js';
2
+ import { layersByLayer } from '../weakmaps/layersByLayer.js';
3
+ import { rootByLayer } from '../weakmaps/rootByLayer.js';
4
+ import { sceneByLayer } from '../weakmaps/sceneByLayer.js';
5
+ import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
6
+
7
+ import { updateWorldMatrix } from '../transforms/updateWorldMatrix.js';
8
+ import { insideMesh } from './insideMesh.js';
9
+ import { trafficCollision } from './trafficCollision.js';
10
+ import { local } from '../projections/walkerLocalPosition.js';
11
+
12
+ export function insideWalker(context) {
13
+ const { layer, local: localBuffer, hitData } = context;
14
+ const shared = sharedByLayer.get(layer);
15
+ if (!shared || !layersByLayer.get(shared)) return false;
16
+ updateWorldMatrix(sceneByLayer.get(layer));
17
+ const root = rootByLayer.get(layer);
18
+ const feet = local.call(context, localBuffer);
19
+ const x = root.position[0] + feet[0] * root.scale[0];
20
+ const y = root.position[1] + feet[1] * root.scale[1];
21
+ const z = root.position[2] + feet[2] * root.scale[2];
22
+ const layers = layersByLayer.get(shared);
23
+ let other, node, child;
24
+ for (other of layers) {
25
+ if (other === layer || kindByLayer.get(other) === 'terrain') continue;
26
+ if (kindByLayer.get(other) === 'traffic') {
27
+ hitData.best = 0;
28
+ hitData.found = false;
29
+ if (trafficCollision(other, x, y, z, 0, 0, 0, hitData)) return true;
30
+ continue;
31
+ }
32
+ const nodes = hitData.nodes;
33
+ nodes.length = 0;
34
+ if (rootByLayer.get(other)) nodes.push(rootByLayer.get(other));
35
+ while (nodes.length) {
36
+ node = nodes.pop();
37
+ if (!node.visible) continue;
38
+ if (node.geometry && (
39
+ insideMesh(node, x, y + 0.45 * root.scale[1], z, hitData.seen, hitData.intersections) ||
40
+ insideMesh(node, x, y + 1.35 * root.scale[1], z, hitData.seen, hitData.intersections)
41
+ )) return true;
42
+ for (child of node.children) nodes.push(child);
43
+ }
44
+ }
45
+ return false;
46
+ }
@@ -0,0 +1,60 @@
1
+ import { rootByLayer } from '../weakmaps/rootByLayer.js';
2
+ import { trafficByLayer } from '../weakmaps/trafficByLayer.js';
3
+
4
+ import { locateTraffic } from '../traffic/locateTraffic.js';
5
+
6
+ export function trafficCollision(layer, x, y, z, dx, dz, reach, data) {
7
+ const state = trafficByLayer.get(layer);
8
+ if (!state?.mesh || !state.trips.length) return false;
9
+ let bounds = state.collisionBounds;
10
+ if (!bounds) {
11
+ bounds = state.collisionBounds = { radius: 0, minY: Infinity, maxY: -Infinity };
12
+ let i, px, py, pz;
13
+ for (i = 0; i < state.template.position.length; i += 3) {
14
+ px = state.template.position[i];
15
+ py = state.template.position[i + 1];
16
+ pz = state.template.position[i + 2];
17
+ bounds.radius = Math.max(bounds.radius, Math.hypot(px, pz));
18
+ bounds.minY = Math.min(bounds.minY, py);
19
+ bounds.maxY = Math.max(bounds.maxY, py);
20
+ }
21
+ }
22
+ const root = rootByLayer.get(layer), position = state.position ||= {};
23
+ const scale = Math.max(root.scale[0], root.scale[1], root.scale[2]);
24
+ const radius = bounds.radius * scale + 0.35;
25
+ let trip, projection, closest, rx, rz, perpendicular, entry, distance, bottom, top, px, pz;
26
+ for (trip of state.trips) {
27
+ ({ x: px, y: bottom, z: pz } = locateTraffic(state, trip, position));
28
+ bottom = root.position[1] + (bottom + bounds.minY) * root.scale[1];
29
+ top = root.position[1] + (position.y + bounds.maxY) * root.scale[1];
30
+ if (bottom > y + 1.7 * scale || top < y + 0.2 * scale) continue;
31
+ px = root.position[0] + px * root.scale[0];
32
+ pz = root.position[2] + pz * root.scale[2];
33
+ projection = (px - x) * dx + (pz - z) * dz;
34
+ closest = Math.max(0, Math.min(reach, projection));
35
+ rx = x + closest * dx - px;
36
+ rz = z + closest * dz - pz;
37
+ perpendicular = rx * rx + rz * rz;
38
+ if (perpendicular >= radius * radius) continue;
39
+ if (reach === 0) {
40
+ data.found = true;
41
+ distance = Math.hypot(x - px, z - pz);
42
+ data.normal[0] = distance ? (x - px) / distance : 0;
43
+ data.normal[1] = distance ? (z - pz) / distance : 0;
44
+ continue;
45
+ }
46
+ entry = Math.max(0, projection - Math.sqrt(radius * radius - perpendicular));
47
+ if (entry > reach || entry >= data.best) continue;
48
+ data.best = entry;
49
+ data.found = true;
50
+ distance = Math.hypot(x + entry * dx - px, z + entry * dz - pz);
51
+ if (distance < 1e-6) {
52
+ data.normal[0] = -dx;
53
+ data.normal[1] = -dz;
54
+ } else {
55
+ data.normal[0] = (x + entry * dx - px) / distance;
56
+ data.normal[1] = (z + entry * dz - pz) / distance;
57
+ }
58
+ }
59
+ return data.found;
60
+ }
@@ -1,5 +1,5 @@
1
1
  import { toSRGB } from "./toSRGB.js";
2
- import { channel } from "./channel.js";
2
+ import { channel } from "./hslChannel.js";
3
3
 
4
4
  /**
5
5
  * HSL inputs are linear-space to preserve the original building styling.
@@ -1,9 +1,11 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
2
-
3
1
 
2
+ import { cameraHandlersByMap } from '../weakmaps/cameraHandlersByMap.js';
4
3
 
5
4
  export function addCameraHandler(map, name, Type) {
6
- const handler = cameraByMap.get(map)[name] = /* alloc */ new Type(map);
5
+ let handlers = cameraHandlersByMap.get(map);
6
+ if (!handlers) cameraHandlersByMap.set(map, handlers = /* alloc */ new Map());
7
+ const handler = /* alloc */ new Type(map);
8
+ handlers.set(name, handler);
7
9
  map._handlers.push(handler);
8
10
  if (map.options[name]) handler.enable();
9
11
  }
@@ -1,13 +1,14 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
1
+ import { cameraDraggableByMap } from '../weakmaps/cameraDraggableByMap.js';
2
+
2
3
 
3
4
  import { mapGetPitch } from '../camera/mapGetPitch.js';
4
5
  import { mapGetBearing } from '../camera/mapGetBearing.js';
5
6
 
6
- import { project } from '../camera/project.js';
7
+ import { project } from '../projections/projectCameraPoint.js';
7
8
 
8
9
  export function adjustCameraDrag() {
9
10
  const map = this;
10
- const draggable = cameraByMap.get(map)._cameraDraggable;
11
+ const draggable = cameraDraggableByMap.get(map);
11
12
  if (!mapGetPitch(map) && !mapGetBearing(map)) return;
12
13
  const half = map.getSize().divideBy(2), delta = draggable._newPos.subtract(draggable._startPos);
13
14
  const ground = half.subtract(project(map, half.subtract(delta), true));
@@ -1,11 +1,13 @@
1
+ import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
2
+ import { rotateControlByMap } from '../weakmaps/rotateControlByMap.js';
3
+
1
4
  import { L } from '../globals/L.js';
2
5
  import { Compass } from '../globals/Compass.js';
3
6
  import { ContainerResize } from '../globals/ContainerResize.js';
4
7
  import { PitchDrag } from '../globals/PitchDrag.js';
5
8
  import { ShiftRotate } from '../globals/ShiftRotate.js';
6
9
  import { TouchMode } from '../globals/TouchMode.js';
7
- import { cameraByMap } from '../globals/cameraByMap.js';
8
- import { touchByContainer } from '../globals/touchByContainer.js';
10
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
9
11
  import { cameraTouchStates } from '../globals/cameraTouchStates.js';
10
12
  import { cameraListenerOptions } from '../globals/cameraListenerOptions.js';
11
13
  import { cameraEmptyOptions } from '../globals/cameraEmptyOptions.js';
@@ -74,7 +76,8 @@ export function cameraControls(map) {
74
76
  addCameraHandler(map, 'touchRotate', TouchMode.value);
75
77
  addCameraHandler(map, 'touchPitch', TouchMode.value);
76
78
  const container = map.getContainer();
77
- const state = cameraByMap.get(map)._cameraTouchState = /* alloc */ { map, container, touch: null, nativeZoom: undefined };
79
+ const state = /* alloc */ { map, container, touch: null, nativeZoom: undefined };
80
+ cameraTouchStateByMap.set(map, state);
78
81
  touchByContainer.set(container, state);
79
82
  cameraTouchStates.add(state);
80
83
  container.addEventListener('touchstart', startCameraTouch, cameraListenerOptions);
@@ -84,8 +87,8 @@ export function cameraControls(map) {
84
87
  window.addEventListener('blur', endAllCameraTouches);
85
88
  map.on('cameratouchchange', changeCameraTouch, map);
86
89
  if (map.options.rotateControl) {
87
- cameraByMap.get(map).rotateControl = /* alloc */ new L.Control.Rotate(typeof map.options.rotateControl === 'object' ? map.options.rotateControl : cameraEmptyOptions);
88
- cameraByMap.get(map).rotateControl.addTo(map);
90
+ rotateControlByMap.set(map, /* alloc */ new L.Control.Rotate(typeof map.options.rotateControl === 'object' ? map.options.rotateControl : cameraEmptyOptions));
91
+ rotateControlByMap.get(map).addTo(map);
89
92
  }
90
93
  map.once('unload', cleanupCameraTouch, map);
91
94
  }
@@ -1,10 +1,10 @@
1
- import { dragStates } from '../globals/dragStates.js';
1
+ import { dragStates } from '../weakmaps/dragStates.js';
2
2
 
3
3
 
4
- export function cameraDragClick(event) {
5
- const state = dragStates.value.get(this);
6
- if (!state.moved) return;
7
- event.preventDefault();
8
- event.stopPropagation();
9
- state.moved = false;
4
+ export function cameraDragClick(event) {
5
+ const state = dragStates.value.get(this);
6
+ if (!state.moved) return;
7
+ event.preventDefault();
8
+ event.stopPropagation();
9
+ state.moved = false;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { dragStates } from '../globals/dragStates.js';
1
+ import { dragStates } from '../weakmaps/dragStates.js';
2
2
 
3
3
 
4
4
  export function cameraDragContextMenu(event) {
@@ -1,8 +1,8 @@
1
- import { dragStates } from '../globals/dragStates.js';
1
+ import { dragStates } from '../weakmaps/dragStates.js';
2
2
  import { cameraFocusOptions } from '../globals/cameraFocusOptions.js';
3
3
 
4
4
 
5
- import { editable } from './editable.js';
5
+ import { editable } from './isEditableTarget.js';
6
6
 
7
7
  export function cameraDragDown(event) {
8
8
  const state = dragStates.value.get(this);
@@ -1,4 +1,4 @@
1
- import { dragStates } from '../globals/dragStates.js';
1
+ import { dragStates } from '../weakmaps/dragStates.js';
2
2
 
3
3
  import { finishCameraDrag } from './finishCameraDrag.js';
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { degrees } from '../globals/degrees.js';
2
- import { dragStates } from '../globals/dragStates.js';
2
+ import { dragStates } from '../weakmaps/dragStates.js';
3
3
 
4
- import { mapStopPitchBearingAnimation } from '../camera/mapStopPitchBearingAnimation.js';
4
+ import { mapStopPitchBearingAnimation } from '../animations/mapStopPitchBearingAnimation.js';
5
5
  import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
6
6
  import { mapGetPitch } from '../camera/mapGetPitch.js';
7
7
  import { mapGetBearing } from '../camera/mapGetBearing.js';
@@ -1,11 +1,14 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
1
+ import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
2
+ import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
3
+ import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
4
+
2
5
 
3
6
 
4
7
  import { endCameraTouch } from './endCameraTouch.js';
5
8
 
6
9
  export function changeCameraTouch() {
7
- const state = cameraByMap.get(this)._cameraTouchState, { map, container } = state;
8
- const active = cameraByMap.get(map).touchRotate.enabled() || cameraByMap.get(map).touchPitch.enabled();
10
+ const state = cameraTouchStateByMap.get(this), { map, container } = state;
11
+ const active = touchRotateByMap.get(map).enabled() || touchPitchByMap.get(map).enabled();
9
12
  if (active && state.nativeZoom === undefined) {
10
13
  state.nativeZoom = map.touchZoom?.enabled();
11
14
  map.touchZoom?.disable();