leaflet-city-mapper 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/leaflet-city-mapper-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker.js.map +1 -1
- package/dist/leaflet-city-mapper.js.map +1 -1
- package/libs/leaflet-lens.js +151 -151
- package/libs/leaflet.js +3 -3
- package/libs/openlayers-bindings.js +1129 -1129
- package/libs/openlayers-bindings.min.js.map +1 -1
- package/package.json +2 -4
- package/src/animations/cancelCameraAnimation.js +19 -19
- package/src/animations/mapStopPitchBearingAnimation.js +10 -10
- package/src/animations/scheduleCameraAnimation.js +15 -15
- package/src/animations/scheduleMarkerPan.js +14 -14
- package/src/animations/updateZoomCamera.js +25 -25
- package/src/archives/findDirectoryEntry.js +17 -17
- package/src/archives/findTile.js +45 -45
- package/src/archives/getDirectoryEntries.js +30 -30
- package/src/archives/getTileData.js +26 -26
- package/src/archives/readArchiveRange.js +48 -48
- package/src/astronomy/solarTime.js +21 -21
- package/src/camera/cameraMapReady.js +9 -9
- package/src/camera/cleanupCameraMap.js +13 -13
- package/src/camera/constrainCameraToBounds.js +3 -3
- package/src/camera/createSceneCamera.js +25 -25
- package/src/camera/getBearing.js +10 -10
- package/src/camera/getPitch.js +10 -10
- package/src/camera/mapGetBoundsCenterZoom.js +14 -14
- package/src/camera/mapLimitOffset.js +17 -17
- package/src/camera/mapPanBy.js +14 -14
- package/src/camera/setBearing.js +13 -13
- package/src/camera/setPitch.js +13 -13
- package/src/cog/decodeCogTile.js +37 -37
- package/src/cog/finiteCogValues.js +12 -12
- package/src/cog/getCogAssetEntry.js +26 -26
- package/src/cog/getCogBase.js +22 -22
- package/src/cog/getCogHeader.js +10 -10
- package/src/cog/getCogProfile.js +25 -25
- package/src/cog/getCogTile.js +25 -25
- package/src/cog/getColorTile.js +38 -38
- package/src/cog/getElevationTile.js +29 -29
- package/src/cog/hasCogProjection.js +16 -16
- package/src/cog/initCog.js +13 -13
- package/src/cog/invalidCogFullResponse.js +10 -10
- package/src/cog/openCog.js +40 -40
- package/src/cog/openCogAsset.js +22 -22
- package/src/cog/readCog.js +39 -39
- package/src/cog/readCogBlock.js +19 -19
- package/src/cog/readCogBody.js +30 -30
- package/src/cog/readCogDirectories.js +32 -32
- package/src/cog/readCogDirectory.js +34 -34
- package/src/cog/readCogLevel.js +36 -36
- package/src/cog/readCogTag.js +28 -28
- package/src/cog/validCogDimensions.js +15 -15
- package/src/cog/validCogEncoding.js +18 -18
- package/src/cog/validCogGeoArrays.js +17 -17
- package/src/cog/validCogGrid.js +22 -22
- package/src/cog/validCogTileCoordinates.js +13 -13
- package/src/cog/validateCogContainer.js +17 -17
- package/src/cog/validateCogContentRange.js +18 -18
- package/src/cog/validateCogOffsets.js +19 -19
- package/src/cog/validateCogRange.js +16 -16
- package/src/cog/validateCogResponse.js +26 -26
- package/src/collision/collectIntersections.js +41 -41
- package/src/collision/hiddenLightHit.js +19 -19
- package/src/collision/indexTriangle.js +18 -18
- package/src/collision/insideMesh.js +47 -47
- package/src/collision/insideWalker.js +52 -52
- package/src/collision/intersectMeshes.js +40 -40
- package/src/collision/localRay.js +31 -31
- package/src/collision/mergeHits.js +19 -19
- package/src/collision/rayBounds.js +28 -28
- package/src/collision/readTriangle.js +32 -32
- package/src/collision/trafficCollision.js +23 -23
- package/src/collision/transformTriangle.js +18 -18
- package/src/collision/triangleDistance.js +34 -34
- package/src/collision/vertexCount.js +11 -11
- package/src/collision/worldHit.js +30 -30
- package/src/controls/acceptPitchDrag.js +10 -10
- package/src/controls/acceptRotateDrag.js +9 -9
- package/src/controls/addCameraHandler.js +18 -18
- package/src/controls/adjustCameraDrag.js +13 -13
- package/src/controls/cameraDragContextMenu.js +12 -12
- package/src/controls/cameraDragEnd.js +10 -10
- package/src/controls/cameraDragMove.js +31 -31
- package/src/controls/changeCameraTouch.js +17 -17
- package/src/controls/compassOrientation.js +12 -12
- package/src/controls/compassRemoveHooks.js +2 -2
- package/src/controls/containerResizeRemoveHooks.js +2 -2
- package/src/controls/endCameraTouch.js +18 -18
- package/src/controls/failCompassPermission.js +10 -10
- package/src/controls/finishCameraDrag.js +14 -14
- package/src/controls/finishCompassPermission.js +24 -24
- package/src/controls/isEditableTarget.js +9 -9
- package/src/controls/loadCameraControls.js +18 -18
- package/src/controls/moveCameraTouch.js +34 -34
- package/src/controls/refreshRotateFocus.js +5 -5
- package/src/controls/removeCameraDrag.js +28 -28
- package/src/controls/resizeMap.js +7 -7
- package/src/controls/rotateButtonClick.js +16 -16
- package/src/controls/rotateButtonKeydown.js +20 -20
- package/src/controls/rotateControl.js +12 -12
- package/src/controls/shiftRotateRemoveHooks.js +2 -2
- package/src/controls/shiftRotateWheel.js +15 -15
- package/src/core/cameraMarkerOnDrag.js +16 -16
- package/src/core/constructLayer.js +16 -16
- package/src/core/extendLeafletClass.js +12 -12
- package/src/core/extendTerrainPixelBounds.js +41 -41
- package/src/core/layerAddInitHook.js +12 -12
- package/src/core/layerMergeOptions.js +14 -14
- package/src/core/markerInitInteraction.js +10 -10
- package/src/core/markerSetIcon.js +14 -14
- package/src/core/markerSetRotation.js +19 -19
- package/src/core/projectNativePath.js +30 -30
- package/src/core/redrawPath.js +11 -11
- package/src/core/removeLayer.js +26 -26
- package/src/core/setRotation.js +12 -12
- package/src/core/whenReady.js +14 -14
- package/src/geometry/addBridges.js +36 -36
- package/src/geometry/addGeneratedTriangle.js +10 -10
- package/src/geometry/appendAreaTriangle.js +32 -32
- package/src/geometry/appendNativeTriangle.js +17 -17
- package/src/geometry/appendRouteDash.js +33 -33
- package/src/geometry/appendRouteSegment.js +28 -28
- package/src/geometry/assembleAreaGeometry.js +48 -48
- package/src/geometry/bridgeEdge.js +18 -18
- package/src/geometry/bridgeFaces.js +22 -22
- package/src/geometry/bridgePaths.js +19 -19
- package/src/geometry/bridgePolygon.js +37 -37
- package/src/geometry/bridgeSides.js +18 -18
- package/src/geometry/buildProjectedPoint.js +32 -32
- package/src/geometry/buildProjectedPolygon.js +34 -34
- package/src/geometry/circleAt.js +20 -20
- package/src/geometry/circleGeometry.js +41 -41
- package/src/geometry/createModelGeometry.js +44 -44
- package/src/geometry/crossVector.js +15 -15
- package/src/geometry/dashValues.js +23 -23
- package/src/geometry/dashedSegment.js +33 -33
- package/src/geometry/diskAt.js +18 -18
- package/src/geometry/emitter.js +18 -18
- package/src/geometry/fillNativePolygon.js +28 -28
- package/src/geometry/generateTreeGeometry.js +18 -18
- package/src/geometry/indexBridge.js +36 -36
- package/src/geometry/instanceAreaGeometry.js +37 -37
- package/src/geometry/line.js +28 -28
- package/src/geometry/lineJoin.js +35 -35
- package/src/geometry/markerImageBounds.js +20 -20
- package/src/geometry/meshShadowBounds.js +33 -33
- package/src/geometry/offsetBelowGround.js +10 -10
- package/src/geometry/quad.js +23 -23
- package/src/geometry/restoreGeometry.js +29 -29
- package/src/geometry/roofCoverage.js +33 -33
- package/src/geometry/roofFootprint.js +40 -40
- package/src/geometry/samePoint.js +11 -11
- package/src/geometry/segment.js +32 -32
- package/src/geometry/subtractRoofTile.js +28 -28
- package/src/geometry/terrainBuffers.js +36 -36
- package/src/geometry/terrainTileGeometry.js +28 -28
- package/src/geometry/validateTree.js +19 -19
- package/src/globals/L.js +6 -6
- package/src/globals/cameraFov.js +8 -8
- package/src/globals/cogTags.js +6 -6
- package/src/globals/colorTexture.js +11 -11
- package/src/globals/cosObliquity.js +8 -8
- package/src/globals/degrees.js +6 -6
- package/src/globals/earthCirc.js +6 -6
- package/src/globals/geometryWorkerUrl.js +8 -8
- package/src/globals/halfRadians.js +6 -6
- package/src/globals/lampDirections.js +13 -13
- package/src/globals/layerControlAddItem.js +8 -8
- package/src/globals/leafletLayer.js +8 -8
- package/src/globals/lightScale.js +6 -6
- package/src/globals/mvtTextDecoder.js +6 -6
- package/src/globals/nativeScalableStyleKeys.js +6 -6
- package/src/globals/sinObliquity.js +8 -8
- package/src/globals/tau.js +6 -6
- package/src/globals/vectorStyleNamedColors.js +13 -13
- package/src/globals/vectorTileEvents.js +6 -6
- package/src/globals/workerCogSource.js +6 -6
- package/src/gpu/initializeRendererResources.js +39 -39
- package/src/gpu/initializeSharedRenderer.js +59 -59
- package/src/gpu/mountRenderer.js +25 -25
- package/src/layer-controls/layerControlInputId.js +18 -18
- package/src/layer-controls/layerCountTitle.js +16 -16
- package/src/layer-controls/placeEntryElement.js +29 -29
- package/src/layer-controls/renderLayerCount.js +28 -28
- package/src/lighting/visitLightCells.js +26 -26
- package/src/lighting/writeLightCell.js +14 -14
- package/src/materials/createProgramLayout.js +44 -44
- package/src/materials/createProgramUniforms.js +25 -25
- package/src/materials/modelMaterialFor.js +29 -29
- package/src/materials/prepareMeshCutout.js +21 -21
- package/src/materials/terrainRasterProgram.js +65 -65
- package/src/materials/validateRoofMaterial.js +17 -17
- package/src/models/applyModelTransform.js +18 -18
- package/src/models/buildModelNodes.js +24 -24
- package/src/models/createModelContext.js +24 -24
- package/src/models/loadBuffer.js +16 -16
- package/src/models/loadModelResources.js +22 -22
- package/src/models/normalizeAccessor.js +21 -21
- package/src/models/prepareModel.js +29 -29
- package/src/models/prepareModelGeometry.js +35 -35
- package/src/models/prepareModelPrimitive.js +25 -25
- package/src/models/readAccessorValue.js +16 -16
- package/src/models/readModelAttributes.js +32 -32
- package/src/models/readModelIndices.js +28 -28
- package/src/models/readSparseAccessor.js +31 -31
- package/src/models/releaseModelResources.js +15 -15
- package/src/mvt/addMvtCrossings.js +23 -23
- package/src/mvt/appendMvtBandTriangles.js +42 -42
- package/src/mvt/appendMvtCoordinates.js +20 -20
- package/src/mvt/appendMvtPolygonTriangles.js +29 -29
- package/src/mvt/beginMvtPath.js +19 -19
- package/src/mvt/closeMvtPath.js +16 -16
- package/src/mvt/collectMvtEdges.js +29 -29
- package/src/mvt/createMvtReader.js +14 -14
- package/src/mvt/decodeVectorTile.js +39 -39
- package/src/mvt/expectMvtWire.js +11 -11
- package/src/mvt/finishMvtPath.js +14 -14
- package/src/mvt/finiteMvtCoordinate.js +14 -14
- package/src/mvt/groupMvtPolygons.js +35 -35
- package/src/mvt/isMvtFallbackError.js +13 -13
- package/src/mvt/mergeMvtActiveEdges.js +18 -18
- package/src/mvt/mvtEdgeX.js +12 -12
- package/src/mvt/mvtPathsVertices.js +15 -15
- package/src/mvt/mvtPolygonPaths.js +19 -19
- package/src/mvt/numericMvtValue.js +11 -11
- package/src/mvt/readMvtFeature.js +46 -46
- package/src/mvt/readMvtField.js +17 -17
- package/src/mvt/readMvtGeometry.js +42 -42
- package/src/mvt/readMvtInteger.js +22 -22
- package/src/mvt/readMvtKnownValue.js +30 -30
- package/src/mvt/readMvtLayer.js +40 -40
- package/src/mvt/readMvtMessage.js +18 -18
- package/src/mvt/readMvtNumber.js +18 -18
- package/src/mvt/readMvtNumbers.js +18 -18
- package/src/mvt/readMvtString.js +14 -14
- package/src/mvt/readMvtValue.js +29 -29
- package/src/mvt/skipMvtField.js +22 -22
- package/src/mvt/sortMvtActiveEdges.js +20 -20
- package/src/mvt/sortedMvtLevels.js +29 -29
- package/src/mvt/takeMvtBytes.js +18 -18
- package/src/mvt/tessellateVectorRings.js +26 -26
- package/src/mvt/triangulateVectorRings.js +23 -23
- package/src/native/beforeNativeRender.js +21 -21
- package/src/native/bypassNativeEvent.js +21 -21
- package/src/native/canScaleNativeStyle.js +26 -26
- package/src/native/compareNativeHits.js +10 -10
- package/src/native/createNativeMesh.js +46 -46
- package/src/native/forwardNativeError.js +8 -8
- package/src/native/getGridTerrainTile.js +47 -47
- package/src/native/gridTerrainElevation.js +34 -34
- package/src/native/isCurrentNativeLayer.js +11 -11
- package/src/native/loadGridTerrain.js +36 -36
- package/src/native/nativeEventSource.js +27 -27
- package/src/native/nativeProgram.js +28 -28
- package/src/native/nativeTerrainElevation.js +27 -27
- package/src/native/nativeVectorGeometry.js +30 -30
- package/src/native/orderNativeGridLayer.js +20 -20
- package/src/native/prepareGridTerrainRequests.js +23 -23
- package/src/native/pruneNativeResources.js +25 -25
- package/src/native/readyNativeGPU.js +13 -13
- package/src/native/rejectNativeReady.js +2 -2
- package/src/native/removeNativeEvents.js +20 -20
- package/src/native/resolveNativeReady.js +2 -2
- package/src/native/restoreNativeEvents.js +8 -8
- package/src/native/retainGridTerrain.js +15 -15
- package/src/native/styleNativeMesh.js +20 -20
- package/src/native/syncGridTile.js +28 -28
- package/src/native/syncImageOverlay.js +13 -13
- package/src/native/syncNativeStrokeAnchors.js +18 -18
- package/src/native/syncNativeStrokeZoom.js +34 -34
- package/src/native/syncTerrainGridTile.js +38 -38
- package/src/native/terrainGridMesh.js +47 -47
- package/src/native/updateNativeHover.js +15 -15
- package/src/native/updateNativeStrokeRadius.js +14 -14
- package/src/picking/hitColliderCell.js +29 -29
- package/src/picking/validateCameraInverse.js +15 -15
- package/src/projections/displayContainerPoint.js +32 -32
- package/src/projections/projectBridgePoint.js +17 -17
- package/src/projections/toPoint.js +13 -13
- package/src/projections/transformZoomAnimationPoint.js +8 -8
- package/src/projections/verticalGroundY.js +14 -14
- package/src/raster/rasterTileRange.js +32 -32
- package/src/raster/retainRasterTiles.js +21 -21
- package/src/rendering/collectVisibleMesh.js +48 -48
- package/src/rendering/compareMeshDepth.js +14 -14
- package/src/rendering/drawPipeline.js +44 -44
- package/src/rendering/nativeStrokeExpansion.js +11 -11
- package/src/rendering/prepareFrameBuffer.js +24 -24
- package/src/rendering/prepareMeshUniforms.js +36 -36
- package/src/rendering/revealRoofMesh.js +43 -43
- package/src/scene/addSceneLayer.js +24 -24
- package/src/scene/callLayer.js +34 -34
- package/src/scene/createLayer.js +13 -13
- package/src/scene/getLocation.js +12 -12
- package/src/scene/isNativeLayer.js +19 -19
- package/src/scene/removeSceneLayer.js +22 -22
- package/src/scene/reportLayerError.js +9 -9
- package/src/shaders/materialBaseShader.js +26 -26
- package/src/shaders/materialSurfaceShader.js +60 -60
- package/src/shaders/materialVertexShader.js +89 -89
- package/src/shaders/nativeStrokeShader.js +13 -13
- package/src/shaders/roofVertexShader.js +16 -16
- package/src/shadows/shadowMeshMatches.js +19 -19
- package/src/sources/buildAreaFeatures.js +23 -23
- package/src/sources/extrusionStyle.js +21 -21
- package/src/sources/featureAnchor.js +21 -21
- package/src/sources/groundOffset.js +9 -9
- package/src/sources/initVectorTiles.js +21 -21
- package/src/sources/isVectorTileSource.js +11 -11
- package/src/sources/matchesAreaTile.js +17 -17
- package/src/sources/pendingSourceAreas.js +28 -28
- package/src/sources/prepareAreaGeometryJob.js +34 -34
- package/src/sources/projectAreaPolygons.js +25 -25
- package/src/sources/readyVectorTiles.js +17 -17
- package/src/sunlight/addTimeControlToMap.js +18 -18
- package/src/sunlight/addTimeLayer.js +12 -12
- package/src/sunlight/initializeTimeControl.js +18 -18
- package/src/sunlight/onAddSun.js +37 -37
- package/src/sunlight/onAddTimeControl.js +12 -12
- package/src/sunlight/onRemoveSun.js +10 -10
- package/src/sunlight/removeSun.js +25 -25
- package/src/sunlight/removeTimeControl.js +14 -14
- package/src/sunlight/removeTimeLayer.js +11 -11
- package/src/sunlight/requestSunlightRender.js +12 -12
- package/src/sunlight/styleTimeControl.js +13 -13
- package/src/sunlight/tickSun.js +10 -10
- package/src/sunlight/updateCelestialDisc.js +23 -23
- package/src/sunlight/updateSun.js +44 -44
- package/src/sunlight/useLiveTime.js +11 -11
- package/src/sunlight/useSelectedTime.js +26 -26
- package/src/terrain/applyTerrain.js +30 -30
- package/src/terrain/copyTerrainTile.js +20 -20
- package/src/terrain/loadReadyTerrain.js +6 -6
- package/src/terrain/mapElevationOf.js +19 -19
- package/src/terrain/readBridges.js +13 -13
- package/src/terrain/readyTerrainOf.js +14 -14
- package/src/terrain/sampleTerrainTile.js +16 -16
- package/src/terrain/terrainTileQueue.js +34 -34
- package/src/textures/addImageState.js +13 -13
- package/src/textures/bindMeshTextures.js +57 -57
- package/src/textures/collectRoofTiles.js +23 -23
- package/src/textures/loadModelImage.js +29 -29
- package/src/textures/modelTextureFor.js +47 -47
- package/src/textures/prepareMeshTextures.js +31 -31
- package/src/textures/removeImageState.js +13 -13
- package/src/textures/resizeRoofTexture.js +32 -32
- package/src/textures/restoreMaterialTextures.js +22 -22
- package/src/textures/updateRoofAtlas.js +29 -29
- package/src/textures/uploadMeshTexture.js +32 -32
- package/src/textures/uploadNativeImage.js +26 -26
- package/src/textures/uploadRoofTile.js +29 -29
- package/src/traffic/createTrafficMesh.js +17 -17
- package/src/traffic/disposeTrafficObject.js +19 -19
- package/src/traffic/failTraffic.js +12 -12
- package/src/traffic/failedTrafficLoad.js +10 -10
- package/src/traffic/fetchTrafficLanes.js +21 -21
- package/src/traffic/loadedTrafficLanes.js +21 -21
- package/src/traffic/locateTraffic.js +20 -20
- package/src/traffic/moveTraffic.js +21 -21
- package/src/traffic/readyTraffic.js +10 -10
- package/src/traffic/refreshTrafficTrips.js +42 -42
- package/src/traffic/routeColor.js +13 -13
- package/src/traffic/startTraffic.js +12 -12
- package/src/traffic/trafficNow.js +15 -15
- package/src/traffic/trafficStatusText.js +13 -13
- package/src/traffic/trafficStorage.js +13 -13
- package/src/traffic/updateTraffic.js +13 -13
- package/src/traffic/updateTrafficLights.js +23 -23
- package/src/traffic/updateTrafficPose.js +15 -15
- package/src/traffic/updateTrafficTerrain.js +15 -15
- package/src/traffic/uploadTrafficLanes.js +27 -27
- package/src/transforms/composeLocalTransform.js +23 -23
- package/src/transforms/transformNativePoint.js +19 -19
- package/src/transforms/worldMatrixChanged.js +26 -26
- package/src/triangulation/clipEars.js +32 -32
- package/src/triangulation/connectHole.js +30 -30
- package/src/triangulation/cross.js +12 -12
- package/src/triangulation/equal.js +11 -11
- package/src/triangulation/intersects.js +21 -21
- package/src/triangulation/mergeHoles.js +19 -19
- package/src/triangulation/on.js +13 -13
- package/src/triangulation/polygonRings.js +22 -22
- package/src/triangulation/validateArea.js +19 -19
- package/src/utils/compareDistance.js +11 -11
- package/src/utils/yieldTask.js +12 -12
- package/src/vector-style/appendQuotedStyleCharacter.js +30 -30
- package/src/vector-style/arrayContainsRange.js +18 -18
- package/src/vector-style/evaluateBoolean.js +31 -31
- package/src/vector-style/evaluateCoalesceOrCase.js +34 -34
- package/src/vector-style/evaluateComparison.js +29 -29
- package/src/vector-style/evaluateIExpression.js +21 -21
- package/src/vector-style/evaluateInput.js +16 -16
- package/src/vector-style/evaluateInterpolate.js +36 -36
- package/src/vector-style/evaluateMatch.js +21 -21
- package/src/vector-style/evaluateMath.js +26 -26
- package/src/vector-style/evaluateMembership.js +29 -29
- package/src/vector-style/evaluateNegation.js +26 -26
- package/src/vector-style/evaluatePrimitive.js +21 -21
- package/src/vector-style/evaluateStep.js +20 -20
- package/src/vector-style/evaluateStyle.js +43 -43
- package/src/vector-style/evaluateToExpression.js +27 -27
- package/src/vector-style/fillVectorPaint.js +26 -26
- package/src/vector-style/lineVectorPaint.js +31 -31
- package/src/vector-style/parseFunctionalColor.js +23 -23
- package/src/vector-style/parseHexColor.js +20 -20
- package/src/vector-style/parseVectorStyle.js +20 -20
- package/src/vector-style/readPaintValue.js +17 -17
- package/src/vector-style/removeTrailingCommas.js +19 -19
- package/src/vector-style/scaleDashArray.js +25 -25
- package/src/vector-style/skipStyleComment.js +20 -20
- package/src/vector-style/stripStyleComments.js +28 -28
- package/src/vector-style/styleColor.js +18 -18
- package/src/vector-style/validateVectorLayers.js +18 -18
- package/src/vector-style/vectorPaint.js +17 -17
- package/src/vector-style/visibleStyle.js +16 -16
- package/src/vector-tiles/appendVectorBatch.js +34 -34
- package/src/vector-tiles/attachVectorTileBatch.js +25 -25
- package/src/vector-tiles/attachVectorTileBatches.js +26 -26
- package/src/vector-tiles/compareVectorLabelPriority.js +11 -11
- package/src/vector-tiles/compareVectorTileDistance.js +11 -11
- package/src/vector-tiles/createVectorLabel.js +37 -37
- package/src/vector-tiles/forwardVectorTileError.js +10 -10
- package/src/vector-tiles/loadVectorSprite.js +14 -14
- package/src/vector-tiles/loadVectorTile.js +45 -45
- package/src/vector-tiles/onVectorTileAdd.js +44 -44
- package/src/vector-tiles/onVectorTileMessage.js +15 -15
- package/src/vector-tiles/onVectorTileRemove.js +25 -25
- package/src/vector-tiles/onVectorTileWorkerError.js +16 -16
- package/src/vector-tiles/paintVectorTileBatch.js +18 -18
- package/src/vector-tiles/prepareVectorLabel.js +34 -34
- package/src/vector-tiles/prepareVectorStyleLayer.js +38 -38
- package/src/vector-tiles/prepareVectorTile.js +29 -29
- package/src/vector-tiles/projectVectorPaths.js +25 -25
- package/src/vector-tiles/projectVectorPoint.js +15 -15
- package/src/vector-tiles/projectVectorTriangles.js +28 -28
- package/src/vector-tiles/pruneVectorTiles.js +14 -14
- package/src/vector-tiles/pumpVectorTiles.js +21 -21
- package/src/vector-tiles/readTileJSON.js +27 -27
- package/src/vector-tiles/readVectorStyle.js +28 -28
- package/src/vector-tiles/refreshVectorTiles.js +8 -8
- package/src/vector-tiles/reserveVectorLabelCells.js +14 -14
- package/src/vector-tiles/retireVectorTileGroup.js +20 -20
- package/src/vector-tiles/revokeVectorWorkerUrl.js +14 -14
- package/src/vector-tiles/rotateVectorLabel.js +19 -19
- package/src/vector-tiles/rotateVectorLabels.js +9 -9
- package/src/vector-tiles/simplifyVectorPath.js +29 -29
- package/src/vector-tiles/updateVectorLabelMarker.js +36 -36
- package/src/vector-tiles/updateVectorLabelStyle.js +14 -14
- package/src/vector-tiles/updateVectorTileLabels.js +33 -33
- package/src/vector-tiles/updateVectorTilePaint.js +25 -25
- package/src/vector-tiles/updateVectorTiles.js +32 -32
- package/src/vector-tiles/validateVectorTileZooms.js +15 -15
- package/src/vector-tiles/vectorFeaturePaint.js +25 -25
- package/src/vector-tiles/vectorFeaturePaths.js +26 -26
- package/src/vector-tiles/vectorFeatureZoom.js +18 -18
- package/src/vector-tiles/vectorLabelAnchors.js +31 -31
- package/src/vector-tiles/vectorLabelCandidates.js +18 -18
- package/src/vector-tiles/vectorLabelCells.js +32 -32
- package/src/vector-tiles/vectorLabelIcon.js +38 -38
- package/src/vector-tiles/vectorLabelProperty.js +12 -12
- package/src/vector-tiles/vectorLabelText.js +19 -19
- package/src/vector-tiles/vectorSpriteIcon.js +19 -19
- package/src/vector-tiles/vectorStraightRun.js +23 -23
- package/src/vector-tiles/vectorStyleDependencies.js +22 -22
- package/src/vector-tiles/vectorStyleValue.js +16 -16
- package/src/vector-tiles/vectorStyleZoom.js +12 -12
- package/src/vector-tiles/vectorTileAwaited.js +17 -17
- package/src/vector-tiles/vectorTileOverlaps.js +12 -12
- package/src/vector-tiles/vectorTilePaint.js +18 -18
- package/src/vector-tiles/vectorTileSettings.js +27 -27
- package/src/vector-tiles/vectorTilesIdle.js +11 -11
- package/src/vector-tiles/vectorTolerance.js +11 -11
- package/src/vector-tiles/wrapVectorLabel.js +17 -17
- package/src/vehicles/boatModel.js +35 -35
- package/src/vehicles/busModel.js +13 -13
- package/src/vehicles/carModel.js +39 -39
- package/src/walk/initializeWalkControl.js +12 -12
- package/src/walk/isWalkBlocked.js +15 -15
- package/src/walk/landWalker.js +41 -41
- package/src/walk/moveWalker.js +37 -37
- package/src/walk/onAddWalkControl.js +40 -40
- package/src/walk/onRemoveWalkControl.js +17 -17
- package/src/walk/onWalkBlur.js +3 -3
- package/src/walk/onWalkTerrain.js +3 -3
- package/src/walk/resolveWalkerPosition.js +33 -33
- package/src/walk/stepWalkerHeight.js +18 -18
- package/src/walk/toggleWalking.js +4 -4
- package/src/walk/updateWalkerFrame.js +29 -29
- package/src/walk/updateWalkerView.js +31 -31
- package/src/weakmaps/cameraHandlersByMap.js +6 -6
- package/src/weakmaps/geometryWorkersByMap.js +6 -6
- package/src/weakmaps/nativeProgramsByRenderer.js +6 -6
- package/src/weakmaps/pathProjectionByMap.js +6 -6
- package/src/weakmaps/streamTerrainByLayer.js +6 -6
- package/src/weakmaps/streamTerrainByMap.js +6 -6
- package/src/weakmaps/sunByMap.js +6 -6
- package/src/weakmaps/vectorTileOptionsByLayer.js +6 -6
- package/src/weakmaps/vectorWorkerByLayer.js +6 -6
- package/src/weakmaps/walkByMap.js +6 -6
- package/src/weakmaps/workerMapByLayer.js +6 -6
- package/src/workers/acquireGeometryWorker.js +39 -39
- package/src/workers/buildAreaInWorker.js +24 -24
- package/src/workers/closeGeometryWorkers.js +16 -16
- package/src/workers/cogWorker.js +27 -27
- package/src/workers/createGeometryWorker.js +30 -30
- package/src/workers/geometryWorker.js +34 -34
- package/src/workers/getCogInWorker.js +18 -18
- package/src/workers/modelWorker.js +17 -17
- package/src/workers/openCogInWorker.js +22 -22
- package/src/workers/runSourceWorker.js +44 -44
- package/src/workers/settleGeometryWorker.js +16 -16
- package/src/workers/startGeometryWorker.js +23 -23
- package/src/workers/vectorTileWorker.js +15 -15
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a local ray hit to a world-space point and its distance from the original ray origin.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} ray Original world-space ray.
|
|
5
|
-
* @param {Object} mesh Intersected mesh.
|
|
6
|
-
* @param {number[]} origin Local ray origin.
|
|
7
|
-
* @param {number[]} direction Local ray direction.
|
|
8
|
-
* @param {number} closest Local ray distance to the hit.
|
|
9
|
-
* @param {number} faceIndex Index of the hit triangle.
|
|
10
|
-
*
|
|
11
|
-
* @returns {Object} Hit containing the mesh, face index, world point and distance.
|
|
12
|
-
*/
|
|
13
|
-
export function worldHit(ray, mesh, origin, direction, closest, faceIndex) {
|
|
14
|
-
const x = direction[0] * closest + origin[0];
|
|
15
|
-
const y = direction[1] * closest + origin[1];
|
|
16
|
-
const z = direction[2] * closest + origin[2];
|
|
17
|
-
const matrix = mesh.worldMatrix;
|
|
18
|
-
const w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
|
|
19
|
-
const worldPoint = /* alloc */ [
|
|
20
|
-
(matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12]) / w,
|
|
21
|
-
(matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13]) / w,
|
|
22
|
-
(matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14]) / w,
|
|
23
|
-
];
|
|
24
|
-
return /* alloc */ {
|
|
25
|
-
faceIndex,
|
|
26
|
-
object: mesh,
|
|
27
|
-
point: worldPoint,
|
|
28
|
-
distance: Math.hypot(worldPoint[0] - ray.origin[0], worldPoint[1] - ray.origin[1], worldPoint[2] - ray.origin[2])
|
|
29
|
-
};
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Convert a local ray hit to a world-space point and its distance from the original ray origin.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} ray Original world-space ray.
|
|
5
|
+
* @param {Object} mesh Intersected mesh.
|
|
6
|
+
* @param {number[]} origin Local ray origin.
|
|
7
|
+
* @param {number[]} direction Local ray direction.
|
|
8
|
+
* @param {number} closest Local ray distance to the hit.
|
|
9
|
+
* @param {number} faceIndex Index of the hit triangle.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Object} Hit containing the mesh, face index, world point and distance.
|
|
12
|
+
*/
|
|
13
|
+
export function worldHit(ray, mesh, origin, direction, closest, faceIndex) {
|
|
14
|
+
const x = direction[0] * closest + origin[0];
|
|
15
|
+
const y = direction[1] * closest + origin[1];
|
|
16
|
+
const z = direction[2] * closest + origin[2];
|
|
17
|
+
const matrix = mesh.worldMatrix;
|
|
18
|
+
const w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
|
|
19
|
+
const worldPoint = /* alloc */ [
|
|
20
|
+
(matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12]) / w,
|
|
21
|
+
(matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13]) / w,
|
|
22
|
+
(matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14]) / w,
|
|
23
|
+
];
|
|
24
|
+
return /* alloc */ {
|
|
25
|
+
faceIndex,
|
|
26
|
+
object: mesh,
|
|
27
|
+
point: worldPoint,
|
|
28
|
+
distance: Math.hypot(worldPoint[0] - ray.origin[0], worldPoint[1] - ray.origin[1], worldPoint[2] - ray.origin[2])
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accept a right-button or Ctrl-left drag outside controls, markers and popups.
|
|
3
|
-
*
|
|
4
|
-
* @param {PointerEvent} event Pointer event.
|
|
5
|
-
*
|
|
6
|
-
* @returns {boolean} Whether the drag can start.
|
|
7
|
-
*/
|
|
8
|
-
export function acceptPitchDrag(event) {
|
|
9
|
-
return !event.target.closest('.leaflet-control,.leaflet-marker-icon,.leaflet-popup') &&
|
|
10
|
-
(event.button === 2 || event.button === 0 && event.ctrlKey);
|
|
1
|
+
/**
|
|
2
|
+
* Accept a right-button or Ctrl-left drag outside controls, markers and popups.
|
|
3
|
+
*
|
|
4
|
+
* @param {PointerEvent} event Pointer event.
|
|
5
|
+
*
|
|
6
|
+
* @returns {boolean} Whether the drag can start.
|
|
7
|
+
*/
|
|
8
|
+
export function acceptPitchDrag(event) {
|
|
9
|
+
return !event.target.closest('.leaflet-control,.leaflet-marker-icon,.leaflet-popup') &&
|
|
10
|
+
(event.button === 2 || event.button === 0 && event.ctrlKey);
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accept a primary-button drag on the rotate control.
|
|
3
|
-
*
|
|
4
|
-
* @param {PointerEvent} event Pointer event.
|
|
5
|
-
*
|
|
6
|
-
* @returns {boolean} Whether the drag can start.
|
|
7
|
-
*/
|
|
8
|
-
export function acceptRotateDrag(event) {
|
|
9
|
-
return event.button === 0;
|
|
1
|
+
/**
|
|
2
|
+
* Accept a primary-button drag on the rotate control.
|
|
3
|
+
*
|
|
4
|
+
* @param {PointerEvent} event Pointer event.
|
|
5
|
+
*
|
|
6
|
+
* @returns {boolean} Whether the drag can start.
|
|
7
|
+
*/
|
|
8
|
+
export function acceptRotateDrag(event) {
|
|
9
|
+
return event.button === 0;
|
|
10
10
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { cameraHandlersByMap } from '../weakmaps/cameraHandlersByMap.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Register a camera handler and enable it when its map option is set.
|
|
6
|
-
*
|
|
7
|
-
* @param {L.Map} map Map owning the handler.
|
|
8
|
-
* @param {string} name Handler and option name.
|
|
9
|
-
* @param {Function} Type Handler constructor.
|
|
10
|
-
*/
|
|
11
|
-
export function addCameraHandler(map, name, Type) {
|
|
12
|
-
let handlers = cameraHandlersByMap.get(map);
|
|
13
|
-
if (!handlers) cameraHandlersByMap.set(map, handlers = /* alloc */ new Map());
|
|
14
|
-
const handler = /* alloc */ new Type(map);
|
|
15
|
-
handlers.set(name, handler);
|
|
16
|
-
map._handlers.push(handler);
|
|
17
|
-
if (map.options[name]) handler.enable();
|
|
18
|
-
}
|
|
1
|
+
|
|
2
|
+
import { cameraHandlersByMap } from '../weakmaps/cameraHandlersByMap.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Register a camera handler and enable it when its map option is set.
|
|
6
|
+
*
|
|
7
|
+
* @param {L.Map} map Map owning the handler.
|
|
8
|
+
* @param {string} name Handler and option name.
|
|
9
|
+
* @param {Function} Type Handler constructor.
|
|
10
|
+
*/
|
|
11
|
+
export function addCameraHandler(map, name, Type) {
|
|
12
|
+
let handlers = cameraHandlersByMap.get(map);
|
|
13
|
+
if (!handlers) cameraHandlersByMap.set(map, handlers = /* alloc */ new Map());
|
|
14
|
+
const handler = /* alloc */ new Type(map);
|
|
15
|
+
handlers.set(name, handler);
|
|
16
|
+
map._handlers.push(handler);
|
|
17
|
+
if (map.options[name]) handler.enable();
|
|
18
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { cameraDraggableByMap } from '../weakmaps/cameraDraggableByMap.js';
|
|
2
|
-
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
3
|
-
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
4
|
-
import { project } from '../projections/projectCameraPoint.js';
|
|
5
|
-
|
|
6
|
-
/** Convert this map's draggable displacement into ground-space camera movement. */
|
|
7
|
-
export function adjustCameraDrag() {
|
|
8
|
-
const map = this;
|
|
9
|
-
const draggable = cameraDraggableByMap.get(map);
|
|
10
|
-
if (!mapGetPitch(map) && !mapGetBearing(map)) return;
|
|
11
|
-
const half = map.getSize().divideBy(2), delta = draggable._newPos.subtract(draggable._startPos);
|
|
12
|
-
const ground = half.subtract(project(map, half.subtract(delta), true));
|
|
13
|
-
draggable._newPos = draggable._startPos.add(ground);
|
|
1
|
+
import { cameraDraggableByMap } from '../weakmaps/cameraDraggableByMap.js';
|
|
2
|
+
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
3
|
+
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
4
|
+
import { project } from '../projections/projectCameraPoint.js';
|
|
5
|
+
|
|
6
|
+
/** Convert this map's draggable displacement into ground-space camera movement. */
|
|
7
|
+
export function adjustCameraDrag() {
|
|
8
|
+
const map = this;
|
|
9
|
+
const draggable = cameraDraggableByMap.get(map);
|
|
10
|
+
if (!mapGetPitch(map) && !mapGetBearing(map)) return;
|
|
11
|
+
const half = map.getSize().divideBy(2), delta = draggable._newPos.subtract(draggable._startPos);
|
|
12
|
+
const ground = half.subtract(project(map, half.subtract(delta), true));
|
|
13
|
+
draggable._newPos = draggable._startPos.add(ground);
|
|
14
14
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { dragStates } from '../weakmaps/dragStates.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Suppress the context menu while or after a camera drag.
|
|
5
|
-
*
|
|
6
|
-
* @param {MouseEvent} event Context-menu event.
|
|
7
|
-
*/
|
|
8
|
-
export function cameraDragContextMenu(event) {
|
|
9
|
-
const state = dragStates.value.get(this);
|
|
10
|
-
if (!state.drag && !state.moved) return;
|
|
11
|
-
event.preventDefault();
|
|
12
|
-
event.stopPropagation();
|
|
1
|
+
import { dragStates } from '../weakmaps/dragStates.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Suppress the context menu while or after a camera drag.
|
|
5
|
+
*
|
|
6
|
+
* @param {MouseEvent} event Context-menu event.
|
|
7
|
+
*/
|
|
8
|
+
export function cameraDragContextMenu(event) {
|
|
9
|
+
const state = dragStates.value.get(this);
|
|
10
|
+
if (!state.drag && !state.moved) return;
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
event.stopPropagation();
|
|
13
13
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { dragStates } from '../weakmaps/dragStates.js';
|
|
2
|
-
import { finishCameraDrag } from './finishCameraDrag.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Finish the camera drag associated with this element.
|
|
6
|
-
*
|
|
7
|
-
* @param {PointerEvent} event Pointer completion event.
|
|
8
|
-
*/
|
|
9
|
-
export function cameraDragEnd(event) {
|
|
10
|
-
finishCameraDrag(dragStates.value.get(this), event);
|
|
1
|
+
import { dragStates } from '../weakmaps/dragStates.js';
|
|
2
|
+
import { finishCameraDrag } from './finishCameraDrag.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Finish the camera drag associated with this element.
|
|
6
|
+
*
|
|
7
|
+
* @param {PointerEvent} event Pointer completion event.
|
|
8
|
+
*/
|
|
9
|
+
export function cameraDragEnd(event) {
|
|
10
|
+
finishCameraDrag(dragStates.value.get(this), event);
|
|
11
11
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { degrees } from '../globals/degrees.js';
|
|
2
|
-
import { dragStates } from '../weakmaps/dragStates.js';
|
|
3
|
-
import { mapStopPitchBearingAnimation } from '../animations/mapStopPitchBearingAnimation.js';
|
|
4
|
-
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
5
|
-
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
6
|
-
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Update camera pitch and bearing from an active pointer drag.
|
|
10
|
-
*
|
|
11
|
-
* @param {PointerEvent} event Pointer-move event.
|
|
12
|
-
*/
|
|
13
|
-
export function cameraDragMove(event) {
|
|
14
|
-
const state = dragStates.value.get(this);
|
|
15
|
-
if (!state.drag || state.drag.id !== event.pointerId) return;
|
|
16
|
-
const x = event.clientX - state.drag.x, y = event.clientY - state.drag.y;
|
|
17
|
-
if (Math.hypot(x, y) < 3 && !state.moved) return;
|
|
18
|
-
mapStopPitchBearingAnimation(state.map);
|
|
19
|
-
state.moved = true;
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
let bearing = x * state.sensitivity[0];
|
|
22
|
-
if (state.orbit) {
|
|
23
|
-
if (Math.abs(state.drag.cy - state.drag.y) > 100) {
|
|
24
|
-
const angle = Math.atan2(event.clientY - state.drag.cy, event.clientX - state.drag.cx) -
|
|
25
|
-
Math.atan2(event.clientY - state.drag.cy, state.drag.x - state.drag.cx);
|
|
26
|
-
bearing = Math.atan2(Math.sin(angle), Math.cos(angle)) * degrees;
|
|
27
|
-
} else bearing *= event.clientY < state.drag.cy ? 1 : -1;
|
|
28
|
-
}
|
|
29
|
-
mapSetPitchAndBearing(state.map, mapGetPitch(state.map) - y * state.sensitivity[1], mapGetBearing(state.map) + bearing);
|
|
30
|
-
state.drag.x = event.clientX;
|
|
31
|
-
state.drag.y = event.clientY;
|
|
1
|
+
import { degrees } from '../globals/degrees.js';
|
|
2
|
+
import { dragStates } from '../weakmaps/dragStates.js';
|
|
3
|
+
import { mapStopPitchBearingAnimation } from '../animations/mapStopPitchBearingAnimation.js';
|
|
4
|
+
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
5
|
+
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
6
|
+
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Update camera pitch and bearing from an active pointer drag.
|
|
10
|
+
*
|
|
11
|
+
* @param {PointerEvent} event Pointer-move event.
|
|
12
|
+
*/
|
|
13
|
+
export function cameraDragMove(event) {
|
|
14
|
+
const state = dragStates.value.get(this);
|
|
15
|
+
if (!state.drag || state.drag.id !== event.pointerId) return;
|
|
16
|
+
const x = event.clientX - state.drag.x, y = event.clientY - state.drag.y;
|
|
17
|
+
if (Math.hypot(x, y) < 3 && !state.moved) return;
|
|
18
|
+
mapStopPitchBearingAnimation(state.map);
|
|
19
|
+
state.moved = true;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
let bearing = x * state.sensitivity[0];
|
|
22
|
+
if (state.orbit) {
|
|
23
|
+
if (Math.abs(state.drag.cy - state.drag.y) > 100) {
|
|
24
|
+
const angle = Math.atan2(event.clientY - state.drag.cy, event.clientX - state.drag.cx) -
|
|
25
|
+
Math.atan2(event.clientY - state.drag.cy, state.drag.x - state.drag.cx);
|
|
26
|
+
bearing = Math.atan2(Math.sin(angle), Math.cos(angle)) * degrees;
|
|
27
|
+
} else bearing *= event.clientY < state.drag.cy ? 1 : -1;
|
|
28
|
+
}
|
|
29
|
+
mapSetPitchAndBearing(state.map, mapGetPitch(state.map) - y * state.sensitivity[1], mapGetBearing(state.map) + bearing);
|
|
30
|
+
state.drag.x = event.clientX;
|
|
31
|
+
state.drag.y = event.clientY;
|
|
32
32
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
|
|
2
|
-
import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
|
|
3
|
-
import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
|
|
4
|
-
import { endCameraTouch } from './endCameraTouch.js';
|
|
5
|
-
|
|
6
|
-
/** Coordinate this map's native touch zoom with its camera touch handlers. */
|
|
7
|
-
export function changeCameraTouch() {
|
|
8
|
-
const state = cameraTouchStateByMap.get(this), { map, container } = state;
|
|
9
|
-
const active = touchRotateByMap.get(map).enabled() || touchPitchByMap.get(map).enabled();
|
|
10
|
-
if (active && state.nativeZoom === undefined) {
|
|
11
|
-
state.nativeZoom = map.touchZoom?.enabled();
|
|
12
|
-
map.touchZoom?.disable();
|
|
13
|
-
} else if (!active && state.nativeZoom !== undefined) {
|
|
14
|
-
endCameraTouch(state);
|
|
15
|
-
if (state.nativeZoom && container._leaflet_id) map.touchZoom.enable();
|
|
16
|
-
state.nativeZoom = undefined;
|
|
17
|
-
}
|
|
1
|
+
import { cameraTouchStateByMap } from '../weakmaps/cameraTouchStateByMap.js';
|
|
2
|
+
import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
|
|
3
|
+
import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
|
|
4
|
+
import { endCameraTouch } from './endCameraTouch.js';
|
|
5
|
+
|
|
6
|
+
/** Coordinate this map's native touch zoom with its camera touch handlers. */
|
|
7
|
+
export function changeCameraTouch() {
|
|
8
|
+
const state = cameraTouchStateByMap.get(this), { map, container } = state;
|
|
9
|
+
const active = touchRotateByMap.get(map).enabled() || touchPitchByMap.get(map).enabled();
|
|
10
|
+
if (active && state.nativeZoom === undefined) {
|
|
11
|
+
state.nativeZoom = map.touchZoom?.enabled();
|
|
12
|
+
map.touchZoom?.disable();
|
|
13
|
+
} else if (!active && state.nativeZoom !== undefined) {
|
|
14
|
+
endCameraTouch(state);
|
|
15
|
+
if (state.nativeZoom && container._leaflet_id) map.touchZoom.enable();
|
|
16
|
+
state.nativeZoom = undefined;
|
|
17
|
+
}
|
|
18
18
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { mapSetBearing } from '../camera/mapSetBearing.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Update the handler's map bearing from a device orientation event.
|
|
5
|
-
*
|
|
6
|
-
* @param {DeviceOrientationEvent} event Device orientation reading.
|
|
7
|
-
*/
|
|
8
|
-
export function compassOrientation(event) {
|
|
9
|
-
const handler = this.handler;
|
|
10
|
-
const bearing = Number.isFinite(event.webkitCompassHeading) ? -event.webkitCompassHeading : event.alpha;
|
|
11
|
-
const orientation = event.absolute ? 0 : (screen.orientation?.angle ?? window.orientation ?? 0);
|
|
12
|
-
if (Number.isFinite(bearing)) mapSetBearing(handler._map, bearing - orientation);
|
|
1
|
+
import { mapSetBearing } from '../camera/mapSetBearing.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Update the handler's map bearing from a device orientation event.
|
|
5
|
+
*
|
|
6
|
+
* @param {DeviceOrientationEvent} event Device orientation reading.
|
|
7
|
+
*/
|
|
8
|
+
export function compassOrientation(event) {
|
|
9
|
+
const handler = this.handler;
|
|
10
|
+
const bearing = Number.isFinite(event.webkitCompassHeading) ? -event.webkitCompassHeading : event.alpha;
|
|
11
|
+
const orientation = event.absolute ? 0 : (screen.orientation?.angle ?? window.orientation ?? 0);
|
|
12
|
+
if (Number.isFinite(bearing)) mapSetBearing(handler._map, bearing - orientation);
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Invalidate pending compass permission and remove this handler's orientation listeners. */
|
|
2
2
|
export function compassRemoveHooks() {
|
|
3
|
-
this._generation++;
|
|
4
|
-
window.removeEventListener('deviceorientation', this._orientation);
|
|
3
|
+
this._generation++;
|
|
4
|
+
window.removeEventListener('deviceorientation', this._orientation);
|
|
5
5
|
window.removeEventListener('deviceorientationabsolute', this._orientation);
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Disconnect this handler's container resize observer. */
|
|
2
2
|
export function containerResizeRemoveHooks() {
|
|
3
|
-
const container = this._map.getContainer();
|
|
4
|
-
this._observer.disconnect();
|
|
3
|
+
const container = this._map.getContainer();
|
|
4
|
+
this._observer.disconnect();
|
|
5
5
|
delete container._containerResizeMap;
|
|
6
6
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* End a camera touch gesture and restore map dragging and zoom snapping.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} state Camera touch state.
|
|
5
|
-
* @param {TouchEvent} [event] Touch completion event.
|
|
6
|
-
*/
|
|
7
|
-
export function endCameraTouch(state, event) {
|
|
8
|
-
if (!state.touch) return;
|
|
9
|
-
if (event?.touches?.length >= 2) return;
|
|
10
|
-
const { map, container, touch } = state;
|
|
11
|
-
if (touch.dragging && container._leaflet_id) map.dragging.enable();
|
|
12
|
-
map.options.zoomSnap = touch.snap;
|
|
13
|
-
if (touch.zooming && touch.snap && container._leaflet_id) {
|
|
14
|
-
map.setZoom(Math.round(map.getZoom() / touch.snap) * touch.snap,
|
|
15
|
-
/* alloc */ { animate: false });
|
|
16
|
-
}
|
|
17
|
-
state.touch = null;
|
|
18
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* End a camera touch gesture and restore map dragging and zoom snapping.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} state Camera touch state.
|
|
5
|
+
* @param {TouchEvent} [event] Touch completion event.
|
|
6
|
+
*/
|
|
7
|
+
export function endCameraTouch(state, event) {
|
|
8
|
+
if (!state.touch) return;
|
|
9
|
+
if (event?.touches?.length >= 2) return;
|
|
10
|
+
const { map, container, touch } = state;
|
|
11
|
+
if (touch.dragging && container._leaflet_id) map.dragging.enable();
|
|
12
|
+
map.options.zoomSnap = touch.snap;
|
|
13
|
+
if (touch.zooming && touch.snap && container._leaflet_id) {
|
|
14
|
+
map.setZoom(Math.round(map.getZoom() / touch.snap) * touch.snap,
|
|
15
|
+
/* alloc */ { animate: false });
|
|
16
|
+
}
|
|
17
|
+
state.touch = null;
|
|
18
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Disable a compass handler and emit its permission error.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} handler Compass handler.
|
|
5
|
-
* @param {Error} error Permission or listener error.
|
|
6
|
-
*/
|
|
7
|
-
export function failCompassPermission(handler, error) {
|
|
8
|
-
handler.disable();
|
|
9
|
-
handler._map.fire('error', /* alloc */ { error });
|
|
10
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Disable a compass handler and emit its permission error.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} handler Compass handler.
|
|
5
|
+
* @param {Error} error Permission or listener error.
|
|
6
|
+
*/
|
|
7
|
+
export function failCompassPermission(handler, error) {
|
|
8
|
+
handler.disable();
|
|
9
|
+
handler._map.fire('error', /* alloc */ { error });
|
|
10
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Finish an active camera drag and restore pointer capture, map dragging and cursor.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} state Camera drag state.
|
|
5
|
-
* @param {PointerEvent} [event] Pointer completion event.
|
|
6
|
-
*/
|
|
7
|
-
export function finishCameraDrag(state, event) {
|
|
8
|
-
if (!state?.drag) return;
|
|
9
|
-
if (event?.pointerId !== undefined && event.pointerId !== state.drag.id) return;
|
|
10
|
-
const finished = state.drag;
|
|
11
|
-
state.drag = null;
|
|
12
|
-
if (state.element.hasPointerCapture?.(finished.id)) state.element.releasePointerCapture(finished.id);
|
|
13
|
-
if (finished.dragging && state.map.getContainer()._leaflet_id) state.map.dragging.enable();
|
|
14
|
-
state.element.style.cursor = finished.cursor;
|
|
1
|
+
/**
|
|
2
|
+
* Finish an active camera drag and restore pointer capture, map dragging and cursor.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} state Camera drag state.
|
|
5
|
+
* @param {PointerEvent} [event] Pointer completion event.
|
|
6
|
+
*/
|
|
7
|
+
export function finishCameraDrag(state, event) {
|
|
8
|
+
if (!state?.drag) return;
|
|
9
|
+
if (event?.pointerId !== undefined && event.pointerId !== state.drag.id) return;
|
|
10
|
+
const finished = state.drag;
|
|
11
|
+
state.drag = null;
|
|
12
|
+
if (state.element.hasPointerCapture?.(finished.id)) state.element.releasePointerCapture(finished.id);
|
|
13
|
+
if (finished.dragging && state.map.getContainer()._leaflet_id) state.map.dragging.enable();
|
|
14
|
+
state.element.style.cursor = finished.cursor;
|
|
15
15
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { failCompassPermission } from './failCompassPermission.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Install compass listeners if the current permission request succeeded.
|
|
5
|
-
*
|
|
6
|
-
* @param {Array<Object>} results Settled handler-generation and permission results.
|
|
7
|
-
*
|
|
8
|
-
* @returns {*} Permission failure handler result when permission is unavailable or denied.
|
|
9
|
-
*/
|
|
10
|
-
export function finishCompassPermission([handlerResult, permissionResult]) {
|
|
11
|
-
const { handler, generation } = handlerResult.value;
|
|
12
|
-
if (!handler.enabled() || handler._generation !== generation) return;
|
|
13
|
-
if (!window.DeviceOrientationEvent || permissionResult.status !== 'fulfilled' ||
|
|
14
|
-
permissionResult.value !== 'granted') {
|
|
15
|
-
return failCompassPermission(handler, permissionResult.status === 'rejected' ? permissionResult.reason :
|
|
16
|
-
/* alloc */ new Error('Device compass permission unavailable or denied'));
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
window.addEventListener('deviceorientation', handler._orientation);
|
|
20
|
-
window.addEventListener('deviceorientationabsolute', handler._orientation);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
failCompassPermission(handler, error);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { failCompassPermission } from './failCompassPermission.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Install compass listeners if the current permission request succeeded.
|
|
5
|
+
*
|
|
6
|
+
* @param {Array<Object>} results Settled handler-generation and permission results.
|
|
7
|
+
*
|
|
8
|
+
* @returns {*} Permission failure handler result when permission is unavailable or denied.
|
|
9
|
+
*/
|
|
10
|
+
export function finishCompassPermission([handlerResult, permissionResult]) {
|
|
11
|
+
const { handler, generation } = handlerResult.value;
|
|
12
|
+
if (!handler.enabled() || handler._generation !== generation) return;
|
|
13
|
+
if (!window.DeviceOrientationEvent || permissionResult.status !== 'fulfilled' ||
|
|
14
|
+
permissionResult.value !== 'granted') {
|
|
15
|
+
return failCompassPermission(handler, permissionResult.status === 'rejected' ? permissionResult.reason :
|
|
16
|
+
/* alloc */ new Error('Device compass permission unavailable or denied'));
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
window.addEventListener('deviceorientation', handler._orientation);
|
|
20
|
+
window.addEventListener('deviceorientationabsolute', handler._orientation);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
failCompassPermission(handler, error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Find an editable ancestor of an event target.
|
|
3
|
-
*
|
|
4
|
-
* @param {Element} target Event target.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Element|null|undefined} Editable ancestor, if supported and found.
|
|
7
|
-
*/
|
|
8
|
-
export function editable(target) {
|
|
9
|
-
return target.closest?.('input,textarea,select,[contenteditable="true"]');
|
|
1
|
+
/**
|
|
2
|
+
* Find an editable ancestor of an event target.
|
|
3
|
+
*
|
|
4
|
+
* @param {Element} target Event target.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Element|null|undefined} Editable ancestor, if supported and found.
|
|
7
|
+
*/
|
|
8
|
+
export function editable(target) {
|
|
9
|
+
return target.closest?.('input,textarea,select,[contenteditable="true"]');
|
|
10
10
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load and initialize camera controls for a map that is still mounted.
|
|
3
|
-
*
|
|
4
|
-
* @param {L.Map} map Map receiving the controls.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Promise<void>} Completion of control loading.
|
|
7
|
-
*
|
|
8
|
-
* @throws {Error} If loading or initialization fails, after emitting a map error.
|
|
9
|
-
*/
|
|
10
|
-
export async function loadCameraControls(map) {
|
|
11
|
-
try {
|
|
12
|
-
const { cameraControls } = await import('./cameraControls.js');
|
|
13
|
-
if (map._container?._leaflet_id) cameraControls(map);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
map.fire('error', /* alloc */ { error });
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Load and initialize camera controls for a map that is still mounted.
|
|
3
|
+
*
|
|
4
|
+
* @param {L.Map} map Map receiving the controls.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Promise<void>} Completion of control loading.
|
|
7
|
+
*
|
|
8
|
+
* @throws {Error} If loading or initialization fails, after emitting a map error.
|
|
9
|
+
*/
|
|
10
|
+
export async function loadCameraControls(map) {
|
|
11
|
+
try {
|
|
12
|
+
const { cameraControls } = await import('./cameraControls.js');
|
|
13
|
+
if (map._container?._leaflet_id) cameraControls(map);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
map.fire('error', /* alloc */ { error });
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
|
|
2
|
-
import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
|
|
3
|
-
import { degrees } from '../globals/degrees.js';
|
|
4
|
-
import { touchByContainer } from '../weakmaps/touchByContainer.js';
|
|
5
|
-
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Update camera angles and anchored zoom during a two-finger gesture.
|
|
9
|
-
*
|
|
10
|
-
* @param {TouchEvent} event Touch-move event.
|
|
11
|
-
*/
|
|
12
|
-
export function moveCameraTouch(event) {
|
|
13
|
-
const state = touchByContainer.get(this), { map, container, touch } = state;
|
|
14
|
-
if (!touch || event.touches.length !== 2) return;
|
|
15
|
-
const [a, b] = event.touches;
|
|
16
|
-
const angle = Math.atan2(b.clientY - a.clientY, b.clientX - a.clientX);
|
|
17
|
-
const rect = container.getBoundingClientRect(), middle = touch.currentMiddle;
|
|
18
|
-
middle.x = (a.clientX + b.clientX) / 2 - rect.left;
|
|
19
|
-
middle.y = (a.clientY + b.clientY) / 2 - rect.top;
|
|
20
|
-
const delta = Math.atan2(Math.sin(angle - touch.angle), Math.cos(angle - touch.angle)) * degrees;
|
|
21
|
-
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);
|
|
22
|
-
const distance = Math.hypot(b.clientX - a.clientX, b.clientY - a.clientY);
|
|
23
|
-
if (distance < 1) return;
|
|
24
|
-
const zoom = touch.zooming ? Math.max(map.getMinZoom(), Math.min(map.getMaxZoom(),
|
|
25
|
-
touch.zoom + Math.log2(distance / touch.distance))) : touch.zoom;
|
|
26
|
-
map.setView(map.getCenter(), zoom, /* alloc */ { animate: false });
|
|
27
|
-
if (map.options.touchZoom !== 'center') {
|
|
28
|
-
const projected = map.project(touch.anchor).subtract(map.project(map.containerPointToLatLng(middle)));
|
|
29
|
-
map.setView(map.unproject(map.project(map.getCenter()).add(projected)), map.getZoom(),
|
|
30
|
-
/* alloc */ { animate: false });
|
|
31
|
-
}
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
event.stopImmediatePropagation();
|
|
34
|
-
}
|
|
1
|
+
import { touchPitchByMap } from '../weakmaps/touchPitchByMap.js';
|
|
2
|
+
import { touchRotateByMap } from '../weakmaps/touchRotateByMap.js';
|
|
3
|
+
import { degrees } from '../globals/degrees.js';
|
|
4
|
+
import { touchByContainer } from '../weakmaps/touchByContainer.js';
|
|
5
|
+
import { mapSetPitchAndBearing } from '../camera/mapSetPitchAndBearing.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Update camera angles and anchored zoom during a two-finger gesture.
|
|
9
|
+
*
|
|
10
|
+
* @param {TouchEvent} event Touch-move event.
|
|
11
|
+
*/
|
|
12
|
+
export function moveCameraTouch(event) {
|
|
13
|
+
const state = touchByContainer.get(this), { map, container, touch } = state;
|
|
14
|
+
if (!touch || event.touches.length !== 2) return;
|
|
15
|
+
const [a, b] = event.touches;
|
|
16
|
+
const angle = Math.atan2(b.clientY - a.clientY, b.clientX - a.clientX);
|
|
17
|
+
const rect = container.getBoundingClientRect(), middle = touch.currentMiddle;
|
|
18
|
+
middle.x = (a.clientX + b.clientX) / 2 - rect.left;
|
|
19
|
+
middle.y = (a.clientY + b.clientY) / 2 - rect.top;
|
|
20
|
+
const delta = Math.atan2(Math.sin(angle - touch.angle), Math.cos(angle - touch.angle)) * degrees;
|
|
21
|
+
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);
|
|
22
|
+
const distance = Math.hypot(b.clientX - a.clientX, b.clientY - a.clientY);
|
|
23
|
+
if (distance < 1) return;
|
|
24
|
+
const zoom = touch.zooming ? Math.max(map.getMinZoom(), Math.min(map.getMaxZoom(),
|
|
25
|
+
touch.zoom + Math.log2(distance / touch.distance))) : touch.zoom;
|
|
26
|
+
map.setView(map.getCenter(), zoom, /* alloc */ { animate: false });
|
|
27
|
+
if (map.options.touchZoom !== 'center') {
|
|
28
|
+
const projected = map.project(touch.anchor).subtract(map.project(map.containerPointToLatLng(middle)));
|
|
29
|
+
map.setView(map.unproject(map.project(map.getCenter()).add(projected)), map.getZoom(),
|
|
30
|
+
/* alloc */ { animate: false });
|
|
31
|
+
}
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.stopImmediatePropagation();
|
|
34
|
+
}
|