leaflet-city-mapper 0.0.4 → 0.0.6

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 (632) hide show
  1. package/README.md +23 -11
  2. package/cucumber.mjs +9 -9
  3. package/dist/leaflet-city-mapper-src.js +3546 -2493
  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-lens.js +15 -3
  12. package/libs/leaflet.js +1 -1
  13. package/package.json +3 -2
  14. package/src/{camera → animations}/cancelCameraAnimation.js +5 -3
  15. package/src/{core → animations}/cancelGridFade.js +3 -2
  16. package/src/animations/endZoom.js +27 -0
  17. package/src/{camera → animations}/mapAnimateCamera.js +7 -5
  18. package/src/{scene → animations}/onZoomAnim.js +5 -4
  19. package/src/{scene → animations}/renderPendingZoomAnimation.js +4 -2
  20. package/src/{camera → animations}/runCameraAnimations.js +8 -6
  21. package/src/{core → animations}/runGridFades.js +4 -3
  22. package/src/{camera → animations}/scheduleCameraAnimation.js +3 -2
  23. package/src/animations/scheduleGridFade.js +16 -0
  24. package/src/{scene → animations}/startZoom.js +3 -2
  25. package/src/{rendering → animations}/synchronizeZoomView.js +10 -8
  26. package/src/{rendering → animations}/updateZoomCamera.js +11 -8
  27. package/src/archives/decodeDirectory.js +1 -1
  28. package/src/archives/findTile.js +3 -3
  29. package/src/archives/getDirectoryEntries.js +5 -4
  30. package/src/archives/getHeader.js +10 -6
  31. package/src/archives/getTileData.js +3 -3
  32. package/src/archives/getZxy.js +8 -7
  33. package/src/archives/loadDirectory.js +3 -3
  34. package/src/archives/loadSource.js +3 -2
  35. package/src/archives/{read.js → readArchiveRange.js} +7 -5
  36. package/src/camera/cameraMapReady.js +3 -2
  37. package/src/camera/cleanupCameraMap.js +8 -6
  38. package/src/camera/fitCameraBounds.js +3 -3
  39. package/src/camera/initializeCameraMap.js +6 -4
  40. package/src/camera/mapCamera.js +1 -1
  41. package/src/camera/mapContainerPointToLayerPoint.js +2 -2
  42. package/src/camera/mapGetBearing.js +3 -2
  43. package/src/camera/mapGetBounds.js +2 -2
  44. package/src/camera/mapGetBoundsZoom.js +2 -2
  45. package/src/camera/mapGetPitch.js +3 -2
  46. package/src/camera/mapLayerPointToContainerPoint.js +2 -2
  47. package/src/camera/mapLimitCenter.js +1 -1
  48. package/src/camera/mapLimitOffset.js +1 -1
  49. package/src/camera/mapPanBy.js +2 -2
  50. package/src/camera/mapPanInside.js +1 -1
  51. package/src/camera/mapResetNorthPitch.js +1 -1
  52. package/src/camera/mapSetBearing.js +1 -1
  53. package/src/camera/mapSetPitch.js +1 -1
  54. package/src/camera/mapSetPitchAndBearing.js +5 -3
  55. package/src/{rendering → camera}/updateMapCamera.js +19 -15
  56. package/src/{scene/updateCamera.js → camera/updateSceneCamera.js} +1 -1
  57. package/src/camera/updateSky.js +10 -9
  58. package/src/collision/collectIntersections.js +16 -0
  59. package/src/collision/collider.js +24 -9
  60. package/src/collision/countCrossings.js +15 -0
  61. package/src/collision/insideMesh.js +33 -0
  62. package/src/collision/insideWalker.js +46 -0
  63. package/src/collision/readTriangle.js +7 -4
  64. package/src/collision/setTrafficNormal.js +9 -0
  65. package/src/collision/trafficCollision.js +55 -0
  66. package/src/collision/vertexCount.js +3 -0
  67. package/src/{utils → colors}/parseColor.js +1 -1
  68. package/src/controls/addCameraHandler.js +5 -3
  69. package/src/controls/adjustCameraDrag.js +4 -3
  70. package/src/controls/cameraControls.js +14 -5
  71. package/src/controls/cameraDragClick.js +7 -7
  72. package/src/controls/cameraDragContextMenu.js +1 -1
  73. package/src/controls/cameraDragDown.js +2 -2
  74. package/src/controls/cameraDragEnd.js +1 -1
  75. package/src/controls/cameraDragMove.js +2 -2
  76. package/src/controls/changeCameraTouch.js +6 -3
  77. package/src/controls/cleanupCameraTouch.js +7 -5
  78. package/src/controls/dragCamera.js +1 -1
  79. package/src/controls/endCameraTouchEvent.js +1 -1
  80. package/src/controls/moveCameraTouch.js +5 -3
  81. package/src/controls/removeCameraDrag.js +1 -1
  82. package/src/controls/shiftRotateWheel.js +1 -1
  83. package/src/controls/startCameraTouch.js +6 -4
  84. package/src/core/adjustCameraMarkerPan.js +3 -3
  85. package/src/core/cameraCircleBounds.js +1 -1
  86. package/src/core/cameraMarkerDrag.js +1 -1
  87. package/src/core/cameraMarkerOnDrag.js +1 -1
  88. package/src/core/closestCameraLayerPoint.js +1 -1
  89. package/src/core/initializeGridContainer.js +1 -1
  90. package/src/core/initializeNativeLayer.js +9 -8
  91. package/src/core/layerCallInitHooks.js +4 -3
  92. package/src/core/markerSetIcon.js +1 -1
  93. package/src/core/markerSetPos.js +2 -2
  94. package/src/core/markerSetRotation.js +1 -1
  95. package/src/core/markerUpdateZIndex.js +5 -4
  96. package/src/core/popupAdjustPan.js +1 -1
  97. package/src/core/popupUpdatePosition.js +1 -1
  98. package/src/core/redrawPath.js +1 -1
  99. package/src/core/removeLayer.js +4 -3
  100. package/src/core/tooltipSetPosition.js +1 -1
  101. package/src/core/updateGridOpacity.js +3 -3
  102. package/src/core/whenReady.js +11 -0
  103. package/src/geometry/addBridges.js +13 -8
  104. package/src/{sources → geometry}/addGeneratedTriangle.js +1 -1
  105. package/src/{sources/addTriangle.js → geometry/appendAreaTriangle.js} +5 -5
  106. package/src/geometry/assembleAreaGeometry.js +41 -0
  107. package/src/{core → geometry}/boundsQuad.js +1 -1
  108. package/src/geometry/bridgePolygon.js +3 -3
  109. package/src/geometry/buildExtrudedPolygon.js +10 -0
  110. package/src/geometry/buildProjectedPoint.js +21 -0
  111. package/src/{sources/buildAreaPolygon.js → geometry/buildProjectedPolygon.js} +25 -29
  112. package/src/geometry/circleGeometry.js +1 -1
  113. package/src/geometry/computeBounds.js +19 -8
  114. package/src/geometry/conformModelToTerrain.js +17 -11
  115. package/src/{models → geometry}/createModelGeometry.js +5 -4
  116. package/src/geometry/disk.js +1 -1
  117. package/src/geometry/indexBridge.js +5 -4
  118. package/src/geometry/lampPostGeometry.js +2 -2
  119. package/src/geometry/lightGeometry.js +1 -1
  120. package/src/geometry/lineJoin.js +1 -1
  121. package/src/{core → geometry}/markerQuadCorners.js +9 -6
  122. package/src/geometry/nativeGeometry.js +1 -1
  123. package/src/geometry/polygon.js +1 -1
  124. package/src/geometry/roofCoverage.js +11 -8
  125. package/src/geometry/roofFootprint.js +13 -10
  126. package/src/geometry/segment.js +1 -1
  127. package/src/{shadows → geometry}/shadowBounds.js +1 -1
  128. package/src/geometry/surface.js +1 -1
  129. package/src/{terrain → geometry}/terrainBuffers.js +7 -5
  130. package/src/geometry/terrainTileGeometry.js +19 -0
  131. package/src/geometry/treeGeometry.js +2 -2
  132. package/src/globals/geometryWorkerUrl.js +3 -0
  133. package/src/globals/nativeMethodHandlers.js +14 -14
  134. package/src/{scene → gpu}/initializeRendererResources.js +10 -9
  135. package/src/gpu/initializeSharedRenderer.js +52 -0
  136. package/src/gpu/mountRenderer.js +26 -0
  137. package/src/{scene → gpu}/releaseRenderer.js +2 -2
  138. package/src/gpu/rendererDeviceError.js +16 -0
  139. package/src/gpu/rendererDeviceLost.js +16 -0
  140. package/src/{rendering/reportCompilation.js → gpu/reportShaderCompilation.js} +3 -3
  141. package/src/gpu/requestAdapter.js +12 -0
  142. package/src/gpu/requestDevice.js +9 -0
  143. package/src/index.js +8 -13
  144. package/src/layer-controls/layerCountTitle.js +6 -0
  145. package/src/layer-controls/renderLayerCount.js +20 -0
  146. package/src/{scene → layer-controls}/updateLayerCount.js +24 -22
  147. package/src/lighting/lightGrid.js +1 -1
  148. package/src/lighting/updatePointLights.js +13 -10
  149. package/src/{rendering → materials}/createProgram.js +13 -12
  150. package/src/{models/materialFor.js → materials/modelMaterialFor.js} +3 -3
  151. package/src/materials/terrainRasterProgram.js +58 -0
  152. package/src/models/applyModelTransform.js +8 -7
  153. package/src/models/createModelContext.js +3 -3
  154. package/src/models/loadModel.js +17 -12
  155. package/src/models/loadModelResources.js +7 -6
  156. package/src/models/modelNode.js +4 -5
  157. package/src/{core → native}/disposeNativeLayer.js +10 -10
  158. package/src/{core → native}/handleNativeMapEvent.js +5 -4
  159. package/src/{core → native}/initNativeGPU.js +9 -6
  160. package/src/native/isCurrentNativeLayer.js +7 -0
  161. package/src/{core → native}/nativeEventSource.js +3 -3
  162. package/src/{core → native}/nativeEvents.js +1 -1
  163. package/src/{core → native}/nativeLayer.js +16 -37
  164. package/src/{core → native}/nativeLayerMethod.js +14 -5
  165. package/src/{core → native}/pruneNativeResources.js +5 -5
  166. package/src/{core → native}/putNativeMesh.js +3 -3
  167. package/src/{core → native}/quadNativeMesh.js +1 -1
  168. package/src/native/readyNativeGPU.js +10 -0
  169. package/src/{core → native}/refreshNativeLayer.js +8 -7
  170. package/src/{core → native}/refreshNativeLayerContract.js +3 -2
  171. package/src/{core → native}/removeNativeEvents.js +1 -1
  172. package/src/{core → native}/removeTargets.js +3 -2
  173. package/src/native/reorderNativeLayer.js +17 -0
  174. package/src/{core → native}/styleNativeMesh.js +3 -2
  175. package/src/{core → native}/syncGridLayer.js +1 -1
  176. package/src/{core → native}/syncImageOverlay.js +1 -1
  177. package/src/{core → native}/syncMarker.js +1 -1
  178. package/src/{core → native}/syncVectorLayer.js +2 -2
  179. package/src/{core → native}/synchronizeNativeLayer.js +4 -3
  180. package/src/native/updateNativeLayerView.js +10 -0
  181. package/src/picking/findFeature.js +13 -9
  182. package/src/picking/hit.js +16 -8
  183. package/src/picking/onClick.js +3 -2
  184. package/src/picking/onPointerLeave.js +3 -2
  185. package/src/picking/onPointerMove.js +12 -6
  186. package/src/picking/raycast.js +29 -24
  187. package/src/picking/setHighlight.js +9 -8
  188. package/src/picking/shouldSkipOther.js +3 -2
  189. package/src/picking/showFeature.js +19 -14
  190. package/src/{camera/angles.js → projections/cameraAngles.js} +2 -2
  191. package/src/{camera → projections}/groundBounds.js +2 -2
  192. package/src/projections/localPosition.js +11 -0
  193. package/src/{camera/project.js → projections/projectCameraPoint.js} +2 -2
  194. package/src/{sources → projections}/projectRing.js +8 -9
  195. package/src/projections/projectTreePoint.js +17 -0
  196. package/src/{camera/animationPoint.js → projections/transformZoomAnimationPoint.js} +3 -2
  197. package/src/projections/walkerLocalPosition.js +18 -0
  198. package/src/raster/addRasterTile.js +38 -28
  199. package/src/raster/createRasterMesh.js +24 -19
  200. package/src/raster/finishRasterAttachment.js +17 -0
  201. package/src/raster/finishRasterTile.js +22 -19
  202. package/src/raster/initRaster.js +24 -15
  203. package/src/raster/isRasterLoading.js +8 -0
  204. package/src/raster/loadRasterTile.js +8 -7
  205. package/src/raster/onPMTileAdd.js +9 -8
  206. package/src/raster/onPMTileRemove.js +6 -5
  207. package/src/raster/pruneRasterTiles.js +19 -13
  208. package/src/raster/pumpRasterTiles.js +8 -6
  209. package/src/raster/readyRaster.js +3 -2
  210. package/src/raster/registerTerrainTile.js +8 -6
  211. package/src/raster/releaseRasterTile.js +14 -11
  212. package/src/raster/releaseRasterTiles.js +13 -10
  213. package/src/raster/removeRasterTile.js +8 -6
  214. package/src/raster/retainRasterTiles.js +5 -4
  215. package/src/raster/setPMTileOpacity.js +4 -4
  216. package/src/raster/setPMTileZIndex.js +4 -4
  217. package/src/raster/setRasterOpacity.js +8 -6
  218. package/src/raster/setRasterTerrain.js +12 -9
  219. package/src/raster/setRasterZIndex.js +8 -6
  220. package/src/raster/updateAttachedTiles.js +6 -5
  221. package/src/raster/updateRasterTiles.js +20 -15
  222. package/src/rendering/collectFrameMeshes.js +16 -9
  223. package/src/rendering/collectVisibleMesh.js +18 -9
  224. package/src/rendering/createMesh.js +11 -9
  225. package/src/rendering/disposeMesh.js +3 -3
  226. package/src/rendering/drawGeometry.js +9 -7
  227. package/src/rendering/drawSceneMeshes.js +9 -7
  228. package/src/rendering/prepareFrameBuffer.js +6 -5
  229. package/src/rendering/prepareFrameMeshes.js +9 -6
  230. package/src/rendering/prepareFrameUniforms.js +9 -6
  231. package/src/rendering/prepareMeshUniforms.js +1 -1
  232. package/src/rendering/render.js +39 -32
  233. package/src/rendering/resizeRenderer.js +17 -15
  234. package/src/rendering/revealRoofMesh.js +25 -6
  235. package/src/scene/{layerLayerAdd.js → addRegisteredLayer.js} +13 -9
  236. package/src/scene/addSceneLayer.js +4 -3
  237. package/src/scene/attachLayer.js +7 -6
  238. package/src/scene/attachSharedScene.js +69 -0
  239. package/src/scene/callLayer.js +7 -5
  240. package/src/scene/cancelUpdate.js +6 -5
  241. package/src/scene/failAttachment.js +6 -5
  242. package/src/scene/get3DEvents.js +5 -3
  243. package/src/scene/getLocation.js +3 -2
  244. package/src/scene/init3D.js +28 -26
  245. package/src/scene/initializeLayer.js +6 -4
  246. package/src/scene/isNativeLayer.js +3 -2
  247. package/src/scene/layerInitialize.js +11 -6
  248. package/src/scene/onAdd3DLayer.js +30 -24
  249. package/src/scene/onMapChange.js +5 -4
  250. package/src/scene/onRemove3DLayer.js +53 -35
  251. package/src/scene/ready3D.js +22 -13
  252. package/src/scene/releaseSharedScene.js +31 -25
  253. package/src/scene/removeLayerEvents.js +12 -9
  254. package/src/scene/removeSceneLayer.js +3 -2
  255. package/src/scene/renderPendingMapChange.js +7 -4
  256. package/src/scene/renderPendingUpdates.js +9 -6
  257. package/src/scene/restoreObject.js +15 -13
  258. package/src/scene/scheduleSceneUpdate.js +25 -0
  259. package/src/shaders/materialShaders.js +2 -2
  260. package/src/shadows/bindSunlight.js +4 -3
  261. package/src/shadows/drawShadowMeshes.js +4 -3
  262. package/src/shadows/renderSunlight.js +6 -5
  263. package/src/shadows/resizeSunlight.js +7 -6
  264. package/src/shadows/shadowMatrix.js +2 -2
  265. package/src/sources/attachAreaMesh.js +25 -20
  266. package/src/sources/buildArea.js +21 -22
  267. package/src/sources/buildAreaFeature.js +16 -10
  268. package/src/sources/buildAreaFeatures.js +14 -0
  269. package/src/sources/buildAreaPoint.js +3 -21
  270. package/src/sources/extrusionStyle.js +2 -2
  271. package/src/sources/initializeGeoJSON.js +3 -2
  272. package/src/sources/matchesAreaTile.js +7 -0
  273. package/src/sources/pendingSourceAreas.js +3 -2
  274. package/src/sources/prepareAreaGeometryJob.js +24 -0
  275. package/src/sources/projectAreaPolygons.js +15 -0
  276. package/src/sources/pumpSourceAreas.js +37 -0
  277. package/src/sources/releaseArea.js +10 -8
  278. package/src/sources/setGeoJSONData.js +4 -3
  279. package/src/sources/sourceAreaContext.js +18 -17
  280. package/src/sources/updateArea.js +25 -21
  281. package/src/sources/{updateStatus.js → updateSourceStatus.js} +5 -4
  282. package/src/sunlight/{addTo.js → addTimeControlToMap.js} +1 -1
  283. package/src/sunlight/addTimeLayer.js +3 -2
  284. package/src/sunlight/atmosphere.js +2 -2
  285. package/src/sunlight/initSunlight.js +5 -5
  286. package/src/sunlight/{initialize.js → initializeTimeControl.js} +5 -3
  287. package/src/sunlight/onAddSun.js +5 -4
  288. package/src/sunlight/onRemoveSun.js +1 -1
  289. package/src/sunlight/removeSun.js +7 -5
  290. package/src/sunlight/removeTimeLayer.js +3 -2
  291. package/src/sunlight/requestSunlightRender.js +9 -0
  292. package/src/sunlight/updateCelestialDisc.js +1 -1
  293. package/src/sunlight/updateSky.js +4 -2
  294. package/src/sunlight/updateSun.js +8 -6
  295. package/src/sunlight/useSelectedTime.js +4 -3
  296. package/src/terrain/applyTerrain.js +16 -13
  297. package/src/terrain/clearLayerTerrain.js +3 -2
  298. package/src/terrain/getElevation.js +9 -5
  299. package/src/terrain/initTerrain.js +11 -6
  300. package/src/terrain/loadTerrain.js +29 -20
  301. package/src/terrain/loadTerrainTiles.js +4 -3
  302. package/src/terrain/mapElevationOf.js +7 -0
  303. package/src/terrain/onTerrainAdd.js +14 -10
  304. package/src/terrain/onTerrainChange.js +4 -3
  305. package/src/terrain/onTerrainRemove.js +35 -21
  306. package/src/terrain/readyTerrainOf.js +7 -0
  307. package/src/terrain/setLayerTerrain.js +3 -2
  308. package/src/terrain/setTerrainHeight.js +19 -14
  309. package/src/terrain/terrainElevation.js +1 -1
  310. package/src/terrain/terrainTileQueue.js +11 -9
  311. package/src/{core → textures}/addImageState.js +1 -1
  312. package/src/{core/addRasterImage.js → textures/attachRasterImage.js} +1 -1
  313. package/src/{rendering → textures}/collectRoofTiles.js +3 -2
  314. package/src/{rendering → textures}/composeRoofAtlas.js +9 -7
  315. package/src/textures/destroyTexture.js +10 -0
  316. package/src/{models/textureFor.js → textures/modelTextureFor.js} +5 -4
  317. package/src/{core → textures}/nativeImageError.js +1 -1
  318. package/src/{core → textures}/nativeImageRefresh.js +2 -2
  319. package/src/{core/textureFor.js → textures/nativeTextureFor.js} +7 -6
  320. package/src/{rendering → textures}/rebuildRoofAtlas.js +12 -9
  321. package/src/{core → textures}/removeImageState.js +1 -1
  322. package/src/{rendering → textures}/resizeRoofTexture.js +5 -4
  323. package/src/textures/updateRoofAtlas.js +23 -0
  324. package/src/textures/updateRoofRaster.js +29 -0
  325. package/src/{core → textures}/uploadCanvasTexture.js +2 -2
  326. package/src/traffic/addTraffic.js +1 -1
  327. package/src/traffic/disposeTrafficObject.js +5 -3
  328. package/src/traffic/drawTrafficRoute.js +1 -1
  329. package/src/traffic/groundTraffic.js +6 -6
  330. package/src/traffic/initTraffic.js +3 -3
  331. package/src/traffic/loadedTrafficLanes.js +1 -1
  332. package/src/traffic/locateTraffic.js +3 -3
  333. package/src/traffic/placeTraffic.js +2 -1
  334. package/src/traffic/prepareTraffic.js +4 -3
  335. package/src/traffic/rebaseTraffic.js +3 -2
  336. package/src/traffic/rebuildTrafficMesh.js +1 -1
  337. package/src/traffic/removeTraffic.js +1 -1
  338. package/src/traffic/startTraffic.js +1 -1
  339. package/src/traffic/tickTraffic.js +4 -3
  340. package/src/traffic/trafficNow.js +3 -2
  341. package/src/traffic/updateTraffic.js +3 -2
  342. package/src/traffic/updateTrafficLights.js +4 -2
  343. package/src/vehicles/boatBenches.js +1 -1
  344. package/src/vehicles/boatModel.js +1 -1
  345. package/src/vehicles/busModel.js +1 -1
  346. package/src/vehicles/carModel.js +1 -1
  347. package/src/vehicles/metroModel.js +1 -1
  348. package/src/vehicles/tramModel.js +1 -1
  349. package/src/walk/{step.js → animateWalker.js} +15 -19
  350. package/src/walk/createWalk.js +15 -11
  351. package/src/walk/initWalk.js +4 -4
  352. package/src/walk/landWalker.js +38 -0
  353. package/src/walk/moveWalker.js +5 -4
  354. package/src/walk/{onAdd.js → onAddWalkControl.js} +3 -1
  355. package/src/walk/{onRemove.js → onRemoveWalkControl.js} +1 -1
  356. package/src/walk/{onKey.js → onWalkKey.js} +1 -1
  357. package/src/walk/{onTerrain.js → onWalkTerrain.js} +1 -1
  358. package/src/walk/{place.js → placeWalker.js} +2 -2
  359. package/src/walk/resolveWalkerPosition.js +28 -0
  360. package/src/walk/{start.js → startWalking.js} +8 -5
  361. package/src/walk/{stop.js → stopWalking.js} +4 -4
  362. package/src/walk/{toggle.js → toggleWalking.js} +2 -2
  363. package/src/walk/updateWalkerFrame.js +19 -0
  364. package/src/weakmaps/addedByLayer.js +1 -0
  365. package/src/weakmaps/archiveHeaderByLayer.js +1 -0
  366. package/src/weakmaps/areasByLayer.js +1 -0
  367. package/src/weakmaps/bridgeMeshByLayer.js +1 -0
  368. package/src/weakmaps/bridgesByLayer.js +1 -0
  369. package/src/weakmaps/cameraAnimationByMap.js +1 -0
  370. package/src/weakmaps/cameraBearingByMap.js +1 -0
  371. package/src/weakmaps/cameraByLayer.js +1 -0
  372. package/src/weakmaps/cameraDraggableByMap.js +1 -0
  373. package/src/weakmaps/cameraFields.js +37 -0
  374. package/src/weakmaps/cameraFrameByMap.js +1 -0
  375. package/src/weakmaps/cameraHandlersByMap.js +1 -0
  376. package/src/weakmaps/cameraMaps.js +1 -0
  377. package/src/weakmaps/cameraPitchByMap.js +1 -0
  378. package/src/weakmaps/cameraReadyByMap.js +1 -0
  379. package/src/weakmaps/cameraTouchStateByMap.js +1 -0
  380. package/src/weakmaps/cameraViewByMap.js +1 -0
  381. package/src/weakmaps/cameraZIndexOffsetByLayer.js +1 -0
  382. package/src/weakmaps/containerByLayer.js +1 -0
  383. package/src/weakmaps/controlByLayer.js +1 -0
  384. package/src/weakmaps/countStatusByLayer.js +1 -0
  385. package/src/weakmaps/cursorByLayer.js +1 -0
  386. package/src/weakmaps/demByLayer.js +1 -0
  387. package/src/weakmaps/directoriesByLayer.js +1 -0
  388. package/src/weakmaps/etagByLayer.js +1 -0
  389. package/src/weakmaps/eventMapByLayer.js +1 -0
  390. package/src/weakmaps/eventsByLayer.js +1 -0
  391. package/src/weakmaps/fadeFrameByLayer.js +1 -0
  392. package/src/weakmaps/fadeVersionByLayer.js +1 -0
  393. package/src/weakmaps/frameByLayer.js +1 -0
  394. package/src/weakmaps/geojsonByLayer.js +1 -0
  395. package/src/weakmaps/geometryWorkersByMap.js +1 -0
  396. package/src/weakmaps/groupByLayer.js +1 -0
  397. package/src/weakmaps/headerByLayer.js +1 -0
  398. package/src/weakmaps/highlightedFeatureByLayer.js +1 -0
  399. package/src/weakmaps/hoveredFeatureByLayer.js +1 -0
  400. package/src/weakmaps/inflightByLayer.js +1 -0
  401. package/src/weakmaps/kindByLayer.js +1 -0
  402. package/src/weakmaps/layersByLayer.js +1 -0
  403. package/src/weakmaps/loadingTilesByLayer.js +1 -0
  404. package/src/weakmaps/locationByLayer.js +1 -0
  405. package/src/weakmaps/modelByLayer.js +1 -0
  406. package/src/weakmaps/modelUrlByLayer.js +1 -0
  407. package/src/weakmaps/nativeGPUBackByMap.js +1 -0
  408. package/src/weakmaps/nativeGPUByLayer.js +1 -0
  409. package/src/weakmaps/nativeGPUOrderByMap.js +1 -0
  410. package/src/weakmaps/pitchSkyByMap.js +1 -0
  411. package/src/weakmaps/pointerEventsByLayer.js +1 -0
  412. package/src/weakmaps/pruneAfterByLayer.js +1 -0
  413. package/src/weakmaps/pruneVersionByLayer.js +1 -0
  414. package/src/weakmaps/pruneWantedByLayer.js +1 -0
  415. package/src/weakmaps/queuedByLayer.js +1 -0
  416. package/src/weakmaps/rasterGeometryByLayer.js +1 -0
  417. package/src/weakmaps/rasterProgramByLayer.js +1 -0
  418. package/src/weakmaps/rasterTilesByLayer.js +1 -0
  419. package/src/weakmaps/rasterVersionByLayer.js +1 -0
  420. package/src/weakmaps/raycasterByLayer.js +1 -0
  421. package/src/weakmaps/readyByLayer.js +1 -0
  422. package/src/weakmaps/rendererByLayer.js +1 -0
  423. package/src/weakmaps/rendererReadyByLayer.js +1 -0
  424. package/src/weakmaps/roofRasterByLayer.js +1 -0
  425. package/src/weakmaps/roofRastersByLayer.js +1 -0
  426. package/src/weakmaps/rootByLayer.js +1 -0
  427. package/src/weakmaps/rotateControlByMap.js +1 -0
  428. package/src/weakmaps/sceneFields.js +159 -0
  429. package/src/weakmaps/sceneLayers.js +1 -0
  430. package/src/weakmaps/sceneOriginByLayer.js +1 -0
  431. package/src/weakmaps/shadowMeshesByLayer.js +1 -0
  432. package/src/weakmaps/sharedByLayer.js +1 -0
  433. package/src/weakmaps/sizeByLayer.js +1 -0
  434. package/src/weakmaps/state3dByLayer.js +1 -0
  435. package/src/weakmaps/sunlightByMap.js +1 -0
  436. package/src/weakmaps/terrain3DByLayer.js +1 -0
  437. package/src/weakmaps/terrain3DByMap.js +1 -0
  438. package/src/weakmaps/terrainArchiveByLayer.js +1 -0
  439. package/src/weakmaps/terrainBaseYByLayer.js +1 -0
  440. package/src/weakmaps/terrainBoundsByLayer.js +1 -0
  441. package/src/weakmaps/terrainControllerByLayer.js +1 -0
  442. package/src/weakmaps/terrainGridsByLayer.js +1 -0
  443. package/src/weakmaps/terrainLoadingByLayer.js +1 -0
  444. package/src/weakmaps/terrainOriginElevationByLayer.js +1 -0
  445. package/src/weakmaps/terrainPromiseByLayer.js +1 -0
  446. package/src/weakmaps/terrainReadyByLayer.js +1 -0
  447. package/src/weakmaps/terrainRequestByLayer.js +1 -0
  448. package/src/weakmaps/terrainSourceByLayer.js +1 -0
  449. package/src/weakmaps/terrainTilesByLayer.js +1 -0
  450. package/src/weakmaps/terrainZoomByLayer.js +1 -0
  451. package/src/weakmaps/tileZoomByLayer.js +1 -0
  452. package/src/weakmaps/timeControlByMap.js +1 -0
  453. package/src/weakmaps/tooltipByLayer.js +1 -0
  454. package/src/weakmaps/touchPitchByMap.js +1 -0
  455. package/src/weakmaps/touchRotateByMap.js +1 -0
  456. package/src/weakmaps/typeByLayer.js +1 -0
  457. package/src/weakmaps/urlByLayer.js +1 -0
  458. package/src/weakmaps/visibleMeshesByLayer.js +1 -0
  459. package/src/weakmaps/walkerByLayer.js +1 -0
  460. package/src/weakmaps/wantedRasterTilesByLayer.js +1 -0
  461. package/src/weakmaps/zoomLevelByLayer.js +1 -0
  462. package/src/weakmaps/zoomTransitionsByLayer.js +1 -0
  463. package/src/weakmaps/zoomViewByLayer.js +1 -0
  464. package/src/workers/acquireGeometryWorker.js +29 -0
  465. package/src/workers/buildAreaInWorker.js +40 -0
  466. package/src/workers/closeGeometryWorkers.js +11 -0
  467. package/src/workers/createGeometryWorker.js +19 -0
  468. package/src/workers/geometryWorker.js +14 -0
  469. package/src/workers/settleGeometryWorker.js +10 -0
  470. package/src/workers/startGeometryWorker.js +16 -0
  471. package/src/core/bringNativeLayerToBack.js +0 -8
  472. package/src/core/bringNativeLayerToFront.js +0 -8
  473. package/src/core/current.js +0 -6
  474. package/src/core/localPosition.js +0 -10
  475. package/src/core/readyNativeGPU.js +0 -9
  476. package/src/core/reorderNativeLayer.js +0 -9
  477. package/src/core/scheduleGridFade.js +0 -14
  478. package/src/core/updateNativeLayerView.js +0 -9
  479. package/src/geometry/dot.js +0 -6
  480. package/src/geometry/push.js +0 -3
  481. package/src/globals/cameraByMap.js +0 -1
  482. package/src/raster/finishAttachment.js +0 -15
  483. package/src/raster/isLoading.js +0 -7
  484. package/src/raster/terrainTileGeometry.js +0 -16
  485. package/src/rendering/destroyTexture.js +0 -9
  486. package/src/rendering/sortMeshes.js +0 -6
  487. package/src/rendering/updateRoofAtlas.js +0 -20
  488. package/src/rendering/updateRoofRaster.js +0 -25
  489. package/src/scene/attach.js +0 -54
  490. package/src/scene/endZoom.js +0 -23
  491. package/src/scene/initializeSharedRenderer.js +0 -45
  492. package/src/scene/layerCountTitle.js +0 -4
  493. package/src/scene/mountRenderer.js +0 -25
  494. package/src/scene/ready.js +0 -9
  495. package/src/scene/renderLayerCount.js +0 -13
  496. package/src/scene/rendererDeviceError.js +0 -14
  497. package/src/scene/rendererDeviceLost.js +0 -14
  498. package/src/scene/requestAdapter.js +0 -12
  499. package/src/scene/requestDevice.js +0 -9
  500. package/src/scene/update.js +0 -23
  501. package/src/sources/projectedTree.js +0 -19
  502. package/src/sources/pump.js +0 -44
  503. package/src/sunlight/render.js +0 -9
  504. package/src/terrain/rasterProgram.js +0 -51
  505. package/src/walk/land.js +0 -32
  506. package/src/walk/local.js +0 -18
  507. /package/src/{camera → animations}/mapStopPitchBearingAnimation.js +0 -0
  508. /package/src/{core → animations}/runMarkerPanFrame.js +0 -0
  509. /package/src/{core → animations}/scheduleMarkerPan.js +0 -0
  510. /package/src/archives/{varint.js → readVarint.js} +0 -0
  511. /package/src/{sunlight → astronomy}/horizontalPosition.js +0 -0
  512. /package/src/{sunlight → astronomy}/moonPosition.js +0 -0
  513. /package/src/{sunlight → astronomy}/solarPosition.js +0 -0
  514. /package/src/{sunlight → astronomy}/solarTime.js +0 -0
  515. /package/src/{scene → camera}/createSceneCamera.js +0 -0
  516. /package/src/{sunlight/rgb.js → colors/formatRGB.js} +0 -0
  517. /package/src/{utils/channel.js → colors/hslChannel.js} +0 -0
  518. /package/src/{sunlight/mix.js → colors/mixColor.js} +0 -0
  519. /package/src/{utils → colors}/toSRGB.js +0 -0
  520. /package/src/controls/{editable.js → isEditableTarget.js} +0 -0
  521. /package/src/geometry/{nativeTriangle.js → appendNativeTriangle.js} +0 -0
  522. /package/src/{traffic → geometry}/appendRouteDash.js +0 -0
  523. /package/src/{traffic → geometry}/appendRouteSegment.js +0 -0
  524. /package/src/geometry/{build.js → buildGeometryParts.js} +0 -0
  525. /package/src/geometry/{lampRing.js → createLampRing.js} +0 -0
  526. /package/src/{raster/createGeometry.js → geometry/createRasterQuadGeometry.js} +0 -0
  527. /package/src/geometry/{treeRing.js → createTreeRing.js} +0 -0
  528. /package/src/geometry/{cross.js → crossVector.js} +0 -0
  529. /package/src/{sources → geometry}/generateTreeGeometry.js +0 -0
  530. /package/src/{sources → geometry}/instanceAreaGeometry.js +0 -0
  531. /package/src/{traffic/along.js → geometry/interpolateRoute.js} +0 -0
  532. /package/src/{core → geometry}/markerImageBounds.js +0 -0
  533. /package/src/{shadows → geometry}/meshShadowBounds.js +0 -0
  534. /package/src/geometry/{below.js → offsetBelowGround.js} +0 -0
  535. /package/src/{scene → geometry}/restoreGeometry.js +0 -0
  536. /package/src/{traffic → geometry}/routeGeometry.js +0 -0
  537. /package/src/geometry/{sub.js → subtractVector.js} +0 -0
  538. /package/src/{terrain → geometry}/terrainGrid.js +0 -0
  539. /package/src/geometry/{visit.js → visitNativeCoordinates.js} +0 -0
  540. /package/src/{scene → gpu}/showWebGPUWarning.js +0 -0
  541. /package/src/{scene → layer-controls}/placeEntry.js +0 -0
  542. /package/src/{scene → layer-controls}/placeEntryElement.js +0 -0
  543. /package/src/{scene → layer-controls}/placeUnderEntry.js +0 -0
  544. /package/src/{scene → layer-controls}/removeEntry.js +0 -0
  545. /package/src/{scene → layer-controls}/replaceEntry.js +0 -0
  546. /package/src/{scene → layer-controls}/runPlacements.js +0 -0
  547. /package/src/{scene → layer-controls}/underEntry.js +0 -0
  548. /package/src/lighting/{visitCells.js → visitLightGridCells.js} +0 -0
  549. /package/src/{rendering → materials}/createProgramLayout.js +0 -0
  550. /package/src/{rendering → materials}/createProgramUniforms.js +0 -0
  551. /package/src/{rendering → materials}/prepareMeshCutout.js +0 -0
  552. /package/src/{shaders → materials}/validateRoofMaterial.js +0 -0
  553. /package/src/{core → native}/beforeNativeRender.js +0 -0
  554. /package/src/{core → native}/bypassNativeEvent.js +0 -0
  555. /package/src/{core → native}/compareNativeHits.js +0 -0
  556. /package/src/{core → native}/forwardNativeError.js +0 -0
  557. /package/src/{core → native}/hideTargets.js +0 -0
  558. /package/src/{core → native}/nativeAddLatLng.js +0 -0
  559. /package/src/{core → native}/nativeBringToBack.js +0 -0
  560. /package/src/{core → native}/nativeBringToFront.js +0 -0
  561. /package/src/{core → native}/nativeRedraw.js +0 -0
  562. /package/src/{core → native}/nativeSetBounds.js +0 -0
  563. /package/src/{core → native}/nativeSetIcon.js +0 -0
  564. /package/src/{core → native}/nativeSetLatLng.js +0 -0
  565. /package/src/{core → native}/nativeSetLatLngs.js +0 -0
  566. /package/src/{core → native}/nativeSetOpacity.js +0 -0
  567. /package/src/{core → native}/nativeSetRadius.js +0 -0
  568. /package/src/{core → native}/nativeSetStyle.js +0 -0
  569. /package/src/{core → native}/nativeSetUrl.js +0 -0
  570. /package/src/{core → native}/nativeSetZIndex.js +0 -0
  571. /package/src/{core → native}/nativeSetZIndexOffset.js +0 -0
  572. /package/src/{core → native}/refreshNativeEvent.js +0 -0
  573. /package/src/{core → native}/rejectNativeReady.js +0 -0
  574. /package/src/{core → native}/resolveNativeReady.js +0 -0
  575. /package/src/{core → native}/restoreNativeEvents.js +0 -0
  576. /package/src/{core → native}/updateNativeHover.js +0 -0
  577. /package/src/{camera/displayPoint.js → projections/displayContainerPoint.js} +0 -0
  578. /package/src/{core → projections}/localPixel.js +0 -0
  579. /package/src/{core → projections}/localPixelForGeometry.js +0 -0
  580. /package/src/{core → projections}/markerCameraIconPoint.js +0 -0
  581. /package/src/{geometry/bridgeLocal.js → projections/projectBridgePoint.js} +0 -0
  582. /package/src/{sunlight → projections}/projectCelestialBody.js +0 -0
  583. /package/src/{camera/pointOf.js → projections/toPoint.js} +0 -0
  584. /package/src/{camera → projections}/verticalGroundY.js +0 -0
  585. /package/src/raster/{reportError.js → reportRasterError.js} +0 -0
  586. /package/src/scene/{emptyNode.js → createSceneNode.js} +0 -0
  587. /package/src/scene/{reportError.js → reportLayerError.js} +0 -0
  588. /package/src/sunlight/{onAdd.js → onAddTimeControl.js} +0 -0
  589. /package/src/sunlight/{remove.js → removeTimeControl.js} +0 -0
  590. /package/src/terrain/{sample.js → sampleTerrainTile.js} +0 -0
  591. /package/src/{rendering → textures}/bindMeshTextures.js +0 -0
  592. /package/src/{rendering → textures}/compareRoofTiles.js +0 -0
  593. /package/src/{rendering/destroyAfterSubmission.js → textures/destroyTextureAfterSubmission.js} +0 -0
  594. /package/src/{rendering → textures}/ensureRoofBlit.js +0 -0
  595. /package/src/{models/loadImage.js → textures/loadModelImage.js} +0 -0
  596. /package/src/{models/textureSampler.js → textures/modelTextureSampler.js} +0 -0
  597. /package/src/{rendering → textures}/prepareMeshTextures.js +0 -0
  598. /package/src/{scene → textures}/restoreMaterialTextures.js +0 -0
  599. /package/src/{rendering → textures}/textureBinding.js +0 -0
  600. /package/src/{rendering → textures}/uploadMeshTexture.js +0 -0
  601. /package/src/{core → textures}/uploadNativeImage.js +0 -0
  602. /package/src/{rendering → textures}/uploadRoofTile.js +0 -0
  603. /package/src/traffic/{toLanes.js → featuresToTrafficLanes.js} +0 -0
  604. /package/src/traffic/{tooltip.js → trafficTooltip.js} +0 -0
  605. /package/src/{scene → transforms}/composeLocalTransform.js +0 -0
  606. /package/src/{models/nodeMatrix.js → transforms/modelNodeMatrix.js} +0 -0
  607. /package/src/{core → transforms}/transformNativePoint.js +0 -0
  608. /package/src/{scene → transforms}/updateWorldMatrix.js +0 -0
  609. /package/src/{scene → transforms}/worldMatrixChanged.js +0 -0
  610. /package/src/vehicles/{carriage.js → buildCarriage.js} +0 -0
  611. /package/src/vehicles/{mirror.js → mirrorVehiclePart.js} +0 -0
  612. /package/src/walk/{initialize.js → initializeWalkControl.js} +0 -0
  613. /package/src/walk/{blocked.js → isWalkBlocked.js} +0 -0
  614. /package/src/walk/{onBlur.js → onWalkBlur.js} +0 -0
  615. /package/src/walk/{onPointer.js → onWalkPointer.js} +0 -0
  616. /package/src/{globals → weakmaps}/boundsMethods.js +0 -0
  617. /package/src/{globals → weakmaps}/closestMethods.js +0 -0
  618. /package/src/{globals → weakmaps}/colliders.js +0 -0
  619. /package/src/{globals → weakmaps}/dragByHandler.js +0 -0
  620. /package/src/{globals → weakmaps}/dragStates.js +0 -0
  621. /package/src/{globals → weakmaps}/gridInitializers.js +0 -0
  622. /package/src/{globals → weakmaps}/imageStates.js +0 -0
  623. /package/src/{globals → weakmaps}/nativeEventMaps.js +0 -0
  624. /package/src/{globals → weakmaps}/nativeRenderByLayer.js +0 -0
  625. /package/src/{globals → weakmaps}/rendererDevices.js +0 -0
  626. /package/src/{globals → weakmaps}/renderers.js +0 -0
  627. /package/src/{globals → weakmaps}/sceneByLayer.js +0 -0
  628. /package/src/{globals → weakmaps}/sunByMap.js +0 -0
  629. /package/src/{globals → weakmaps}/sunlightByControl.js +0 -0
  630. /package/src/{globals → weakmaps}/touchByContainer.js +0 -0
  631. /package/src/{globals → weakmaps}/trafficByLayer.js +0 -0
  632. /package/src/{globals → weakmaps}/walkByMap.js +0 -0
@@ -1,11 +1,16 @@
1
+ import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
2
+ import { cameraHandlersByMap } from '../weakmaps/cameraHandlersByMap.js';
3
+ import { rotateControlByMap } from '../weakmaps/rotateControlByMap.js';
4
+ import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
5
+ import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
6
+
1
7
  import { L } from '../globals/L.js';
2
8
  import { Compass } from '../globals/Compass.js';
3
9
  import { ContainerResize } from '../globals/ContainerResize.js';
4
10
  import { PitchDrag } from '../globals/PitchDrag.js';
5
11
  import { ShiftRotate } from '../globals/ShiftRotate.js';
6
12
  import { TouchMode } from '../globals/TouchMode.js';
7
- import { cameraByMap } from '../globals/cameraByMap.js';
8
- import { touchByContainer } from '../globals/touchByContainer.js';
13
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
9
14
  import { cameraTouchStates } from '../globals/cameraTouchStates.js';
10
15
  import { cameraListenerOptions } from '../globals/cameraListenerOptions.js';
11
16
  import { cameraEmptyOptions } from '../globals/cameraEmptyOptions.js';
@@ -73,8 +78,11 @@ export function cameraControls(map) {
73
78
  addCameraHandler(map, 'compassBearing', Compass.value);
74
79
  addCameraHandler(map, 'touchRotate', TouchMode.value);
75
80
  addCameraHandler(map, 'touchPitch', TouchMode.value);
81
+ touchRotateByMap.set(map, cameraHandlersByMap.get(map).get('touchRotate'));
82
+ touchPitchByMap.set(map, cameraHandlersByMap.get(map).get('touchPitch'));
76
83
  const container = map.getContainer();
77
- const state = cameraByMap.get(map)._cameraTouchState = /* alloc */ { map, container, touch: null, nativeZoom: undefined };
84
+ const state = /* alloc */ { map, container, touch: null, nativeZoom: undefined };
85
+ cameraTouchStateByMap.set(map, state);
78
86
  touchByContainer.set(container, state);
79
87
  cameraTouchStates.add(state);
80
88
  container.addEventListener('touchstart', startCameraTouch, cameraListenerOptions);
@@ -83,9 +91,10 @@ export function cameraControls(map) {
83
91
  container.addEventListener('touchcancel', endCameraTouchEvent, true);
84
92
  window.addEventListener('blur', endAllCameraTouches);
85
93
  map.on('cameratouchchange', changeCameraTouch, map);
94
+ changeCameraTouch.call(map);
86
95
  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);
96
+ rotateControlByMap.set(map, /* alloc */ new L.Control.Rotate(typeof map.options.rotateControl === 'object' ? map.options.rotateControl : cameraEmptyOptions));
97
+ rotateControlByMap.get(map).addTo(map);
89
98
  }
90
99
  map.once('unload', cleanupCameraTouch, map);
91
100
  }
@@ -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();
@@ -1,6 +1,8 @@
1
- import { cameraByMap } from '../globals/cameraByMap.js';
1
+ import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
2
+ import { rotateControlByMap } from '../weakmaps/rotateControlByMap.js';
3
+
2
4
  import { cameraTouchStates } from '../globals/cameraTouchStates.js';
3
- import { touchByContainer } from '../globals/touchByContainer.js';
5
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
4
6
 
5
7
 
6
8
  import { endCameraTouch } from './endCameraTouch.js';
@@ -12,7 +14,7 @@ import { endAllCameraTouches } from './endAllCameraTouches.js';
12
14
  import { changeCameraTouch } from './changeCameraTouch.js';
13
15
 
14
16
  export function cleanupCameraTouch() {
15
- const state = cameraByMap.get(this)._cameraTouchState;
17
+ const state = cameraTouchStateByMap.get(this);
16
18
  if (!state) return;
17
19
  const { container, map } = state;
18
20
  endCameraTouch(state);
@@ -23,7 +25,7 @@ export function cleanupCameraTouch() {
23
25
  cameraTouchStates.delete(state);
24
26
  if (!cameraTouchStates.size) window.removeEventListener('blur', endAllCameraTouches);
25
27
  map.off('cameratouchchange', changeCameraTouch, map);
26
- cameraByMap.get(map).rotateControl?.remove();
28
+ rotateControlByMap.get(map)?.remove();
27
29
  touchByContainer.delete(container);
28
- delete cameraByMap.get(map)._cameraTouchState;
30
+ cameraTouchStateByMap.delete(map);
29
31
  }
@@ -1,5 +1,5 @@
1
1
  import { cameraDragSensitivity } from '../globals/cameraDragSensitivity.js';
2
- import { dragStates } from '../globals/dragStates.js';
2
+ import { dragStates } from '../weakmaps/dragStates.js';
3
3
  import { cameraDrags } from '../globals/cameraDrags.js';
4
4
 
5
5
 
@@ -1,4 +1,4 @@
1
- import { touchByContainer } from '../globals/touchByContainer.js';
1
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
2
2
 
3
3
 
4
4
  import { endCameraTouch } from './endCameraTouch.js';
@@ -1,6 +1,8 @@
1
+ import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
2
+ import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
3
+
1
4
  import { degrees } from '../globals/degrees.js';
2
- import { touchByContainer } from '../globals/touchByContainer.js';
3
- import { cameraByMap } from '../globals/cameraByMap.js';
5
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
4
6
 
5
7
  import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
6
8
 
@@ -13,7 +15,7 @@ export function moveCameraTouch(event) {
13
15
  middle.x = (a.clientX + b.clientX) / 2 - rect.left;
14
16
  middle.y = (a.clientY + b.clientY) / 2 - rect.top;
15
17
  const delta = Math.atan2(Math.sin(angle - touch.angle), Math.cos(angle - touch.angle)) * degrees;
16
- mapSetPitchAndBearing(map, cameraByMap.get(map).touchPitch.enabled() ? touch.pitch - (middle.y - touch.middle.y) * 0.25 : touch.pitch, cameraByMap.get(map).touchRotate.enabled() ? touch.bearing + delta : touch.bearing);
18
+ mapSetPitchAndBearing(map, touchPitchByMap.get(map).enabled() ? touch.pitch - (middle.y - touch.middle.y) * 0.25 : touch.pitch, touchRotateByMap.get(map).enabled() ? touch.bearing + delta : touch.bearing);
17
19
  const distance = Math.hypot(b.clientX - a.clientX, b.clientY - a.clientY);
18
20
  if (distance < 1) return;
19
21
  const zoom = touch.zooming ? Math.max(map.getMinZoom(), Math.min(map.getMaxZoom(),
@@ -1,4 +1,4 @@
1
- import { dragStates } from '../globals/dragStates.js';
1
+ import { dragStates } from '../weakmaps/dragStates.js';
2
2
  import { cameraDrags } from '../globals/cameraDrags.js';
3
3
 
4
4
  import { finishCameraDrag } from './finishCameraDrag.js';
@@ -1,6 +1,6 @@
1
1
  import { mapSetBearing } from '../camera/mapSetBearing.js';
2
2
  import { mapGetBearing } from '../camera/mapGetBearing.js';
3
- import { editable } from './editable.js';
3
+ import { editable } from './isEditableTarget.js';
4
4
 
5
5
  export function shiftRotateWheel(event) {
6
6
  const handler = this._cameraShiftRotate;
@@ -1,15 +1,17 @@
1
+ import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
2
+ import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
3
+
1
4
  import { L } from '../globals/L.js';
2
- import { touchByContainer } from '../globals/touchByContainer.js';
3
- import { cameraByMap } from '../globals/cameraByMap.js';
5
+ import { touchByContainer } from '../weakmaps/touchByContainer.js';
4
6
 
5
- import { mapStopPitchBearingAnimation } from '../camera/mapStopPitchBearingAnimation.js';
7
+ import { mapStopPitchBearingAnimation } from '../animations/mapStopPitchBearingAnimation.js';
6
8
  import { mapGetBearing } from '../camera/mapGetBearing.js';
7
9
  import { mapGetPitch } from '../camera/mapGetPitch.js';
8
10
 
9
11
  export function startCameraTouch(event) {
10
12
  const state = touchByContainer.get(this), { map, container } = state;
11
13
  if (state.touch || event.touches.length !== 2 || event.target.closest('.leaflet-control')) return;
12
- if (!cameraByMap.get(map).touchRotate.enabled() && !cameraByMap.get(map).touchPitch.enabled()) return;
14
+ if (!touchRotateByMap.get(map).enabled() && !touchPitchByMap.get(map).enabled()) return;
13
15
  const [a, b] = event.touches;
14
16
  if (Math.hypot(b.clientX - a.clientX, b.clientY - a.clientY) < 1) return;
15
17
  mapStopPitchBearingAnimation(map);
@@ -1,11 +1,11 @@
1
1
  import { L } from '../globals/L.js';
2
- import { dragByHandler } from '../globals/dragByHandler.js';
2
+ import { dragByHandler } from '../weakmaps/dragByHandler.js';
3
3
 
4
4
  import { mapGetPitch } from '../camera/mapGetPitch.js';
5
5
  import { mapGetBearing } from '../camera/mapGetBearing.js';
6
6
 
7
- import { pointOf } from '../camera/pointOf.js';
8
- import { scheduleMarkerPan } from './scheduleMarkerPan.js';
7
+ import { pointOf } from '../projections/toPoint.js';
8
+ import { scheduleMarkerPan } from '../animations/scheduleMarkerPan.js';
9
9
 
10
10
  export function adjustCameraMarkerPan(event) {
11
11
  const marker = this._marker, map = marker._map;
@@ -1,4 +1,4 @@
1
- import { boundsMethods } from '../globals/boundsMethods.js';
1
+ import { boundsMethods } from '../weakmaps/boundsMethods.js';
2
2
 
3
3
 
4
4
  export function cameraCircleBounds() {
@@ -1,4 +1,4 @@
1
- import { dragByHandler } from '../globals/dragByHandler.js';
1
+ import { dragByHandler } from '../weakmaps/dragByHandler.js';
2
2
 
3
3
 
4
4
  import { cameraMarkerOnDrag } from './cameraMarkerOnDrag.js';
@@ -1,5 +1,5 @@
1
1
  import { L } from '../globals/L.js';
2
- import { dragByHandler } from '../globals/dragByHandler.js';
2
+ import { dragByHandler } from '../weakmaps/dragByHandler.js';
3
3
 
4
4
 
5
5
 
@@ -1,4 +1,4 @@
1
- import { closestMethods } from '../globals/closestMethods.js';
1
+ import { closestMethods } from '../weakmaps/closestMethods.js';
2
2
 
3
3
 
4
4
  export function closestCameraLayerPoint(point) {
@@ -1,4 +1,4 @@
1
- import { gridInitializers } from '../globals/gridInitializers.js';
1
+ import { gridInitializers } from '../weakmaps/gridInitializers.js';
2
2
 
3
3
 
4
4
  export function initializeGridContainer() {
@@ -1,26 +1,27 @@
1
+ import { kindByLayer } from '../weakmaps/kindByLayer.js';
2
+
1
3
  import { L } from '../globals/L.js';
2
- import { sceneByLayer } from '../globals/sceneByLayer.js';
3
- import { closestMethods } from '../globals/closestMethods.js';
4
- import { boundsMethods } from '../globals/boundsMethods.js';
5
- import { gridInitializers } from '../globals/gridInitializers.js';
4
+ import { closestMethods } from '../weakmaps/closestMethods.js';
5
+ import { boundsMethods } from '../weakmaps/boundsMethods.js';
6
+ import { gridInitializers } from '../weakmaps/gridInitializers.js';
6
7
 
7
8
 
8
9
  import { noOperation } from '../utils/noOperation.js';
9
10
  import { emptyEvents } from '../scene/emptyEvents.js';
10
- import { refreshNativeLayerContract } from './refreshNativeLayerContract.js';
11
+ import { refreshNativeLayerContract } from '../native/refreshNativeLayerContract.js';
11
12
 
12
13
  import { closestCameraLayerPoint } from './closestCameraLayerPoint.js';
13
14
  import { cameraCircleBounds } from './cameraCircleBounds.js';
14
15
  import { initializeGridContainer } from './initializeGridContainer.js';
15
16
  import { updateGridOpacity } from './updateGridOpacity.js';
16
- import { addRasterImage } from './addRasterImage.js';
17
+ import { addRasterImage } from '../textures/attachRasterImage.js';
17
18
  import { redrawPath } from './redrawPath.js';
18
19
 
19
20
  export function initializeNativeLayer() {
20
21
  if (this instanceof L.Polyline || this instanceof L.CircleMarker) {
21
22
  this.beforeAdd = this._updateBounds = noOperation;
22
23
  this.redraw = redrawPath;
23
- sceneByLayer.get(this).kind = 'path';
24
+ kindByLayer.set(this, 'path');
24
25
  if (this instanceof L.Polyline) {
25
26
  closestMethods.set(this, this.closestLayerPoint);
26
27
  this.closestLayerPoint = closestCameraLayerPoint;
@@ -34,7 +35,7 @@ export function initializeNativeLayer() {
34
35
  this._initContainer = initializeGridContainer;
35
36
  this._updateOpacity = updateGridOpacity;
36
37
  } else if (this instanceof L.ImageOverlay && !(this instanceof L.VideoOverlay) && !(this instanceof L.SVGOverlay)) {
37
- sceneByLayer.get(this).kind = 'image';
38
+ kindByLayer.set(this, 'image');
38
39
  this._reset = refreshNativeLayerContract;
39
40
  }
40
41
  }
@@ -1,12 +1,13 @@
1
- import { sceneByLayer } from '../globals/sceneByLayer.js';
1
+ import { sceneLayers } from '../weakmaps/sceneLayers.js';
2
+
2
3
  import { layerCallInitHooks as sharedLayerCallInitHooks } from '../globals/layerCallInitHooks.js';
3
4
 
4
5
 
5
6
  import { initializeNativeLayer } from './initializeNativeLayer.js';
6
7
 
7
8
  export function layerCallInitHooks() {
8
- if (!sceneByLayer.has(this)) {
9
- sceneByLayer.set(this, /* alloc */ {});
9
+ if (!sceneLayers.has(this)) {
10
+ sceneLayers.add(this);
10
11
  }
11
12
  const initialized = this._initHooksCalled;
12
13
  sharedLayerCallInitHooks.value.call(this);
@@ -2,7 +2,7 @@ import { L } from '../globals/L.js';
2
2
  import { markerMethods } from '../globals/markerMethods.js';
3
3
 
4
4
 
5
- import { initNativeGPU } from './initNativeGPU.js';
5
+ import { initNativeGPU } from '../native/initNativeGPU.js';
6
6
 
7
7
  export function markerSetIcon(icon) {
8
8
  if (!(icon instanceof L.DivIcon)) icon.options.crossOrigin ||= true;
@@ -1,8 +1,8 @@
1
1
  import { markerMethods } from '../globals/markerMethods.js';
2
2
 
3
- import { markerCameraIconPoint } from './markerCameraIconPoint.js';
3
+ import { markerCameraIconPoint } from '../projections/markerCameraIconPoint.js';
4
4
 
5
- import { displayPoint } from '../camera/displayPoint.js';
5
+ import { displayPoint } from '../projections/displayContainerPoint.js';
6
6
 
7
7
  export function markerSetPos(point) {
8
8
  markerMethods.value._setPos.call(this, displayPoint(this._map, point));
@@ -1,4 +1,4 @@
1
- import { refreshNativeLayerContract } from './refreshNativeLayerContract.js';
1
+ import { refreshNativeLayerContract } from '../native/refreshNativeLayerContract.js';
2
2
 
3
3
  export function markerSetRotation(marker, rotation) {
4
4
  if (!Number.isFinite(rotation)) throw /* alloc */ new TypeError('Marker rotation must be finite');
@@ -1,12 +1,13 @@
1
+ import { cameraZIndexOffsetByLayer } from '../weakmaps/cameraZIndexOffsetByLayer.js';
2
+
1
3
  import { markerMethods } from '../globals/markerMethods.js';
2
- import { sceneByLayer } from '../globals/sceneByLayer.js';
3
4
 
4
5
 
5
6
 
6
7
  export function markerUpdateZIndex(offset) {
7
8
  markerMethods.value._updateZIndex.call(this, offset);
8
- const changed = sceneByLayer.get(this)._cameraZIndexOffset !== offset;
9
- sceneByLayer.get(this)._cameraZIndexOffset = offset;
9
+ const changed = cameraZIndexOffsetByLayer.get(this) !== offset;
10
+ cameraZIndexOffsetByLayer.set(this, offset);
10
11
  if (changed) refreshNativeLayerContract(this);
11
12
  }
12
- import { refreshNativeLayerContract } from './refreshNativeLayerContract.js';
13
+ import { refreshNativeLayerContract } from '../native/refreshNativeLayerContract.js';
@@ -3,7 +3,7 @@ import { popupPan } from '../globals/popupPan.js';
3
3
  import { mapGetPitch } from '../camera/mapGetPitch.js';
4
4
  import { mapGetBearing } from '../camera/mapGetBearing.js';
5
5
 
6
- import { pointOf } from '../camera/pointOf.js';
6
+ import { pointOf } from '../projections/toPoint.js';
7
7
 
8
8
  export function popupAdjustPan() {
9
9
  const map = this._map;
@@ -2,7 +2,7 @@ import { L } from '../globals/L.js';
2
2
  import { popupPosition } from '../globals/popupPosition.js';
3
3
 
4
4
 
5
- import { displayPoint } from '../camera/displayPoint.js';
5
+ import { displayPoint } from '../projections/displayContainerPoint.js';
6
6
 
7
7
  export function popupUpdatePosition() {
8
8
  popupPosition.value.call(this);
@@ -1,4 +1,4 @@
1
- import { refreshNativeLayerContract } from './refreshNativeLayerContract.js';
1
+ import { refreshNativeLayerContract } from '../native/refreshNativeLayerContract.js';
2
2
 
3
3
  export function redrawPath() {
4
4
  refreshNativeLayerContract(this);
@@ -1,5 +1,6 @@
1
+ import { kindByLayer } from '../weakmaps/kindByLayer.js';
2
+
1
3
  import { L } from '../globals/L.js';
2
- import { sceneByLayer } from '../globals/sceneByLayer.js';
3
4
  import { removeLayer as sharedRemoveLayer } from '../globals/removeLayer.js';
4
5
 
5
6
  import { removeSceneLayer } from '../scene/removeSceneLayer.js';
@@ -9,8 +10,8 @@ import { removeSceneLayer } from '../scene/removeSceneLayer.js';
9
10
  export function removeLayer(layer) {
10
11
  const id = L.Util.stamp(layer);
11
12
  if (!this._layers[id]) return this;
12
- const state = sceneByLayer.get(layer);
13
- if (!state.kind) return sharedRemoveLayer.value.call(this, layer);
13
+
14
+ if (!kindByLayer.get(layer)) return sharedRemoveLayer.value.call(this, layer);
14
15
  if (this._loaded) removeSceneLayer(layer, this);
15
16
  delete this._layers[id];
16
17
  if (this._loaded) {
@@ -2,7 +2,7 @@ import { L } from '../globals/L.js';
2
2
  import { tooltipPosition } from '../globals/tooltipPosition.js';
3
3
 
4
4
 
5
- import { displayPoint } from '../camera/displayPoint.js';
5
+ import { displayPoint } from '../projections/displayContainerPoint.js';
6
6
 
7
7
  export function tooltipSetPosition(point) {
8
8
  tooltipPosition.value.call(this, point);
@@ -1,6 +1,6 @@
1
1
 
2
- import { cancelGridFade } from './cancelGridFade.js';
3
- import { scheduleGridFade } from './scheduleGridFade.js';
2
+ import { cancelGridFade } from '../animations/cancelGridFade.js';
3
+ import { scheduleGridFade } from '../animations/scheduleGridFade.js';
4
4
 
5
5
  export function updateGridOpacity() {
6
6
  if (!this._map) return;
@@ -24,4 +24,4 @@ export function updateGridOpacity() {
24
24
  cancelGridFade(layer);
25
25
  if (fading) scheduleGridFade(layer);
26
26
  }
27
- import { refreshNativeLayerContract } from './refreshNativeLayerContract.js';
27
+ import { refreshNativeLayerContract } from '../native/refreshNativeLayerContract.js';
@@ -0,0 +1,11 @@
1
+ import { readyByLayer } from '../weakmaps/readyByLayer.js';
2
+ import { cameraReadyByMap } from '../weakmaps/cameraReadyByMap.js';
3
+
4
+
5
+
6
+
7
+
8
+ export function ready(instance) {
9
+ return readyByLayer.get(instance) ||
10
+ cameraReadyByMap.get(instance) || Promise.resolve(instance);
11
+ }
@@ -1,5 +1,10 @@
1
+ import { bridgeMeshByLayer } from '../weakmaps/bridgeMeshByLayer.js';
2
+ import { bridgesByLayer } from '../weakmaps/bridgesByLayer.js';
3
+ import { locationByLayer } from '../weakmaps/locationByLayer.js';
4
+ import { rootByLayer } from '../weakmaps/rootByLayer.js';
5
+ import { terrainZoomByLayer } from '../weakmaps/terrainZoomByLayer.js';
6
+
1
7
  import { radians } from '../globals/radians.js';
2
- import { sceneByLayer } from '../globals/sceneByLayer.js';
3
8
  import { createMesh } from '../rendering/createMesh.js';
4
9
  import { bridgePolygon } from './bridgePolygon.js';
5
10
 
@@ -8,13 +13,13 @@ import { bridgePolygon } from './bridgePolygon.js';
8
13
  * Polygon/MultiPolygon with Z, e.g. IGN BD TOPO), and one mesh draws the 1.2 m thick decks.
9
14
  * ponytail: anything under a deck (quays, boats asking `getElevation`) also gets the deck height.
10
15
  */
11
- export function addBridges(backend, geojson) {
12
- const map = backend._map, crs = map.options.crs, zoom = sceneByLayer.get(backend)._terrainZoom;
13
- const origin = crs.project(sceneByLayer.get(backend).location), metres = Math.cos(sceneByLayer.get(backend).location.lat * radians);
14
- const base = sceneByLayer.get(backend).root.position[1];
16
+ export function addBridges(layer, geojson) {
17
+ const map = layer._map, crs = map.options.crs, zoom = terrainZoomByLayer.get(layer);
18
+ const origin = crs.project(locationByLayer.get(layer)), metres = Math.cos(locationByLayer.get(layer).lat * radians);
19
+ const base = rootByLayer.get(layer).position[1];
15
20
  const position = /* alloc */ [], normal = /* alloc */ [], color = /* alloc */ [];
16
- sceneByLayer.get(backend)._bridges = /* alloc */ new Map();
17
- const context = /* alloc */ { backend, map, crs, zoom, origin, metres, base, position, normal, color };
21
+ bridgesByLayer.set(layer, /* alloc */ new Map());
22
+ const context = /* alloc */ { backend: layer, map, crs, zoom, origin, metres, base, position, normal, color };
18
23
  let geometry, polygons, polygonIndex;
19
24
  for ({ geometry } of geojson.features) {
20
25
  if (geometry.type !== 'Polygon' && geometry.type !== 'MultiPolygon') continue;
@@ -24,6 +29,6 @@ export function addBridges(backend, geojson) {
24
29
  }
25
30
  }
26
31
  if (position.length) {
27
- sceneByLayer.get(backend)._bridgeMesh = createMesh(backend, /* alloc */ { position, normal, color });
32
+ bridgeMeshByLayer.set(layer, createMesh(layer, /* alloc */ { position, normal, color }));
28
33
  }
29
34
  }
@@ -1,6 +1,6 @@
1
1
  import { triangleContexts } from '../globals/triangleContexts.js';
2
2
 
3
- import { addTriangle } from './addTriangle.js';
3
+ import { addTriangle } from './appendAreaTriangle.js';
4
4
 
5
5
  export function addGeneratedTriangle(...args) {
6
6
  addTriangle(triangleContexts[triangleContexts.length - 1], ...args);
@@ -1,7 +1,7 @@
1
- import { groundOffset } from './groundOffset.js';
2
-
1
+ import { groundOffset } from '../sources/groundOffset.js';
2
+
3
3
  export function addTriangle(context, a, ah, b, bh, c, ch, nx, ny, nz, color) {
4
- const { backend, positions, normals, colors, uvs } = context;
4
+ const { backend: layer, positions, normals, colors, uvs } = context;
5
5
  const ux = b.x - a.x, uy = bh - ah, uz = a.y - b.y;
6
6
  const vx = c.x - a.x, vy = ch - ah, vz = a.y - c.y;
7
7
  if ((uy * vz - uz * vy) * nx + (uz * vx - ux * vz) * ny + (ux * vy - uy * vx) * nz < 0) {
@@ -13,5 +13,5 @@ export function addTriangle(context, a, ah, b, bh, c, ch, nx, ny, nz, color) {
13
13
  c.x, ch + groundOffset(c), -c.y);
14
14
  normals.push(nx, ny, nz, nx, ny, nz, nx, ny, nz);
15
15
  colors.push(color.r, color.g, color.b, color.r, color.g, color.b, color.r, color.g, color.b);
16
- if (backend.options.nightLight) uvs.push(...a.uv, ...b.uv, ...c.uv);
17
- }
16
+ if (layer.options.nightLight) uvs.push(...a.uv, ...b.uv, ...c.uv);
17
+ }
@@ -0,0 +1,41 @@
1
+ import { buildProjectedPolygon } from './buildProjectedPolygon.js';
2
+ import { buildProjectedPoint } from './buildProjectedPoint.js';
3
+ import { instanceAreaGeometry } from './instanceAreaGeometry.js';
4
+ import { computeBounds } from './computeBounds.js';
5
+
6
+ export function assembleAreaGeometry({ jobs, nightLight }) {
7
+ const context = /* alloc */ {
8
+ backend: /* alloc */ { options: /* alloc */ { nightLight } },
9
+ positions: /* alloc */ [], normals: /* alloc */ [], colors: /* alloc */ [], uvs: /* alloc */ [],
10
+ featureFaces: /* alloc */ [], lights: /* alloc */ [], supports: /* alloc */ new Set(),
11
+ };
12
+ let job, polygon, start, end;
13
+ for (job of jobs) {
14
+ start = context.positions.length / 3;
15
+ if (job.point) buildProjectedPoint(context, job.point, job.style, job.baseColor, job.support);
16
+ for (polygon of job.polygons) {
17
+ buildProjectedPolygon(context, polygon, job.style.top, job.style.bottom, job.baseColor);
18
+ }
19
+ end = context.positions.length / 3;
20
+ context.featureFaces.push(/* alloc */ { vertexStart: start, vertexEnd: end, faceStart: start / 3, faceEnd: end / 3 });
21
+ }
22
+ const data = instanceAreaGeometry(context);
23
+ const result = /* alloc */ {
24
+ positions: /* alloc */ new Float32Array(data.positions),
25
+ normals: /* alloc */ new Float32Array(data.normals),
26
+ colors: /* alloc */ new Float32Array(data.colors),
27
+ uvs: /* alloc */ new Float32Array(context.uvs),
28
+ instanceOffsets: data.instanceOffsets,
29
+ ranges: context.featureFaces,
30
+ lights: context.lights,
31
+ };
32
+ if (result.positions.length) {
33
+ const geometry = /* alloc */ { attributes: /* alloc */ {
34
+ position: /* alloc */ { data: result.positions },
35
+ instanceOffset: result.instanceOffsets ? /* alloc */ { data: result.instanceOffsets, size: 4 } : undefined,
36
+ } };
37
+ computeBounds(geometry);
38
+ result.bounds = geometry.bounds;
39
+ }
40
+ return result;
41
+ }
@@ -1,4 +1,4 @@
1
- import { localPosition } from './localPosition.js';
1
+ import { localPosition } from '../projections/localPosition.js';
2
2
 
3
3
  export function boundsQuad(state, bounds) {
4
4
  const positions = /* alloc */ [];
@@ -1,12 +1,12 @@
1
1
  import { triangulate } from '../triangulation/triangulate.js';
2
- import { local } from './bridgeLocal.js';
2
+ import { local } from '../projections/projectBridgePoint.js';
3
3
  import { bridgePaths } from './bridgePaths.js';
4
4
  import { indexBridge } from './indexBridge.js';
5
5
  import { bridgeFaces } from './bridgeFaces.js';
6
6
  import { bridgeSides } from './bridgeSides.js';
7
7
 
8
8
  export function bridgePolygon(context, polygon) {
9
- const { backend, map, zoom, crs, origin, metres, base } = context;
9
+ const { backend: layer, map, zoom, crs, origin, metres, base } = context;
10
10
  const rings = /* alloc */ [];
11
11
  let ring, path, lng, lat, z, p, coordinate, paths, contour, holes, triangles;
12
12
  for (ring of polygon) {
@@ -25,7 +25,7 @@ export function bridgePolygon(context, polygon) {
25
25
  [contour, ...holes] = paths;
26
26
  triangles = triangulate(contour, holes);
27
27
  } catch { return; }
28
- indexBridge(backend, pixels, triangles);
28
+ indexBridge(layer, pixels, triangles);
29
29
  bridgeFaces(context, points, triangles);
30
30
  bridgeSides(context, points, rings);
31
31
  }