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.
- package/README.md +23 -11
- package/cucumber.mjs +9 -9
- package/dist/leaflet-city-mapper-src.js +3353 -2377
- package/dist/leaflet-city-mapper-src.js.map +4 -4
- package/dist/leaflet-city-mapper-worker-src.js +955 -0
- package/dist/leaflet-city-mapper-worker-src.js.map +7 -0
- package/dist/leaflet-city-mapper-worker.js +2 -0
- package/dist/leaflet-city-mapper-worker.js.map +7 -0
- package/dist/leaflet-city-mapper.js +3 -3
- package/dist/leaflet-city-mapper.js.map +4 -4
- package/libs/leaflet.js +1 -1
- package/package.json +3 -2
- package/src/{camera → animations}/cancelCameraAnimation.js +5 -3
- package/src/{core → animations}/cancelGridFade.js +3 -2
- package/src/animations/endZoom.js +27 -0
- package/src/{camera → animations}/mapAnimateCamera.js +7 -5
- package/src/{scene → animations}/onZoomAnim.js +5 -4
- package/src/{scene → animations}/renderPendingZoomAnimation.js +4 -2
- package/src/{camera → animations}/runCameraAnimations.js +8 -6
- package/src/{core → animations}/runGridFades.js +4 -3
- package/src/{camera → animations}/scheduleCameraAnimation.js +3 -2
- package/src/animations/scheduleGridFade.js +16 -0
- package/src/{scene → animations}/startZoom.js +3 -2
- package/src/{rendering → animations}/synchronizeZoomView.js +10 -8
- package/src/{rendering → animations}/updateZoomCamera.js +11 -8
- package/src/archives/decodeDirectory.js +1 -1
- package/src/archives/findTile.js +3 -3
- package/src/archives/getDirectoryEntries.js +5 -4
- package/src/archives/getHeader.js +10 -6
- package/src/archives/getTileData.js +3 -3
- package/src/archives/getZxy.js +8 -7
- package/src/archives/loadDirectory.js +3 -3
- package/src/archives/loadSource.js +3 -2
- package/src/archives/{read.js → readArchiveRange.js} +7 -5
- package/src/camera/cameraMapReady.js +3 -2
- package/src/camera/cleanupCameraMap.js +8 -6
- package/src/camera/fitCameraBounds.js +3 -3
- package/src/camera/initializeCameraMap.js +6 -4
- package/src/camera/mapCamera.js +1 -1
- package/src/camera/mapContainerPointToLayerPoint.js +2 -2
- package/src/camera/mapGetBearing.js +3 -2
- package/src/camera/mapGetBounds.js +2 -2
- package/src/camera/mapGetBoundsZoom.js +2 -2
- package/src/camera/mapGetPitch.js +3 -2
- package/src/camera/mapLayerPointToContainerPoint.js +2 -2
- package/src/camera/mapLimitCenter.js +1 -1
- package/src/camera/mapLimitOffset.js +1 -1
- package/src/camera/mapPanBy.js +2 -2
- package/src/camera/mapPanInside.js +1 -1
- package/src/camera/mapResetNorthPitch.js +1 -1
- package/src/camera/mapSetBearing.js +1 -1
- package/src/camera/mapSetPitch.js +1 -1
- package/src/camera/mapSetPitchAndBearing.js +5 -3
- package/src/{rendering → camera}/updateMapCamera.js +19 -15
- package/src/{scene/updateCamera.js → camera/updateSceneCamera.js} +1 -1
- package/src/camera/updateSky.js +10 -9
- package/src/collision/collider.js +23 -9
- package/src/collision/insideMesh.js +53 -0
- package/src/collision/insideWalker.js +46 -0
- package/src/collision/trafficCollision.js +60 -0
- package/src/{utils → colors}/parseColor.js +1 -1
- package/src/controls/addCameraHandler.js +5 -3
- package/src/controls/adjustCameraDrag.js +4 -3
- package/src/controls/cameraControls.js +8 -5
- package/src/controls/cameraDragClick.js +7 -7
- package/src/controls/cameraDragContextMenu.js +1 -1
- package/src/controls/cameraDragDown.js +2 -2
- package/src/controls/cameraDragEnd.js +1 -1
- package/src/controls/cameraDragMove.js +2 -2
- package/src/controls/changeCameraTouch.js +6 -3
- package/src/controls/cleanupCameraTouch.js +7 -5
- package/src/controls/dragCamera.js +1 -1
- package/src/controls/endCameraTouchEvent.js +1 -1
- package/src/controls/moveCameraTouch.js +5 -3
- package/src/controls/removeCameraDrag.js +1 -1
- package/src/controls/shiftRotateWheel.js +1 -1
- package/src/controls/startCameraTouch.js +6 -4
- package/src/core/adjustCameraMarkerPan.js +3 -3
- package/src/core/cameraCircleBounds.js +1 -1
- package/src/core/cameraMarkerDrag.js +1 -1
- package/src/core/cameraMarkerOnDrag.js +1 -1
- package/src/core/closestCameraLayerPoint.js +1 -1
- package/src/core/initializeGridContainer.js +1 -1
- package/src/core/initializeNativeLayer.js +9 -8
- package/src/core/layerCallInitHooks.js +4 -3
- package/src/core/markerSetIcon.js +1 -1
- package/src/core/markerSetPos.js +2 -2
- package/src/core/markerSetRotation.js +1 -1
- package/src/core/markerUpdateZIndex.js +5 -4
- package/src/core/popupAdjustPan.js +1 -1
- package/src/core/popupUpdatePosition.js +1 -1
- package/src/core/redrawPath.js +1 -1
- package/src/core/removeLayer.js +4 -3
- package/src/core/tooltipSetPosition.js +1 -1
- package/src/core/updateGridOpacity.js +3 -3
- package/src/core/whenReady.js +11 -0
- package/src/geometry/addBridges.js +13 -8
- package/src/{sources → geometry}/addGeneratedTriangle.js +1 -1
- package/src/{sources/addTriangle.js → geometry/appendAreaTriangle.js} +5 -5
- package/src/geometry/assembleAreaGeometry.js +41 -0
- package/src/{core → geometry}/boundsQuad.js +1 -1
- package/src/geometry/bridgePolygon.js +3 -3
- package/src/geometry/buildExtrudedPolygon.js +10 -0
- package/src/geometry/buildProjectedPoint.js +21 -0
- package/src/{sources/buildAreaPolygon.js → geometry/buildProjectedPolygon.js} +25 -29
- package/src/geometry/circleGeometry.js +1 -1
- package/src/geometry/computeBounds.js +19 -8
- package/src/geometry/conformModelToTerrain.js +17 -11
- package/src/{models → geometry}/createModelGeometry.js +5 -4
- package/src/geometry/disk.js +1 -1
- package/src/geometry/indexBridge.js +5 -4
- package/src/geometry/lampPostGeometry.js +2 -2
- package/src/geometry/lightGeometry.js +1 -1
- package/src/geometry/lineJoin.js +1 -1
- package/src/{core → geometry}/markerQuadCorners.js +9 -6
- package/src/geometry/nativeGeometry.js +1 -1
- package/src/geometry/polygon.js +1 -1
- package/src/geometry/roofCoverage.js +11 -8
- package/src/geometry/roofFootprint.js +13 -10
- package/src/geometry/segment.js +1 -1
- package/src/{shadows → geometry}/shadowBounds.js +1 -1
- package/src/geometry/surface.js +1 -1
- package/src/{terrain → geometry}/terrainBuffers.js +7 -5
- package/src/geometry/terrainTileGeometry.js +19 -0
- package/src/geometry/treeGeometry.js +2 -2
- package/src/globals/geometryWorkerUrl.js +3 -0
- package/src/globals/nativeMethodHandlers.js +14 -14
- package/src/{scene → gpu}/initializeRendererResources.js +10 -9
- package/src/gpu/initializeSharedRenderer.js +52 -0
- package/src/gpu/mountRenderer.js +26 -0
- package/src/{scene → gpu}/releaseRenderer.js +2 -2
- package/src/gpu/rendererDeviceError.js +16 -0
- package/src/gpu/rendererDeviceLost.js +16 -0
- package/src/{rendering/reportCompilation.js → gpu/reportShaderCompilation.js} +3 -3
- package/src/gpu/requestAdapter.js +12 -0
- package/src/gpu/requestDevice.js +9 -0
- package/src/index.js +8 -13
- package/src/layer-controls/layerCountTitle.js +6 -0
- package/src/layer-controls/renderLayerCount.js +20 -0
- package/src/{scene → layer-controls}/updateLayerCount.js +24 -22
- package/src/lighting/lightGrid.js +1 -1
- package/src/lighting/updatePointLights.js +13 -10
- package/src/{rendering → materials}/createProgram.js +13 -12
- package/src/{models/materialFor.js → materials/modelMaterialFor.js} +3 -3
- package/src/materials/terrainRasterProgram.js +58 -0
- package/src/models/applyModelTransform.js +8 -7
- package/src/models/createModelContext.js +3 -3
- package/src/models/loadModel.js +17 -12
- package/src/models/loadModelResources.js +7 -6
- package/src/models/modelNode.js +4 -5
- package/src/{core → native}/disposeNativeLayer.js +10 -10
- package/src/{core → native}/handleNativeMapEvent.js +5 -4
- package/src/{core → native}/initNativeGPU.js +9 -6
- package/src/native/isCurrentNativeLayer.js +7 -0
- package/src/{core → native}/nativeEventSource.js +3 -3
- package/src/{core → native}/nativeEvents.js +1 -1
- package/src/{core → native}/nativeLayer.js +16 -37
- package/src/{core → native}/nativeLayerMethod.js +14 -5
- package/src/{core → native}/pruneNativeResources.js +5 -5
- package/src/{core → native}/putNativeMesh.js +3 -3
- package/src/{core → native}/quadNativeMesh.js +1 -1
- package/src/native/readyNativeGPU.js +10 -0
- package/src/{core → native}/refreshNativeLayer.js +8 -7
- package/src/{core → native}/refreshNativeLayerContract.js +3 -2
- package/src/{core → native}/removeNativeEvents.js +1 -1
- package/src/{core → native}/removeTargets.js +3 -2
- package/src/native/reorderNativeLayer.js +17 -0
- package/src/{core → native}/styleNativeMesh.js +3 -2
- package/src/{core → native}/syncGridLayer.js +1 -1
- package/src/{core → native}/syncImageOverlay.js +1 -1
- package/src/{core → native}/syncMarker.js +1 -1
- package/src/{core → native}/syncVectorLayer.js +2 -2
- package/src/{core → native}/synchronizeNativeLayer.js +4 -3
- package/src/native/updateNativeLayerView.js +10 -0
- package/src/picking/findFeature.js +13 -9
- package/src/picking/hit.js +16 -8
- package/src/picking/onClick.js +3 -2
- package/src/picking/onPointerLeave.js +3 -2
- package/src/picking/onPointerMove.js +12 -6
- package/src/picking/raycast.js +29 -24
- package/src/picking/setHighlight.js +9 -8
- package/src/picking/shouldSkipOther.js +3 -2
- package/src/picking/showFeature.js +19 -14
- package/src/{camera/angles.js → projections/cameraAngles.js} +2 -2
- package/src/{camera → projections}/groundBounds.js +2 -2
- package/src/projections/localPosition.js +11 -0
- package/src/{camera/project.js → projections/projectCameraPoint.js} +2 -2
- package/src/{sources → projections}/projectRing.js +8 -9
- package/src/projections/projectTreePoint.js +17 -0
- package/src/{camera/animationPoint.js → projections/transformZoomAnimationPoint.js} +3 -2
- package/src/projections/walkerLocalPosition.js +18 -0
- package/src/raster/addRasterTile.js +38 -28
- package/src/raster/createRasterMesh.js +24 -19
- package/src/raster/finishRasterAttachment.js +17 -0
- package/src/raster/finishRasterTile.js +22 -19
- package/src/raster/initRaster.js +24 -15
- package/src/raster/isRasterLoading.js +8 -0
- package/src/raster/loadRasterTile.js +8 -7
- package/src/raster/onPMTileAdd.js +9 -8
- package/src/raster/onPMTileRemove.js +6 -5
- package/src/raster/pruneRasterTiles.js +19 -13
- package/src/raster/pumpRasterTiles.js +8 -6
- package/src/raster/readyRaster.js +3 -2
- package/src/raster/registerTerrainTile.js +8 -6
- package/src/raster/releaseRasterTile.js +14 -11
- package/src/raster/releaseRasterTiles.js +13 -10
- package/src/raster/removeRasterTile.js +8 -6
- package/src/raster/retainRasterTiles.js +5 -4
- package/src/raster/setPMTileOpacity.js +4 -4
- package/src/raster/setPMTileZIndex.js +4 -4
- package/src/raster/setRasterOpacity.js +8 -6
- package/src/raster/setRasterTerrain.js +12 -9
- package/src/raster/setRasterZIndex.js +8 -6
- package/src/raster/updateAttachedTiles.js +6 -5
- package/src/raster/updateRasterTiles.js +20 -15
- package/src/rendering/collectFrameMeshes.js +16 -9
- package/src/rendering/collectVisibleMesh.js +18 -9
- package/src/rendering/createMesh.js +11 -9
- package/src/rendering/disposeMesh.js +3 -3
- package/src/rendering/drawGeometry.js +9 -7
- package/src/rendering/drawSceneMeshes.js +9 -7
- package/src/rendering/prepareFrameBuffer.js +6 -5
- package/src/rendering/prepareFrameMeshes.js +9 -6
- package/src/rendering/prepareFrameUniforms.js +9 -6
- package/src/rendering/prepareMeshUniforms.js +1 -1
- package/src/rendering/render.js +39 -32
- package/src/rendering/resizeRenderer.js +17 -15
- package/src/rendering/revealRoofMesh.js +25 -6
- package/src/scene/{layerLayerAdd.js → addRegisteredLayer.js} +13 -9
- package/src/scene/addSceneLayer.js +4 -3
- package/src/scene/attachLayer.js +7 -6
- package/src/scene/attachSharedScene.js +69 -0
- package/src/scene/callLayer.js +7 -5
- package/src/scene/cancelUpdate.js +6 -5
- package/src/scene/failAttachment.js +6 -5
- package/src/scene/get3DEvents.js +5 -3
- package/src/scene/getLocation.js +3 -2
- package/src/scene/init3D.js +28 -26
- package/src/scene/initializeLayer.js +6 -4
- package/src/scene/isNativeLayer.js +3 -2
- package/src/scene/layerInitialize.js +11 -6
- package/src/scene/onAdd3DLayer.js +30 -24
- package/src/scene/onMapChange.js +5 -4
- package/src/scene/onRemove3DLayer.js +53 -35
- package/src/scene/ready3D.js +22 -13
- package/src/scene/releaseSharedScene.js +31 -25
- package/src/scene/removeLayerEvents.js +12 -9
- package/src/scene/removeSceneLayer.js +3 -2
- package/src/scene/renderPendingMapChange.js +7 -4
- package/src/scene/renderPendingUpdates.js +9 -6
- package/src/scene/restoreObject.js +15 -13
- package/src/scene/scheduleSceneUpdate.js +25 -0
- package/src/shaders/materialShaders.js +2 -2
- package/src/shadows/bindSunlight.js +4 -3
- package/src/shadows/drawShadowMeshes.js +4 -3
- package/src/shadows/renderSunlight.js +6 -5
- package/src/shadows/resizeSunlight.js +7 -6
- package/src/shadows/shadowMatrix.js +2 -2
- package/src/sources/attachAreaMesh.js +25 -20
- package/src/sources/buildArea.js +19 -11
- package/src/sources/buildAreaFeature.js +14 -5
- package/src/sources/buildAreaPoint.js +3 -21
- package/src/sources/extrusionStyle.js +2 -2
- package/src/sources/initializeGeoJSON.js +3 -2
- package/src/sources/pendingSourceAreas.js +3 -2
- package/src/sources/prepareAreaGeometryJob.js +33 -0
- package/src/sources/pumpSourceAreas.js +37 -0
- package/src/sources/releaseArea.js +10 -8
- package/src/sources/setGeoJSONData.js +4 -3
- package/src/sources/sourceAreaContext.js +18 -17
- package/src/sources/updateArea.js +25 -21
- package/src/sources/{updateStatus.js → updateSourceStatus.js} +5 -4
- package/src/sunlight/{addTo.js → addTimeControlToMap.js} +1 -1
- package/src/sunlight/addTimeLayer.js +3 -2
- package/src/sunlight/atmosphere.js +2 -2
- package/src/sunlight/initSunlight.js +5 -5
- package/src/sunlight/{initialize.js → initializeTimeControl.js} +5 -3
- package/src/sunlight/onAddSun.js +5 -4
- package/src/sunlight/onRemoveSun.js +1 -1
- package/src/sunlight/removeSun.js +7 -5
- package/src/sunlight/removeTimeLayer.js +3 -2
- package/src/sunlight/requestSunlightRender.js +9 -0
- package/src/sunlight/updateCelestialDisc.js +1 -1
- package/src/sunlight/updateSky.js +4 -2
- package/src/sunlight/updateSun.js +8 -6
- package/src/sunlight/useSelectedTime.js +4 -3
- package/src/terrain/applyTerrain.js +16 -13
- package/src/terrain/clearLayerTerrain.js +3 -2
- package/src/terrain/getElevation.js +9 -5
- package/src/terrain/initTerrain.js +11 -6
- package/src/terrain/loadTerrain.js +29 -20
- package/src/terrain/loadTerrainTiles.js +4 -3
- package/src/terrain/mapElevationOf.js +7 -0
- package/src/terrain/onTerrainAdd.js +14 -10
- package/src/terrain/onTerrainChange.js +4 -3
- package/src/terrain/onTerrainRemove.js +35 -21
- package/src/terrain/readyTerrainOf.js +7 -0
- package/src/terrain/setLayerTerrain.js +3 -2
- package/src/terrain/setTerrainHeight.js +19 -14
- package/src/terrain/terrainElevation.js +1 -1
- package/src/terrain/terrainTileQueue.js +11 -9
- package/src/{core → textures}/addImageState.js +1 -1
- package/src/{core/addRasterImage.js → textures/attachRasterImage.js} +1 -1
- package/src/{rendering → textures}/collectRoofTiles.js +3 -2
- package/src/{rendering → textures}/composeRoofAtlas.js +9 -7
- package/src/textures/destroyTexture.js +10 -0
- package/src/{models/textureFor.js → textures/modelTextureFor.js} +5 -4
- package/src/{core → textures}/nativeImageError.js +1 -1
- package/src/{core → textures}/nativeImageRefresh.js +2 -2
- package/src/{core/textureFor.js → textures/nativeTextureFor.js} +7 -6
- package/src/{rendering → textures}/rebuildRoofAtlas.js +12 -9
- package/src/{core → textures}/removeImageState.js +1 -1
- package/src/{rendering → textures}/resizeRoofTexture.js +5 -4
- package/src/textures/updateRoofAtlas.js +23 -0
- package/src/textures/updateRoofRaster.js +29 -0
- package/src/{core → textures}/uploadCanvasTexture.js +2 -2
- package/src/traffic/addTraffic.js +1 -1
- package/src/traffic/disposeTrafficObject.js +5 -3
- package/src/traffic/drawTrafficRoute.js +1 -1
- package/src/traffic/groundTraffic.js +6 -6
- package/src/traffic/initTraffic.js +3 -3
- package/src/traffic/loadedTrafficLanes.js +1 -1
- package/src/traffic/locateTraffic.js +3 -3
- package/src/traffic/placeTraffic.js +2 -1
- package/src/traffic/prepareTraffic.js +4 -3
- package/src/traffic/rebaseTraffic.js +3 -2
- package/src/traffic/rebuildTrafficMesh.js +1 -1
- package/src/traffic/removeTraffic.js +1 -1
- package/src/traffic/startTraffic.js +1 -1
- package/src/traffic/tickTraffic.js +4 -3
- package/src/traffic/trafficNow.js +3 -2
- package/src/traffic/updateTraffic.js +3 -2
- package/src/traffic/updateTrafficLights.js +4 -2
- package/src/vehicles/boatBenches.js +1 -1
- package/src/vehicles/boatModel.js +1 -1
- package/src/vehicles/busModel.js +1 -1
- package/src/vehicles/carModel.js +1 -1
- package/src/vehicles/metroModel.js +1 -1
- package/src/vehicles/tramModel.js +1 -1
- package/src/walk/{step.js → animateWalker.js} +15 -8
- package/src/walk/createWalk.js +15 -11
- package/src/walk/initWalk.js +4 -4
- package/src/walk/landWalker.js +38 -0
- package/src/walk/moveWalker.js +5 -4
- package/src/walk/{onAdd.js → onAddWalkControl.js} +3 -1
- package/src/walk/{onRemove.js → onRemoveWalkControl.js} +1 -1
- package/src/walk/{onKey.js → onWalkKey.js} +1 -1
- package/src/walk/{onTerrain.js → onWalkTerrain.js} +1 -1
- package/src/walk/{place.js → placeWalker.js} +2 -2
- package/src/walk/resolveWalkerPosition.js +28 -0
- package/src/walk/{start.js → startWalking.js} +8 -5
- package/src/walk/{stop.js → stopWalking.js} +4 -4
- package/src/walk/{toggle.js → toggleWalking.js} +2 -2
- package/src/weakmaps/addedByLayer.js +1 -0
- package/src/weakmaps/archiveHeaderByLayer.js +1 -0
- package/src/weakmaps/areasByLayer.js +1 -0
- package/src/weakmaps/bridgeMeshByLayer.js +1 -0
- package/src/weakmaps/bridgesByLayer.js +1 -0
- package/src/weakmaps/cameraAnimationByMap.js +1 -0
- package/src/weakmaps/cameraBearingByMap.js +1 -0
- package/src/weakmaps/cameraByLayer.js +1 -0
- package/src/weakmaps/cameraDraggableByMap.js +1 -0
- package/src/weakmaps/cameraFields.js +37 -0
- package/src/weakmaps/cameraFrameByMap.js +1 -0
- package/src/weakmaps/cameraHandlersByMap.js +1 -0
- package/src/weakmaps/cameraMaps.js +1 -0
- package/src/weakmaps/cameraPitchByMap.js +1 -0
- package/src/weakmaps/cameraReadyByMap.js +1 -0
- package/src/weakmaps/cameraTouchStateByMap.js +1 -0
- package/src/weakmaps/cameraViewByMap.js +1 -0
- package/src/weakmaps/cameraZIndexOffsetByLayer.js +1 -0
- package/src/weakmaps/containerByLayer.js +1 -0
- package/src/weakmaps/controlByLayer.js +1 -0
- package/src/weakmaps/countStatusByLayer.js +1 -0
- package/src/weakmaps/cursorByLayer.js +1 -0
- package/src/weakmaps/demByLayer.js +1 -0
- package/src/weakmaps/directoriesByLayer.js +1 -0
- package/src/weakmaps/etagByLayer.js +1 -0
- package/src/weakmaps/eventMapByLayer.js +1 -0
- package/src/weakmaps/eventsByLayer.js +1 -0
- package/src/weakmaps/fadeFrameByLayer.js +1 -0
- package/src/weakmaps/fadeVersionByLayer.js +1 -0
- package/src/weakmaps/frameByLayer.js +1 -0
- package/src/weakmaps/geojsonByLayer.js +1 -0
- package/src/weakmaps/geometryWorkersByMap.js +1 -0
- package/src/weakmaps/groupByLayer.js +1 -0
- package/src/weakmaps/headerByLayer.js +1 -0
- package/src/weakmaps/highlightedFeatureByLayer.js +1 -0
- package/src/weakmaps/hoveredFeatureByLayer.js +1 -0
- package/src/weakmaps/inflightByLayer.js +1 -0
- package/src/weakmaps/kindByLayer.js +1 -0
- package/src/weakmaps/layersByLayer.js +1 -0
- package/src/weakmaps/loadingTilesByLayer.js +1 -0
- package/src/weakmaps/locationByLayer.js +1 -0
- package/src/weakmaps/modelByLayer.js +1 -0
- package/src/weakmaps/modelUrlByLayer.js +1 -0
- package/src/weakmaps/nativeGPUBackByMap.js +1 -0
- package/src/weakmaps/nativeGPUByLayer.js +1 -0
- package/src/weakmaps/nativeGPUOrderByMap.js +1 -0
- package/src/weakmaps/pitchSkyByMap.js +1 -0
- package/src/weakmaps/pointerEventsByLayer.js +1 -0
- package/src/weakmaps/pruneAfterByLayer.js +1 -0
- package/src/weakmaps/pruneVersionByLayer.js +1 -0
- package/src/weakmaps/pruneWantedByLayer.js +1 -0
- package/src/weakmaps/queuedByLayer.js +1 -0
- package/src/weakmaps/rasterGeometryByLayer.js +1 -0
- package/src/weakmaps/rasterProgramByLayer.js +1 -0
- package/src/weakmaps/rasterTilesByLayer.js +1 -0
- package/src/weakmaps/rasterVersionByLayer.js +1 -0
- package/src/weakmaps/raycasterByLayer.js +1 -0
- package/src/weakmaps/readyByLayer.js +1 -0
- package/src/weakmaps/rendererByLayer.js +1 -0
- package/src/weakmaps/rendererReadyByLayer.js +1 -0
- package/src/weakmaps/roofRasterByLayer.js +1 -0
- package/src/weakmaps/roofRastersByLayer.js +1 -0
- package/src/weakmaps/rootByLayer.js +1 -0
- package/src/weakmaps/rotateControlByMap.js +1 -0
- package/src/weakmaps/sceneFields.js +159 -0
- package/src/weakmaps/sceneLayers.js +1 -0
- package/src/weakmaps/sceneOriginByLayer.js +1 -0
- package/src/weakmaps/shadowMeshesByLayer.js +1 -0
- package/src/weakmaps/sharedByLayer.js +1 -0
- package/src/weakmaps/sizeByLayer.js +1 -0
- package/src/weakmaps/state3dByLayer.js +1 -0
- package/src/weakmaps/sunlightByMap.js +1 -0
- package/src/weakmaps/terrain3DByLayer.js +1 -0
- package/src/weakmaps/terrain3DByMap.js +1 -0
- package/src/weakmaps/terrainArchiveByLayer.js +1 -0
- package/src/weakmaps/terrainBaseYByLayer.js +1 -0
- package/src/weakmaps/terrainBoundsByLayer.js +1 -0
- package/src/weakmaps/terrainControllerByLayer.js +1 -0
- package/src/weakmaps/terrainGridsByLayer.js +1 -0
- package/src/weakmaps/terrainLoadingByLayer.js +1 -0
- package/src/weakmaps/terrainOriginElevationByLayer.js +1 -0
- package/src/weakmaps/terrainPromiseByLayer.js +1 -0
- package/src/weakmaps/terrainReadyByLayer.js +1 -0
- package/src/weakmaps/terrainRequestByLayer.js +1 -0
- package/src/weakmaps/terrainSourceByLayer.js +1 -0
- package/src/weakmaps/terrainTilesByLayer.js +1 -0
- package/src/weakmaps/terrainZoomByLayer.js +1 -0
- package/src/weakmaps/tileZoomByLayer.js +1 -0
- package/src/weakmaps/timeControlByMap.js +1 -0
- package/src/weakmaps/tooltipByLayer.js +1 -0
- package/src/weakmaps/touchPitchByMap.js +1 -0
- package/src/weakmaps/touchRotateByMap.js +1 -0
- package/src/weakmaps/typeByLayer.js +1 -0
- package/src/weakmaps/urlByLayer.js +1 -0
- package/src/weakmaps/visibleMeshesByLayer.js +1 -0
- package/src/weakmaps/walkerByLayer.js +1 -0
- package/src/weakmaps/wantedRasterTilesByLayer.js +1 -0
- package/src/weakmaps/zoomLevelByLayer.js +1 -0
- package/src/weakmaps/zoomTransitionsByLayer.js +1 -0
- package/src/weakmaps/zoomViewByLayer.js +1 -0
- package/src/workers/acquireGeometryWorker.js +32 -0
- package/src/workers/buildAreaInWorker.js +36 -0
- package/src/workers/closeGeometryWorkers.js +11 -0
- package/src/workers/geometryWorker.js +14 -0
- package/src/workers/settleGeometryWorker.js +10 -0
- package/src/workers/startGeometryWorker.js +16 -0
- package/src/core/bringNativeLayerToBack.js +0 -8
- package/src/core/bringNativeLayerToFront.js +0 -8
- package/src/core/current.js +0 -6
- package/src/core/localPosition.js +0 -10
- package/src/core/readyNativeGPU.js +0 -9
- package/src/core/reorderNativeLayer.js +0 -9
- package/src/core/scheduleGridFade.js +0 -14
- package/src/core/updateNativeLayerView.js +0 -9
- package/src/geometry/dot.js +0 -6
- package/src/geometry/push.js +0 -3
- package/src/globals/cameraByMap.js +0 -1
- package/src/raster/finishAttachment.js +0 -15
- package/src/raster/isLoading.js +0 -7
- package/src/raster/terrainTileGeometry.js +0 -16
- package/src/rendering/destroyTexture.js +0 -9
- package/src/rendering/sortMeshes.js +0 -6
- package/src/rendering/updateRoofAtlas.js +0 -20
- package/src/rendering/updateRoofRaster.js +0 -25
- package/src/scene/attach.js +0 -54
- package/src/scene/endZoom.js +0 -23
- package/src/scene/initializeSharedRenderer.js +0 -45
- package/src/scene/layerCountTitle.js +0 -4
- package/src/scene/mountRenderer.js +0 -25
- package/src/scene/ready.js +0 -9
- package/src/scene/renderLayerCount.js +0 -13
- package/src/scene/rendererDeviceError.js +0 -14
- package/src/scene/rendererDeviceLost.js +0 -14
- package/src/scene/requestAdapter.js +0 -12
- package/src/scene/requestDevice.js +0 -9
- package/src/scene/update.js +0 -23
- package/src/sources/projectedTree.js +0 -19
- package/src/sources/pump.js +0 -44
- package/src/sunlight/render.js +0 -9
- package/src/terrain/rasterProgram.js +0 -51
- package/src/walk/land.js +0 -32
- package/src/walk/local.js +0 -18
- /package/src/{camera → animations}/mapStopPitchBearingAnimation.js +0 -0
- /package/src/{core → animations}/runMarkerPanFrame.js +0 -0
- /package/src/{core → animations}/scheduleMarkerPan.js +0 -0
- /package/src/archives/{varint.js → readVarint.js} +0 -0
- /package/src/{sunlight → astronomy}/horizontalPosition.js +0 -0
- /package/src/{sunlight → astronomy}/moonPosition.js +0 -0
- /package/src/{sunlight → astronomy}/solarPosition.js +0 -0
- /package/src/{sunlight → astronomy}/solarTime.js +0 -0
- /package/src/{scene → camera}/createSceneCamera.js +0 -0
- /package/src/{sunlight/rgb.js → colors/formatRGB.js} +0 -0
- /package/src/{utils/channel.js → colors/hslChannel.js} +0 -0
- /package/src/{sunlight/mix.js → colors/mixColor.js} +0 -0
- /package/src/{utils → colors}/toSRGB.js +0 -0
- /package/src/controls/{editable.js → isEditableTarget.js} +0 -0
- /package/src/geometry/{nativeTriangle.js → appendNativeTriangle.js} +0 -0
- /package/src/{traffic → geometry}/appendRouteDash.js +0 -0
- /package/src/{traffic → geometry}/appendRouteSegment.js +0 -0
- /package/src/geometry/{build.js → buildGeometryParts.js} +0 -0
- /package/src/geometry/{lampRing.js → createLampRing.js} +0 -0
- /package/src/{raster/createGeometry.js → geometry/createRasterQuadGeometry.js} +0 -0
- /package/src/geometry/{treeRing.js → createTreeRing.js} +0 -0
- /package/src/geometry/{cross.js → crossVector.js} +0 -0
- /package/src/{sources → geometry}/generateTreeGeometry.js +0 -0
- /package/src/{sources → geometry}/instanceAreaGeometry.js +0 -0
- /package/src/{traffic/along.js → geometry/interpolateRoute.js} +0 -0
- /package/src/{core → geometry}/markerImageBounds.js +0 -0
- /package/src/{shadows → geometry}/meshShadowBounds.js +0 -0
- /package/src/geometry/{below.js → offsetBelowGround.js} +0 -0
- /package/src/{scene → geometry}/restoreGeometry.js +0 -0
- /package/src/{traffic → geometry}/routeGeometry.js +0 -0
- /package/src/geometry/{sub.js → subtractVector.js} +0 -0
- /package/src/{terrain → geometry}/terrainGrid.js +0 -0
- /package/src/geometry/{visit.js → visitNativeCoordinates.js} +0 -0
- /package/src/{scene → gpu}/showWebGPUWarning.js +0 -0
- /package/src/{scene → layer-controls}/placeEntry.js +0 -0
- /package/src/{scene → layer-controls}/placeEntryElement.js +0 -0
- /package/src/{scene → layer-controls}/placeUnderEntry.js +0 -0
- /package/src/{scene → layer-controls}/removeEntry.js +0 -0
- /package/src/{scene → layer-controls}/replaceEntry.js +0 -0
- /package/src/{scene → layer-controls}/runPlacements.js +0 -0
- /package/src/{scene → layer-controls}/underEntry.js +0 -0
- /package/src/lighting/{visitCells.js → visitLightGridCells.js} +0 -0
- /package/src/{rendering → materials}/createProgramLayout.js +0 -0
- /package/src/{rendering → materials}/createProgramUniforms.js +0 -0
- /package/src/{rendering → materials}/prepareMeshCutout.js +0 -0
- /package/src/{shaders → materials}/validateRoofMaterial.js +0 -0
- /package/src/{core → native}/beforeNativeRender.js +0 -0
- /package/src/{core → native}/bypassNativeEvent.js +0 -0
- /package/src/{core → native}/compareNativeHits.js +0 -0
- /package/src/{core → native}/forwardNativeError.js +0 -0
- /package/src/{core → native}/hideTargets.js +0 -0
- /package/src/{core → native}/nativeAddLatLng.js +0 -0
- /package/src/{core → native}/nativeBringToBack.js +0 -0
- /package/src/{core → native}/nativeBringToFront.js +0 -0
- /package/src/{core → native}/nativeRedraw.js +0 -0
- /package/src/{core → native}/nativeSetBounds.js +0 -0
- /package/src/{core → native}/nativeSetIcon.js +0 -0
- /package/src/{core → native}/nativeSetLatLng.js +0 -0
- /package/src/{core → native}/nativeSetLatLngs.js +0 -0
- /package/src/{core → native}/nativeSetOpacity.js +0 -0
- /package/src/{core → native}/nativeSetRadius.js +0 -0
- /package/src/{core → native}/nativeSetStyle.js +0 -0
- /package/src/{core → native}/nativeSetUrl.js +0 -0
- /package/src/{core → native}/nativeSetZIndex.js +0 -0
- /package/src/{core → native}/nativeSetZIndexOffset.js +0 -0
- /package/src/{core → native}/refreshNativeEvent.js +0 -0
- /package/src/{core → native}/rejectNativeReady.js +0 -0
- /package/src/{core → native}/resolveNativeReady.js +0 -0
- /package/src/{core → native}/restoreNativeEvents.js +0 -0
- /package/src/{core → native}/updateNativeHover.js +0 -0
- /package/src/{camera/displayPoint.js → projections/displayContainerPoint.js} +0 -0
- /package/src/{core → projections}/localPixel.js +0 -0
- /package/src/{core → projections}/localPixelForGeometry.js +0 -0
- /package/src/{core → projections}/markerCameraIconPoint.js +0 -0
- /package/src/{geometry/bridgeLocal.js → projections/projectBridgePoint.js} +0 -0
- /package/src/{sunlight → projections}/projectCelestialBody.js +0 -0
- /package/src/{camera/pointOf.js → projections/toPoint.js} +0 -0
- /package/src/{camera → projections}/verticalGroundY.js +0 -0
- /package/src/raster/{reportError.js → reportRasterError.js} +0 -0
- /package/src/scene/{emptyNode.js → createSceneNode.js} +0 -0
- /package/src/scene/{reportError.js → reportLayerError.js} +0 -0
- /package/src/sunlight/{onAdd.js → onAddTimeControl.js} +0 -0
- /package/src/sunlight/{remove.js → removeTimeControl.js} +0 -0
- /package/src/terrain/{sample.js → sampleTerrainTile.js} +0 -0
- /package/src/{rendering → textures}/bindMeshTextures.js +0 -0
- /package/src/{rendering → textures}/compareRoofTiles.js +0 -0
- /package/src/{rendering/destroyAfterSubmission.js → textures/destroyTextureAfterSubmission.js} +0 -0
- /package/src/{rendering → textures}/ensureRoofBlit.js +0 -0
- /package/src/{models/loadImage.js → textures/loadModelImage.js} +0 -0
- /package/src/{models/textureSampler.js → textures/modelTextureSampler.js} +0 -0
- /package/src/{rendering → textures}/prepareMeshTextures.js +0 -0
- /package/src/{scene → textures}/restoreMaterialTextures.js +0 -0
- /package/src/{rendering → textures}/textureBinding.js +0 -0
- /package/src/{rendering → textures}/uploadMeshTexture.js +0 -0
- /package/src/{core → textures}/uploadNativeImage.js +0 -0
- /package/src/{rendering → textures}/uploadRoofTile.js +0 -0
- /package/src/traffic/{toLanes.js → featuresToTrafficLanes.js} +0 -0
- /package/src/traffic/{tooltip.js → trafficTooltip.js} +0 -0
- /package/src/{scene → transforms}/composeLocalTransform.js +0 -0
- /package/src/{models/nodeMatrix.js → transforms/modelNodeMatrix.js} +0 -0
- /package/src/{core → transforms}/transformNativePoint.js +0 -0
- /package/src/{scene → transforms}/updateWorldMatrix.js +0 -0
- /package/src/{scene → transforms}/worldMatrixChanged.js +0 -0
- /package/src/vehicles/{carriage.js → buildCarriage.js} +0 -0
- /package/src/vehicles/{mirror.js → mirrorVehiclePart.js} +0 -0
- /package/src/walk/{initialize.js → initializeWalkControl.js} +0 -0
- /package/src/walk/{blocked.js → isWalkBlocked.js} +0 -0
- /package/src/walk/{onBlur.js → onWalkBlur.js} +0 -0
- /package/src/walk/{onPointer.js → onWalkPointer.js} +0 -0
- /package/src/{globals → weakmaps}/boundsMethods.js +0 -0
- /package/src/{globals → weakmaps}/closestMethods.js +0 -0
- /package/src/{globals → weakmaps}/colliders.js +0 -0
- /package/src/{globals → weakmaps}/dragByHandler.js +0 -0
- /package/src/{globals → weakmaps}/dragStates.js +0 -0
- /package/src/{globals → weakmaps}/gridInitializers.js +0 -0
- /package/src/{globals → weakmaps}/imageStates.js +0 -0
- /package/src/{globals → weakmaps}/nativeEventMaps.js +0 -0
- /package/src/{globals → weakmaps}/nativeRenderByLayer.js +0 -0
- /package/src/{globals → weakmaps}/rendererDevices.js +0 -0
- /package/src/{globals → weakmaps}/renderers.js +0 -0
- /package/src/{globals → weakmaps}/sceneByLayer.js +0 -0
- /package/src/{globals → weakmaps}/sunByMap.js +0 -0
- /package/src/{globals → weakmaps}/sunlightByControl.js +0 -0
- /package/src/{globals → weakmaps}/touchByContainer.js +0 -0
- /package/src/{globals → weakmaps}/trafficByLayer.js +0 -0
- /package/src/{globals → weakmaps}/walkByMap.js +0 -0
package/libs/leaflet.js
CHANGED
|
@@ -11,7 +11,7 @@ const openlayers = new URLSearchParams(location.search).get('engine') === 'openl
|
|
|
11
11
|
document.write((openlayers
|
|
12
12
|
? '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@10.6.1/ol.css">' +
|
|
13
13
|
'<script src="https://cdn.jsdelivr.net/npm/ol@10.6.1/dist/ol.js"><\/script>' +
|
|
14
|
-
'<script src="https://unpkg.com/leaflet-city-mapper@0.0.
|
|
14
|
+
'<script src="https://unpkg.com/leaflet-city-mapper@0.0.5/libs/openlayers-bindings.min.js"><\/script>'
|
|
15
15
|
: '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9/dist/leaflet.css"><script src="https://unpkg.com/leaflet@1.9/dist/leaflet-src.js"><\/script>'));
|
|
16
16
|
|
|
17
17
|
const engineStyle = document.createElement('style');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leaflet-city-mapper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A small 3D rendering engine for leaflet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/leaflet-city-mapper.js",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Raruto/leaflet-city-mapper#readme",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"leaflet": "^1.9.3 || ^2.0.0-alpha.1"
|
|
38
|
+
"leaflet": "^1.9.3 || ^2.0.0-alpha.1",
|
|
39
|
+
"ol": "^10.6.1"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@cucumber/cucumber": "^10.3.1",
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { cameraAnimationByMap } from '../weakmaps/cameraAnimationByMap.js';
|
|
2
|
+
import { cameraFrameByMap } from '../weakmaps/cameraFrameByMap.js';
|
|
3
|
+
|
|
1
4
|
import { cameraAnimations } from '../globals/cameraAnimations.js';
|
|
2
|
-
import { cameraByMap } from '../globals/cameraByMap.js';
|
|
3
5
|
import { cameraAnimationFrame } from '../globals/cameraAnimationFrame.js';
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
export function cancelCameraAnimation(map) {
|
|
8
10
|
cameraAnimations.delete(map);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
cameraAnimationByMap.set(map, null);
|
|
12
|
+
cameraFrameByMap.set(map, null);
|
|
11
13
|
if (!cameraAnimations.size && cameraAnimationFrame.value !== null) {
|
|
12
14
|
cancelAnimationFrame(cameraAnimationFrame.value);
|
|
13
15
|
cameraAnimationFrame.value = null;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { fadeFrameByLayer } from '../weakmaps/fadeFrameByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { pendingGridFades } from '../globals/pendingGridFades.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
4
|
import { gridFadeFrame } from '../globals/gridFadeFrame.js';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export function cancelGridFade(layer) {
|
|
8
9
|
pendingGridFades.delete(layer);
|
|
9
|
-
|
|
10
|
+
fadeFrameByLayer.set(layer, null);
|
|
10
11
|
if (!pendingGridFades.size && gridFadeFrame.value !== null) {
|
|
11
12
|
cancelAnimationFrame(gridFadeFrame.value);
|
|
12
13
|
gridFadeFrame.value = null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { zoomLevelByLayer } from '../weakmaps/zoomLevelByLayer.js';
|
|
2
|
+
import { zoomTransitionsByLayer } from '../weakmaps/zoomTransitionsByLayer.js';
|
|
3
|
+
import { zoomViewByLayer } from '../weakmaps/zoomViewByLayer.js';
|
|
4
|
+
import { cameraViewByMap } from '../weakmaps/cameraViewByMap.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { mapUpdateCameraOverlays } from '../camera/mapUpdateCameraOverlays.js';
|
|
9
|
+
|
|
10
|
+
import { update } from '../scene/scheduleSceneUpdate.js';
|
|
11
|
+
|
|
12
|
+
/** Stop using the outgoing level after zoomend; the next redraw uses current tiles. */
|
|
13
|
+
|
|
14
|
+
export function endZoom() {
|
|
15
|
+
const layer = this;
|
|
16
|
+
let animation;
|
|
17
|
+
if (zoomTransitionsByLayer.get(layer)) {
|
|
18
|
+
for (animation of zoomTransitionsByLayer.get(layer).keys()) animation.finish();
|
|
19
|
+
}
|
|
20
|
+
zoomTransitionsByLayer.set(layer, null);
|
|
21
|
+
zoomViewByLayer.set(layer, null);
|
|
22
|
+
cameraViewByMap.delete(layer._map);
|
|
23
|
+
layer._map.getContainer().classList.remove('leaflet-camera-zoom');
|
|
24
|
+
mapUpdateCameraOverlays(layer._map);
|
|
25
|
+
zoomLevelByLayer.set(layer, null);
|
|
26
|
+
update(layer);
|
|
27
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { cameraAnimationByMap } from '../weakmaps/cameraAnimationByMap.js';
|
|
2
|
+
|
|
1
3
|
import { cameraEmptyOptions } from '../globals/cameraEmptyOptions.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { mapGetBearing } from './mapGetBearing.js';
|
|
4
|
+
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
5
|
+
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
6
|
+
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
6
7
|
|
|
7
8
|
import { cancelCameraAnimation } from './cancelCameraAnimation.js';
|
|
8
9
|
import { scheduleCameraAnimation } from './scheduleCameraAnimation.js';
|
|
@@ -18,7 +19,8 @@ export function mapAnimateCamera(map, pitch, bearing, options = cameraEmptyOptio
|
|
|
18
19
|
if (!Number.isFinite(duration) || duration < 0) throw /* alloc */ new TypeError('Camera duration must be nonnegative');
|
|
19
20
|
const start = performance.now(), fromPitch = mapGetPitch(map), fromBearing = mapGetBearing(map);
|
|
20
21
|
const delta = ((bearing - fromBearing) % 360 + 540) % 360 - 180;
|
|
21
|
-
const animation =
|
|
22
|
+
const animation = /* alloc */ { duration, start, fromPitch, fromBearing, pitch, delta };
|
|
23
|
+
cameraAnimationByMap.set(map, animation);
|
|
22
24
|
scheduleCameraAnimation(map, animation);
|
|
23
25
|
return map;
|
|
24
26
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { zoomViewByLayer } from '../weakmaps/zoomViewByLayer.js';
|
|
2
|
+
|
|
2
3
|
import { pendingZoomAnimations } from '../globals/pendingZoomAnimations.js';
|
|
3
4
|
|
|
4
5
|
|
|
@@ -8,9 +9,9 @@ import { renderPendingZoomAnimation } from './renderPendingZoomAnimation.js';
|
|
|
8
9
|
|
|
9
10
|
export function onZoomAnim(event) {
|
|
10
11
|
const map = this._map;
|
|
11
|
-
if (event && !
|
|
12
|
-
|
|
13
|
-
targetZoom: event.zoom, start: performance.now() };
|
|
12
|
+
if (event && !zoomViewByLayer.get(this)) {
|
|
13
|
+
zoomViewByLayer.set(this, /* alloc */ { from: map.getCenter(), zoom: map.getZoom(), to: event.center,
|
|
14
|
+
targetZoom: event.zoom, start: performance.now() });
|
|
14
15
|
map.getContainer().classList.add('leaflet-camera-zoom');
|
|
15
16
|
}
|
|
16
17
|
pendingZoomAnimations.push(this);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
3
|
+
|
|
1
4
|
import { pendingZoomAnimations } from '../globals/pendingZoomAnimations.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
|
|
@@ -7,5 +9,5 @@ import { render } from '../rendering/render.js';
|
|
|
7
9
|
|
|
8
10
|
export function renderPendingZoomAnimation() {
|
|
9
11
|
const layer = pendingZoomAnimations.shift();
|
|
10
|
-
if (
|
|
12
|
+
if (sharedByLayer.get(layer) === layer && rendererByLayer.get(layer)) render(layer);
|
|
11
13
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { cameraAnimationByMap } from '../weakmaps/cameraAnimationByMap.js';
|
|
2
|
+
import { cameraFrameByMap } from '../weakmaps/cameraFrameByMap.js';
|
|
3
|
+
|
|
1
4
|
import { cameraAnimationFrame } from '../globals/cameraAnimationFrame.js';
|
|
2
5
|
import { cameraAnimations } from '../globals/cameraAnimations.js';
|
|
3
|
-
import { cameraByMap } from '../globals/cameraByMap.js';
|
|
4
6
|
|
|
5
|
-
import { mapSetPitchAndBearing } from '
|
|
7
|
+
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
import { scheduleCameraAnimation } from './scheduleCameraAnimation.js';
|
|
@@ -14,15 +16,15 @@ export function runCameraAnimations(now) {
|
|
|
14
16
|
let failure;
|
|
15
17
|
let map, animation, progress, eased;
|
|
16
18
|
for ([map, animation] of pending) {
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
+
cameraFrameByMap.set(map, null);
|
|
20
|
+
if (cameraAnimationByMap.get(map) !== animation) continue;
|
|
19
21
|
progress = animation.duration
|
|
20
22
|
? Math.min(1, (now - animation.start) / (animation.duration * 1000)) : 1;
|
|
21
23
|
eased = 1 - (1 - progress) ** 3;
|
|
22
24
|
try {
|
|
23
25
|
mapSetPitchAndBearing(map, animation.fromPitch + (Math.max(0, Math.min(map.options.maxPitch, animation.pitch)) - animation.fromPitch) * eased, animation.fromBearing + animation.delta * eased);
|
|
24
|
-
if (progress < 1 &&
|
|
25
|
-
else if (
|
|
26
|
+
if (progress < 1 && cameraAnimationByMap.get(map) === animation) scheduleCameraAnimation(map, animation);
|
|
27
|
+
else if (cameraAnimationByMap.get(map) === animation) cameraAnimationByMap.set(map, null);
|
|
26
28
|
} catch (error) {
|
|
27
29
|
failure ||= error;
|
|
28
30
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { fadeFrameByLayer } from '../weakmaps/fadeFrameByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { gridFadeFrame } from '../globals/gridFadeFrame.js';
|
|
2
4
|
import { pendingGridFades } from '../globals/pendingGridFades.js';
|
|
3
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
import { updateGridOpacity } from '
|
|
8
|
+
import { updateGridOpacity } from '../core/updateGridOpacity.js';
|
|
8
9
|
|
|
9
10
|
export function runGridFades() {
|
|
10
11
|
gridFadeFrame.value = null;
|
|
@@ -13,7 +14,7 @@ export function runGridFades() {
|
|
|
13
14
|
for ([layer, version] of layers) {
|
|
14
15
|
if (pendingGridFades.get(layer) !== version) continue;
|
|
15
16
|
pendingGridFades.delete(layer);
|
|
16
|
-
|
|
17
|
+
fadeFrameByLayer.set(layer, null);
|
|
17
18
|
updateGridOpacity.call(layer);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { cameraFrameByMap } from '../weakmaps/cameraFrameByMap.js';
|
|
2
|
+
|
|
1
3
|
import { cameraAnimations } from '../globals/cameraAnimations.js';
|
|
2
4
|
import { cameraAnimationFrame } from '../globals/cameraAnimationFrame.js';
|
|
3
|
-
import { cameraByMap } from '../globals/cameraByMap.js';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -9,5 +10,5 @@ import { runCameraAnimations } from './runCameraAnimations.js';
|
|
|
9
10
|
export function scheduleCameraAnimation(map, animation) {
|
|
10
11
|
cameraAnimations.set(map, animation);
|
|
11
12
|
if (cameraAnimationFrame.value === null) cameraAnimationFrame.value = requestAnimationFrame(runCameraAnimations);
|
|
12
|
-
|
|
13
|
+
cameraFrameByMap.set(map, cameraAnimationFrame.value);
|
|
13
14
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fadeFrameByLayer } from '../weakmaps/fadeFrameByLayer.js';
|
|
2
|
+
import { fadeVersionByLayer } from '../weakmaps/fadeVersionByLayer.js';
|
|
3
|
+
|
|
4
|
+
import { pendingGridFades } from '../globals/pendingGridFades.js';
|
|
5
|
+
import { gridFadeFrame } from '../globals/gridFadeFrame.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import { runGridFades } from './runGridFades.js';
|
|
10
|
+
|
|
11
|
+
export function scheduleGridFade(layer) {
|
|
12
|
+
fadeVersionByLayer.set(layer, (fadeVersionByLayer.get(layer) || 0) + 1);
|
|
13
|
+
pendingGridFades.set(layer, fadeVersionByLayer.get(layer));
|
|
14
|
+
if (gridFadeFrame.value === null) gridFadeFrame.value = requestAnimationFrame(runGridFades);
|
|
15
|
+
fadeFrameByLayer.set(layer, gridFadeFrame.value);
|
|
16
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { zoomLevelByLayer } from '../weakmaps/zoomLevelByLayer.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
/** Preserve the outgoing tile level before Leaflet changes its logical zoom. */
|
|
5
6
|
|
|
6
7
|
export function startZoom() {
|
|
7
|
-
|
|
8
|
+
zoomLevelByLayer.set(this, null);
|
|
8
9
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { zoomTransitionsByLayer } from '../weakmaps/zoomTransitionsByLayer.js';
|
|
2
|
+
import { zoomViewByLayer } from '../weakmaps/zoomViewByLayer.js';
|
|
3
|
+
|
|
2
4
|
import { meshStack } from '../globals/meshStack.js';
|
|
3
5
|
import { updateZoomCamera } from './updateZoomCamera.js';
|
|
4
6
|
|
|
5
|
-
export function synchronizeZoomView(
|
|
6
|
-
const map =
|
|
7
|
+
export function synchronizeZoomView(layer, now) {
|
|
8
|
+
const map = layer._map;
|
|
7
9
|
let animation, time, start;
|
|
8
10
|
if (map._animatingZoom) {
|
|
9
|
-
|
|
11
|
+
if (!zoomTransitionsByLayer.get(layer)) zoomTransitionsByLayer.set(layer, /* alloc */ new Map());
|
|
10
12
|
for (animation of map.getContainer().getAnimations(meshStack)) {
|
|
11
13
|
if (!(animation instanceof CSSTransition) || animation.transitionProperty !== 'transform' ||
|
|
12
14
|
!animation.effect.target.classList.contains('leaflet-zoom-animated') ||
|
|
13
|
-
|
|
15
|
+
zoomTransitionsByLayer.get(layer).has(animation)) {
|
|
14
16
|
continue;
|
|
15
17
|
}
|
|
16
18
|
time = animation.currentTime || 0;
|
|
17
19
|
animation.pause();
|
|
18
|
-
|
|
20
|
+
zoomTransitionsByLayer.get(layer).set(animation, /* alloc */ { start: now, time });
|
|
19
21
|
}
|
|
20
22
|
// Freeze CSS between rendered frames: the compositor must not outrun the canvas.
|
|
21
|
-
for ([animation, { start, time }] of
|
|
23
|
+
for ([animation, { start, time }] of zoomTransitionsByLayer.get(layer)) {
|
|
22
24
|
animation.currentTime = Math.min(animation.effect.getComputedTiming().endTime, time + now - start);
|
|
23
25
|
}
|
|
24
|
-
if (
|
|
26
|
+
if (zoomViewByLayer.get(layer)) updateZoomCamera(layer, now);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { zoomTransitionsByLayer } from '../weakmaps/zoomTransitionsByLayer.js';
|
|
2
|
+
import { zoomViewByLayer } from '../weakmaps/zoomViewByLayer.js';
|
|
3
|
+
import { cameraViewByMap } from '../weakmaps/cameraViewByMap.js';
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
import { mapUpdateCameraOverlays } from '../camera/mapUpdateCameraOverlays.js';
|
|
4
7
|
|
|
5
|
-
export function updateZoomCamera(
|
|
6
|
-
const map =
|
|
7
|
-
const view =
|
|
8
|
+
export function updateZoomCamera(layer, now) {
|
|
9
|
+
const map = layer._map;
|
|
10
|
+
const view = zoomViewByLayer.get(layer);
|
|
8
11
|
let proxy, animation;
|
|
9
|
-
for (animation of
|
|
12
|
+
for (animation of zoomTransitionsByLayer.get(layer).keys()) {
|
|
10
13
|
if (animation.effect.target === map._proxy) { proxy = animation; break; }
|
|
11
14
|
}
|
|
12
15
|
const progress = proxy?.effect.getComputedTiming().progress ?? Math.min(1, (now - view.start) / 250);
|
|
13
16
|
const targetScale = map.getZoomScale(view.targetZoom, view.zoom), scale = 1 + (targetScale - 1) * progress;
|
|
14
17
|
const from = map.project(view.from, view.zoom), to = map.project(view.to, view.zoom);
|
|
15
|
-
|
|
16
|
-
center: map.unproject(from.add(to.subtract(from).multiplyBy(targetScale * progress / scale)), view.zoom) };
|
|
18
|
+
cameraViewByMap.set(map, /* alloc */ { zoom: map.getScaleZoom(scale, view.zoom),
|
|
19
|
+
center: map.unproject(from.add(to.subtract(from).multiplyBy(targetScale * progress / scale)), view.zoom) });
|
|
17
20
|
mapUpdateCameraOverlays(map);
|
|
18
21
|
}
|
package/src/archives/findTile.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getDirectoryEntries } from './getDirectoryEntries.js';
|
|
|
2
2
|
import { findDirectoryEntry } from './findDirectoryEntry.js';
|
|
3
3
|
import { getTileData } from './getTileData.js';
|
|
4
4
|
|
|
5
|
-
export async function findTile(
|
|
5
|
+
export async function findTile(layer, header, id, signal) {
|
|
6
6
|
let offset = header.rootDirectoryOffset, length = header.rootDirectoryLength;
|
|
7
7
|
let firstOffset = -1, secondOffset = -1, thirdOffset = -1;
|
|
8
8
|
let depth, entries, entry, tile;
|
|
@@ -13,12 +13,12 @@ export async function findTile(backend, header, id, signal) {
|
|
|
13
13
|
if (depth === 0) firstOffset = offset;
|
|
14
14
|
else if (depth === 1) secondOffset = offset;
|
|
15
15
|
else if (depth === 2) thirdOffset = offset;
|
|
16
|
-
entries = await getDirectoryEntries(
|
|
16
|
+
entries = await getDirectoryEntries(layer, offset, length, header.internalCompression);
|
|
17
17
|
signal?.throwIfAborted();
|
|
18
18
|
entry = findDirectoryEntry(entries, id);
|
|
19
19
|
if (!entry) return;
|
|
20
20
|
if (entry.runLength) {
|
|
21
|
-
tile = await getTileData(
|
|
21
|
+
tile = await getTileData(layer, header, entry, id, signal);
|
|
22
22
|
return tile;
|
|
23
23
|
}
|
|
24
24
|
if (entry.offset + entry.length > header.leafDirectoryLength) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { directoriesByLayer } from '../weakmaps/directoriesByLayer.js';
|
|
2
|
+
|
|
2
3
|
import { loadDirectory } from './loadDirectory.js';
|
|
3
4
|
|
|
4
|
-
export async function getDirectoryEntries(
|
|
5
|
-
const directories =
|
|
5
|
+
export async function getDirectoryEntries(layer, offset, length, compression) {
|
|
6
|
+
const directories = directoriesByLayer.get(layer);
|
|
6
7
|
const key = `${offset}:${length}`;
|
|
7
8
|
if (!directories.has(key)) {
|
|
8
9
|
if (directories.size >= 32) directories.delete(directories.keys().next().value);
|
|
9
|
-
directories.set(key, loadDirectory(
|
|
10
|
+
directories.set(key, loadDirectory(layer, offset, length, compression));
|
|
10
11
|
}
|
|
11
12
|
const pending = directories.get(key);
|
|
12
13
|
try {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { archiveHeaderByLayer } from '../weakmaps/archiveHeaderByLayer.js';
|
|
2
|
+
import { sceneLayers } from '../weakmaps/sceneLayers.js';
|
|
4
3
|
import { decodeHeader } from './decodeHeader.js';
|
|
5
|
-
import { read } from './
|
|
4
|
+
import { read } from './readArchiveRange.js';
|
|
6
5
|
|
|
7
6
|
/** Cache header initialization; failures remain visible to all callers. */
|
|
8
7
|
|
|
9
8
|
export function getHeader(layer) {
|
|
10
|
-
if (!
|
|
9
|
+
if (!sceneLayers.has(layer)) return layer.getHeader();
|
|
11
10
|
if (layer.options.archive && layer.options.archive !== layer) return getHeader(layer.options.archive);
|
|
12
|
-
|
|
11
|
+
let header = archiveHeaderByLayer.get(layer);
|
|
12
|
+
if (!header) {
|
|
13
|
+
header = read(layer, 0, 127).then(decodeHeader);
|
|
14
|
+
archiveHeaderByLayer.set(layer, header);
|
|
15
|
+
}
|
|
16
|
+
return header;
|
|
13
17
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { decompress } from './decompress.js';
|
|
2
|
-
import { read } from './
|
|
2
|
+
import { read } from './readArchiveRange.js';
|
|
3
3
|
|
|
4
|
-
export async function getTileData(
|
|
4
|
+
export async function getTileData(layer, header, entry, id, signal) {
|
|
5
5
|
if (id - entry.tileId >= entry.runLength) return;
|
|
6
6
|
if (entry.offset + entry.length > header.tileDataLength) {
|
|
7
7
|
throw /* alloc */ new Error('PMTiles tile outside data section');
|
|
8
8
|
}
|
|
9
|
-
const data = await decompress(await read(
|
|
9
|
+
const data = await decompress(await read(layer, header.tileDataOffset + entry.offset, entry.length, signal),
|
|
10
10
|
header.tileCompression);
|
|
11
11
|
signal?.throwIfAborted();
|
|
12
12
|
return /* alloc */ { data };
|
package/src/archives/getZxy.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sceneLayers } from '../weakmaps/sceneLayers.js';
|
|
2
|
+
|
|
2
3
|
import { tileId } from './tileId.js';
|
|
3
4
|
import { getHeader } from './getHeader.js';
|
|
4
5
|
import { findTile } from './findTile.js';
|
|
5
6
|
|
|
6
7
|
/** Nearest directory entry at/before the Hilbert ID, then follow leaf pointers. */
|
|
7
8
|
|
|
8
|
-
export async function getZxy(
|
|
9
|
-
if (!
|
|
10
|
-
if (
|
|
11
|
-
return getZxy(
|
|
9
|
+
export async function getZxy(layer, z, x, y, signal) {
|
|
10
|
+
if (!sceneLayers.has(layer)) return layer.getZxy(z, x, y, signal);
|
|
11
|
+
if (layer.options.archive && layer.options.archive !== layer) {
|
|
12
|
+
return getZxy(layer.options.archive, z, x, y, signal);
|
|
12
13
|
}
|
|
13
14
|
const id = tileId(z, x, y);
|
|
14
15
|
signal?.throwIfAborted();
|
|
15
|
-
const header = await getHeader(
|
|
16
|
+
const header = await getHeader(layer);
|
|
16
17
|
signal?.throwIfAborted();
|
|
17
18
|
if (z < header.minZoom || z > header.maxZoom) return;
|
|
18
|
-
return findTile(
|
|
19
|
+
return findTile(layer, header, id, signal);
|
|
19
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decodeDirectory } from "./decodeDirectory.js";
|
|
2
2
|
import { decompress } from "./decompress.js";
|
|
3
|
-
import { read } from "./
|
|
3
|
+
import { read } from "./readArchiveRange.js";
|
|
4
4
|
|
|
5
|
-
export async function loadDirectory(
|
|
6
|
-
return decodeDirectory(await decompress(await read(
|
|
5
|
+
export async function loadDirectory(layer, offset, length, compression) {
|
|
6
|
+
return decodeDirectory(await decompress(await read(layer, offset, length), compression));
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { geojsonByLayer } from '../weakmaps/geojsonByLayer.js';
|
|
2
|
+
|
|
2
3
|
import { archiveDecoder } from '../globals/archiveDecoder.js';
|
|
3
4
|
|
|
4
5
|
import { getZxy } from './getZxy.js';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export async function loadSource(layer, area) {
|
|
8
|
-
if (
|
|
9
|
+
if (geojsonByLayer.get(layer)) {
|
|
9
10
|
const { data, url } = layer.options;
|
|
10
11
|
if (data !== undefined && url) {
|
|
11
12
|
throw /* alloc */ new Error('GeoJSON source requires either data or url');
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { etagByLayer } from '../weakmaps/etagByLayer.js';
|
|
2
|
+
import { urlByLayer } from '../weakmaps/urlByLayer.js';
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
|
|
4
|
-
export async function read(
|
|
6
|
+
export async function read(layer, offset, length, signal) {
|
|
5
7
|
signal?.throwIfAborted();
|
|
6
8
|
if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) ||
|
|
7
9
|
offset < 0 || length <= 0 || !Number.isSafeInteger(offset + length)) {
|
|
8
10
|
throw /* alloc */ new Error('Invalid PMTiles byte range');
|
|
9
11
|
}
|
|
10
|
-
const response = await fetch(
|
|
12
|
+
const response = await fetch(urlByLayer.get(layer), /* alloc */ {
|
|
11
13
|
headers: /* alloc */ { Range: `bytes=${offset}-${offset + length - 1}` }, signal,
|
|
12
14
|
});
|
|
13
15
|
if (!response.ok) {
|
|
14
16
|
throw /* alloc */ new Error(`Unable to read PMTiles: HTTP ${response.status}`);
|
|
15
17
|
}
|
|
16
18
|
const etag = response.headers.get('ETag');
|
|
17
|
-
if (
|
|
19
|
+
if (etagByLayer.get(layer) && etag !== etagByLayer.get(layer)) {
|
|
18
20
|
throw /* alloc */ new Error('PMTiles archive changed; recreate the layer');
|
|
19
21
|
}
|
|
20
|
-
if (etag)
|
|
22
|
+
if (etag) etagByLayer.set(layer, etag);
|
|
21
23
|
let data = await response.arrayBuffer();
|
|
22
24
|
if (response.status === 200) {
|
|
23
25
|
data = data.slice(offset, offset + length);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cameraDraggableByMap } from '../weakmaps/cameraDraggableByMap.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
import { adjustCameraDrag } from '../controls/adjustCameraDrag.js';
|
|
@@ -6,6 +7,6 @@ import { adjustCameraDrag } from '../controls/adjustCameraDrag.js';
|
|
|
6
7
|
export function cameraMapReady() {
|
|
7
8
|
const draggable = this.dragging?._draggable;
|
|
8
9
|
if (!draggable) return;
|
|
9
|
-
|
|
10
|
+
cameraDraggableByMap.set(this, draggable);
|
|
10
11
|
draggable.on('predrag', adjustCameraDrag, this);
|
|
11
12
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cameraDraggableByMap } from '../weakmaps/cameraDraggableByMap.js';
|
|
2
|
+
import { pitchSkyByMap } from '../weakmaps/pitchSkyByMap.js';
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
import { cancelCameraAnimation } from '../animations/cancelCameraAnimation.js';
|
|
5
7
|
import { adjustCameraDrag } from '../controls/adjustCameraDrag.js';
|
|
6
8
|
|
|
7
9
|
export function cleanupCameraMap() {
|
|
8
10
|
cancelCameraAnimation(this);
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
delete
|
|
11
|
+
pitchSkyByMap.get(this)?.remove();
|
|
12
|
+
if (cameraDraggableByMap.get(this)) {
|
|
13
|
+
cameraDraggableByMap.get(this).off('predrag', adjustCameraDrag, this);
|
|
14
|
+
cameraDraggableByMap.delete(this);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -2,9 +2,9 @@ import { L } from '../globals/L.js';
|
|
|
2
2
|
import { cameraEmptyOptions } from '../globals/cameraEmptyOptions.js';
|
|
3
3
|
import { cameraZeroPadding } from '../globals/cameraZeroPadding.js';
|
|
4
4
|
import { cameraAngles } from '../globals/cameraAngles.js';
|
|
5
|
-
import { pointOf } from '
|
|
6
|
-
import { angles } from '
|
|
7
|
-
import { verticalGroundY } from '
|
|
5
|
+
import { pointOf } from '../projections/toPoint.js';
|
|
6
|
+
import { angles } from '../projections/cameraAngles.js';
|
|
7
|
+
import { verticalGroundY } from '../projections/verticalGroundY.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
export function fitCameraBounds(map, bounds, options = cameraEmptyOptions) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cameraMaps } from '../weakmaps/cameraMaps.js';
|
|
2
|
+
import { cameraReadyByMap } from '../weakmaps/cameraReadyByMap.js';
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
import { mapSetPitchAndBearing } from './mapSetPitchAndBearing.js';
|
|
4
6
|
|
|
@@ -10,7 +12,7 @@ import { loadCameraControls } from '../controls/loadCameraControls.js';
|
|
|
10
12
|
import { noOperation } from '../utils/noOperation.js';
|
|
11
13
|
|
|
12
14
|
export function initializeCameraMap() {
|
|
13
|
-
|
|
15
|
+
cameraMaps.add(this);
|
|
14
16
|
if (!document.getElementById('leaflet-camera-zoom-style')) {
|
|
15
17
|
const style = document.createElement('style');
|
|
16
18
|
style.id = 'leaflet-camera-zoom-style';
|
|
@@ -24,7 +26,7 @@ export function initializeCameraMap() {
|
|
|
24
26
|
this.once('unload', cleanupCameraMap, this);
|
|
25
27
|
this.whenReady(cameraMapReady, this);
|
|
26
28
|
if (this.options.rotate || this.options.trackContainerMutation) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
cameraReadyByMap.set(this, loadCameraControls(this));
|
|
30
|
+
cameraReadyByMap.get(this).catch(noOperation);
|
|
29
31
|
}
|
|
30
32
|
}
|
package/src/camera/mapCamera.js
CHANGED
|
@@ -9,7 +9,7 @@ import { tooltipPosition } from '../globals/tooltipPosition.js';
|
|
|
9
9
|
import { tiledBounds } from '../globals/tiledBounds.js';
|
|
10
10
|
import { gridEvents } from '../globals/gridEvents.js';
|
|
11
11
|
|
|
12
|
-
import { initNativeGPU } from '../
|
|
12
|
+
import { initNativeGPU } from '../native/initNativeGPU.js';
|
|
13
13
|
|
|
14
14
|
import { mapLayerPointToContainerPoint } from './mapLayerPointToContainerPoint.js';
|
|
15
15
|
import { mapContainerPointToLayerPoint } from './mapContainerPointToLayerPoint.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mapMethods } from '../globals/mapMethods.js';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { animationPoint } from '
|
|
5
|
-
import { project } from '
|
|
4
|
+
import { animationPoint } from '../projections/transformZoomAnimationPoint.js';
|
|
5
|
+
import { project } from '../projections/projectCameraPoint.js';
|
|
6
6
|
|
|
7
7
|
export function mapContainerPointToLayerPoint(point) {
|
|
8
8
|
return mapMethods.value.containerPointToLayerPoint.call(this, animationPoint(this, project(this, point, true), true));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cameraBearingByMap } from '../weakmaps/cameraBearingByMap.js';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
export function mapGetBearing(map) { return cameraBearingByMap.get(map) ?? 0; }
|