leaflet-city-mapper 0.0.2 → 0.0.3
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 +49 -3
- package/cucumber.mjs +1 -1
- package/dist/leaflet-city-mapper.js +3 -1
- package/dist/leaflet-city-mapper.js.map +4 -4
- package/package.json +2 -1
- package/src/archives/decodeDirectory.js +32 -0
- package/src/archives/decodeHeader.js +19 -0
- package/src/archives/getZxy.js +75 -0
- package/src/archives/loadDirectory.js +7 -0
- package/src/archives/tileId.js +19 -0
- package/src/archives/varint.js +15 -0
- package/src/camera/angles.js +6 -0
- package/src/camera/animationPoint.js +8 -0
- package/src/camera/cameraMapReady.js +8 -0
- package/src/camera/cancelCameraAnimation.js +11 -0
- package/src/camera/cleanupCameraMap.js +11 -0
- package/src/camera/constrainCameraToBounds.js +3 -0
- package/src/camera/displayPoint.js +3 -0
- package/src/camera/fitCameraBounds.js +48 -0
- package/src/camera/groundBounds.js +11 -0
- package/src/camera/initializeCameraMap.js +25 -0
- package/src/camera/mapAnimateCamera.js +17 -0
- package/src/camera/mapCamera.js +123 -0
- package/src/camera/mapContainerPointToLayerPoint.js +7 -0
- package/src/camera/mapGetBearing.js +1 -0
- package/src/camera/mapGetBounds.js +14 -0
- package/src/camera/mapGetBoundsCenterZoom.js +7 -0
- package/src/camera/mapGetBoundsZoom.js +14 -0
- package/src/camera/mapGetCenterLayerPoint.js +5 -0
- package/src/camera/mapGetPitch.js +1 -0
- package/src/camera/mapLayerPointToContainerPoint.js +7 -0
- package/src/camera/mapLimitCenter.js +12 -0
- package/src/camera/mapLimitOffset.js +10 -0
- package/src/camera/mapPanBy.js +9 -0
- package/src/camera/mapPanInside.js +14 -0
- package/src/camera/mapResetNorth.js +1 -0
- package/src/camera/mapResetNorthPitch.js +1 -0
- package/src/camera/mapSetBearing.js +1 -0
- package/src/camera/mapSetPitch.js +1 -0
- package/src/camera/mapSetPitchAndBearing.js +14 -0
- package/src/camera/mapSetZoomAround.js +11 -0
- package/src/camera/mapStopPitchBearingAnimation.js +6 -0
- package/src/camera/mapTryAnimatedPan.js +9 -0
- package/src/camera/mapUpdateCameraOverlays.js +7 -0
- package/src/camera/pointOf.js +3 -0
- package/src/camera/project.js +20 -0
- package/src/camera/runCameraAnimations.js +28 -0
- package/src/camera/scheduleCameraAnimation.js +8 -0
- package/src/camera/updateSky.js +16 -0
- package/src/camera/verticalGroundY.js +4 -0
- package/src/collision/collectMeshes.js +5 -0
- package/src/collision/collider.js +63 -0
- package/src/collision/intersectMeshes.js +133 -0
- package/src/collision/sortHits.js +23 -0
- package/src/constants/Compass.js +7 -0
- package/src/constants/ContainerResize.js +7 -0
- package/src/constants/HEIGHT.js +1 -0
- package/src/constants/PitchDrag.js +7 -0
- package/src/constants/ShiftRotate.js +7 -0
- package/src/constants/TILE_RADIUS.js +1 -0
- package/src/constants/TILE_SIZE.js +1 -0
- package/src/constants/TouchMode.js +6 -0
- package/src/constants/attachState.js +1 -0
- package/src/constants/cameraControlsState.js +1 -0
- package/src/constants/cityMapper.js +6 -0
- package/src/constants/dark.js +1 -0
- package/src/constants/elevationWGSL.js +27 -0
- package/src/constants/glass.js +1 -0
- package/src/constants/indexState.js +1 -0
- package/src/constants/mapCameraState.js +1 -0
- package/src/constants/nativeEventMaps.js +1 -0
- package/src/constants/nativeLayerState.js +1 -0
- package/src/constants/nativeMethodHandlers.js +31 -0
- package/src/constants/onMapChangeState.js +1 -0
- package/src/constants/onZoomAnimState.js +1 -0
- package/src/constants/parts.js +19 -0
- package/src/constants/pendingUpdates.js +1 -0
- package/src/constants/pumpState.js +1 -0
- package/src/constants/ringDirections.js +10 -0
- package/src/constants/roundProfile.js +1 -0
- package/src/constants/shirt.js +1 -0
- package/src/constants/skin.js +2 -0
- package/src/constants/trafficShader.js +49 -0
- package/src/constants/trousers.js +1 -0
- package/src/constants/tyre.js +1 -0
- package/src/constants/underEntryState.js +1 -0
- package/src/constants/vehicles.js +40 -0
- package/src/controls/acceptPitchDrag.js +4 -0
- package/src/controls/acceptRotateDrag.js +3 -0
- package/src/controls/adjustCameraDrag.js +10 -0
- package/src/controls/cameraControls.js +60 -0
- package/src/controls/cameraDragClick.js +9 -0
- package/src/controls/cameraDragContextMenu.js +8 -0
- package/src/controls/cameraDragDown.js +20 -0
- package/src/controls/cameraDragEnd.js +6 -0
- package/src/controls/cameraDragMove.js +23 -0
- package/src/controls/changeCameraTouch.js +14 -0
- package/src/controls/cleanupCameraTouch.js +24 -0
- package/src/controls/compassAddHooks.js +15 -0
- package/src/controls/compassOrientation.js +6 -0
- package/src/controls/compassRemoveHooks.js +5 -0
- package/src/controls/containerResizeAddHooks.js +8 -0
- package/src/controls/containerResizeRemoveHooks.js +5 -0
- package/src/controls/dragCamera.js +22 -0
- package/src/controls/editable.js +3 -0
- package/src/controls/endAllCameraDrags.js +7 -0
- package/src/controls/endAllCameraTouches.js +7 -0
- package/src/controls/endCameraTouch.js +11 -0
- package/src/controls/endCameraTouchEvent.js +5 -0
- package/src/controls/finishCameraDrag.js +9 -0
- package/src/controls/finishCompassPermission.js +16 -0
- package/src/controls/loadCameraControls.js +9 -0
- package/src/controls/moveCameraTouch.js +22 -0
- package/src/controls/notifyCameraTouchChange.js +1 -0
- package/src/controls/pitchDragAddHooks.js +6 -0
- package/src/controls/pitchDragRemoveHooks.js +5 -0
- package/src/controls/refreshRotateControl.js +7 -0
- package/src/controls/refreshRotateFocus.js +5 -0
- package/src/controls/removeCameraDrag.js +23 -0
- package/src/controls/resizeMap.js +3 -0
- package/src/controls/rotateButtonClick.js +7 -0
- package/src/controls/rotateButtonKeydown.js +11 -0
- package/src/controls/rotateControl.js +3 -0
- package/src/controls/rotateOnAdd.js +38 -0
- package/src/controls/rotateOnRemove.js +6 -0
- package/src/controls/shiftRotateAddHooks.js +8 -0
- package/src/controls/shiftRotateRemoveHooks.js +5 -0
- package/src/controls/shiftRotateWheel.js +9 -0
- package/src/controls/startCameraTouch.js +23 -0
- package/src/core/addImageState.js +7 -0
- package/src/core/addRasterImage.js +10 -0
- package/src/core/adjustCameraMarkerPan.js +22 -0
- package/src/core/beforeNativeRender.js +10 -0
- package/src/core/boundsQuad.js +11 -0
- package/src/core/bringNativeLayerToBack.js +3 -0
- package/src/core/bringNativeLayerToFront.js +3 -0
- package/src/core/cameraCircleBounds.js +6 -0
- package/src/core/cameraMarkerDrag.js +18 -0
- package/src/core/cameraMarkerOnDrag.js +8 -0
- package/src/core/cancelGridFade.js +10 -0
- package/src/core/closestCameraLayerPoint.js +7 -0
- package/src/core/compareNativeHits.js +3 -0
- package/src/core/current.js +3 -0
- package/src/core/disposeNativeLayer.js +35 -0
- package/src/core/fireRasterLoad.js +5 -0
- package/src/core/forwardNativeError.js +3 -0
- package/src/core/gridlayerGetEvents.js +7 -0
- package/src/core/gridlayerGetTiledPixelBounds.js +8 -0
- package/src/core/handleNativeMapEvent.js +47 -0
- package/src/core/hideTargets.js +16 -0
- package/src/core/initNativeGPU.js +21 -0
- package/src/core/initializeGridContainer.js +6 -0
- package/src/core/initializeNativeLayer.js +42 -0
- package/src/core/localPixel.js +5 -0
- package/src/core/localPixelForGeometry.js +6 -0
- package/src/core/localPosition.js +6 -0
- package/src/core/markerCameraIconPoint.js +9 -0
- package/src/core/markerGetEvents.js +5 -0
- package/src/core/markerInitInteraction.js +8 -0
- package/src/core/markerQuadCorners.js +31 -0
- package/src/core/markerSetIcon.js +9 -0
- package/src/core/markerSetPos.js +14 -0
- package/src/core/markerSetRotation.js +7 -0
- package/src/core/markerUpdateZIndex.js +8 -0
- package/src/core/nativeAddLatLng.js +3 -0
- package/src/core/nativeBringToBack.js +3 -0
- package/src/core/nativeBringToFront.js +3 -0
- package/src/core/nativeEvents.js +26 -0
- package/src/core/nativeImageError.js +8 -0
- package/src/core/nativeImageRefresh.js +7 -0
- package/src/core/nativeLayer.js +97 -0
- package/src/core/nativeLayerMethod.js +21 -0
- package/src/core/nativeRedraw.js +3 -0
- package/src/core/nativeSetBounds.js +3 -0
- package/src/core/nativeSetIcon.js +3 -0
- package/src/core/nativeSetLatLng.js +3 -0
- package/src/core/nativeSetLatLngs.js +3 -0
- package/src/core/nativeSetOpacity.js +3 -0
- package/src/core/nativeSetRadius.js +3 -0
- package/src/core/nativeSetStyle.js +3 -0
- package/src/core/nativeSetUrl.js +3 -0
- package/src/core/nativeSetZIndex.js +3 -0
- package/src/core/nativeSetZIndexOffset.js +3 -0
- package/src/core/popupAdjustPan.js +23 -0
- package/src/core/popupGetEvents.js +5 -0
- package/src/core/popupUpdatePosition.js +14 -0
- package/src/core/putNativeMesh.js +33 -0
- package/src/core/quadNativeMesh.js +15 -0
- package/src/core/readyNativeGPU.js +6 -0
- package/src/core/refreshNativeEvent.js +5 -0
- package/src/core/refreshNativeLayer.js +29 -0
- package/src/core/refreshNativeLayerContract.js +3 -0
- package/src/core/rejectNativeReady.js +3 -0
- package/src/core/removeImageState.js +8 -0
- package/src/core/removeNativeEvents.js +16 -0
- package/src/core/removeTargets.js +8 -0
- package/src/core/reorderNativeLayer.js +6 -0
- package/src/core/resolveNativeReady.js +3 -0
- package/src/core/restoreNativeEvents.js +6 -0
- package/src/core/runGridFades.js +14 -0
- package/src/core/runMarkerPanFrame.js +12 -0
- package/src/core/scheduleGridFade.js +9 -0
- package/src/core/scheduleMarkerPan.js +8 -0
- package/src/core/styleNativeMesh.js +10 -0
- package/src/core/syncGridLayer.js +22 -0
- package/src/core/syncImageOverlay.js +9 -0
- package/src/core/syncMarker.js +12 -0
- package/src/core/syncVectorLayer.js +26 -0
- package/src/core/synchronizeNativeLayer.js +35 -0
- package/src/core/textureFor.js +48 -0
- package/src/core/tooltipGetEvents.js +5 -0
- package/src/core/tooltipSetPosition.js +8 -0
- package/src/core/updateGridOpacity.js +23 -0
- package/src/core/updateNativeLayerView.js +6 -0
- package/src/core/uploadCanvasTexture.js +19 -0
- package/src/geometry/addBridges.js +88 -0
- package/src/geometry/below.js +3 -0
- package/src/geometry/box.js +3 -0
- package/src/geometry/bridgeElevation.js +19 -0
- package/src/geometry/bridgeLocal.js +4 -0
- package/src/geometry/build.js +19 -0
- package/src/geometry/circleAt.js +5 -0
- package/src/geometry/clipLine.js +23 -0
- package/src/geometry/clipSegment.js +19 -0
- package/src/geometry/computeBounds.js +33 -0
- package/src/geometry/conformModelToTerrain.js +67 -0
- package/src/geometry/cross.js +3 -0
- package/src/geometry/disk.js +11 -0
- package/src/geometry/diskAt.js +4 -0
- package/src/geometry/dot.js +6 -0
- package/src/geometry/emitter.js +8 -0
- package/src/geometry/lampPostGeometry.js +24 -0
- package/src/geometry/lampRing.js +11 -0
- package/src/geometry/lightGeometry.js +15 -0
- package/src/geometry/line.js +54 -0
- package/src/geometry/nativeGeometry.js +55 -0
- package/src/geometry/nativeTriangle.js +3 -0
- package/src/geometry/polygon.js +22 -0
- package/src/geometry/push.js +3 -0
- package/src/geometry/quad.js +4 -0
- package/src/geometry/roofCoverage.js +52 -0
- package/src/geometry/samePoint.js +3 -0
- package/src/geometry/segment.js +21 -0
- package/src/geometry/setVertexColor.js +15 -0
- package/src/geometry/sub.js +6 -0
- package/src/geometry/surface.js +17 -0
- package/src/geometry/treeGeometry.js +31 -0
- package/src/geometry/treeRing.js +14 -0
- package/src/geometry/triangle.js +12 -0
- package/src/geometry/vertexNormals.js +32 -0
- package/src/geometry/visit.js +9 -0
- package/src/index.js +41 -323
- package/src/lighting/cacheLightGrid.js +23 -0
- package/src/lighting/collectLightMeshes.js +6 -0
- package/src/lighting/lightGrid.js +42 -0
- package/src/lighting/updatePointLights.js +34 -0
- package/src/lighting/visitCells.js +15 -0
- package/src/lighting/worldLights.js +27 -0
- package/src/models/decodeModel.js +45 -0
- package/src/models/hasUnsupportedPrimitives.js +10 -0
- package/src/models/loadBuffer.js +6 -0
- package/src/models/loadImage.js +15 -0
- package/src/models/loadModel.js +69 -0
- package/src/models/materialFor.js +21 -0
- package/src/models/modelNode.js +93 -0
- package/src/models/readAccessor.js +53 -0
- package/src/models/readAccessorValues.js +16 -0
- package/src/models/textureFor.js +35 -0
- package/src/picking/collectVisibleMesh.js +4 -0
- package/src/picking/findFeature.js +49 -0
- package/src/picking/hit.js +23 -0
- package/src/picking/hitMesh.js +30 -0
- package/src/picking/pointerClick.js +5 -0
- package/src/picking/pointerLeave.js +5 -0
- package/src/picking/pointerMove.js +5 -0
- package/src/picking/raycast.js +59 -0
- package/src/picking/setHighlight.js +13 -0
- package/src/picking/shouldSkipOther.js +3 -0
- package/src/picking/showFeature.js +34 -0
- package/src/raster/addRasterTile.js +114 -0
- package/src/raster/comparePendingTiles.js +5 -0
- package/src/raster/createGeometry.js +22 -0
- package/src/raster/createRasterMesh.js +47 -0
- package/src/raster/finishAttachment.js +11 -0
- package/src/raster/finishRasterTile.js +47 -0
- package/src/raster/getRasterEvents.js +6 -0
- package/src/raster/getRasterTileSize.js +5 -0
- package/src/raster/initRaster.js +38 -0
- package/src/raster/isLoading.js +5 -0
- package/src/raster/loadRasterTile.js +10 -0
- package/src/raster/onPMTileAdd.js +10 -0
- package/src/raster/onPMTileRemove.js +8 -0
- package/src/raster/pruneRasterTiles.js +37 -0
- package/src/raster/pumpRasterTiles.js +22 -0
- package/src/raster/readyRaster.js +13 -0
- package/src/raster/registerTerrainTile.js +12 -0
- package/src/raster/releaseRasterTile.js +18 -0
- package/src/raster/releaseRasterTiles.js +15 -0
- package/src/raster/removeRasterTile.js +13 -0
- package/src/raster/reportError.js +6 -0
- package/src/raster/setPMTileOpacity.js +7 -0
- package/src/raster/setPMTileZIndex.js +7 -0
- package/src/raster/setRasterOpacity.js +11 -0
- package/src/raster/setRasterTerrain.js +21 -0
- package/src/raster/setRasterZIndex.js +11 -0
- package/src/raster/updateAttachedTiles.js +10 -0
- package/src/raster/updateRasterTiles.js +59 -0
- package/src/rendering/collectFrameMeshes.js +31 -0
- package/src/rendering/collectMeshes.js +36 -0
- package/src/rendering/compareMeshes.js +10 -0
- package/src/rendering/compareRoofTiles.js +4 -0
- package/src/rendering/composeRoofAtlas.js +52 -0
- package/src/rendering/createMesh.js +33 -0
- package/src/rendering/createProgram.js +92 -0
- package/src/rendering/destroyAfterSubmission.js +8 -0
- package/src/rendering/destroyTexture.js +6 -0
- package/src/rendering/disposeMesh.js +14 -0
- package/src/rendering/drawGeometry.js +129 -0
- package/src/rendering/drawSceneMeshes.js +51 -0
- package/src/rendering/ensureRoofBlit.js +40 -0
- package/src/rendering/prepareFrameMeshes.js +42 -0
- package/src/rendering/prepareFrameUniforms.js +49 -0
- package/src/rendering/rebuildRoofAtlas.js +67 -0
- package/src/rendering/render.js +57 -0
- package/src/rendering/reportCompilation.js +17 -0
- package/src/rendering/resizeRenderer.js +19 -0
- package/src/rendering/sortMeshes.js +6 -0
- package/src/rendering/synchronizeZoomView.js +34 -0
- package/src/rendering/textureBinding.js +7 -0
- package/src/rendering/updateMapCamera.js +32 -0
- package/src/rendering/updateRoofRaster.js +32 -0
- package/src/scene/attach.js +161 -0
- package/src/scene/attachLayer.js +10 -0
- package/src/scene/cancelUpdate.js +10 -0
- package/src/scene/emptyEvents.js +3 -0
- package/src/scene/emptyNode.js +11 -0
- package/src/scene/endZoom.js +16 -0
- package/src/scene/failAttachment.js +9 -0
- package/src/scene/get3DEvents.js +13 -0
- package/src/scene/init3D.js +30 -0
- package/src/scene/initializeLayer.js +16 -0
- package/src/scene/initializerFor.js +14 -0
- package/src/scene/layerInitialize.js +38 -0
- package/src/scene/layerLayerAdd.js +21 -0
- package/src/scene/onAdd3DLayer.js +35 -0
- package/src/scene/onMapChange.js +16 -0
- package/src/scene/onRemove3DLayer.js +69 -0
- package/src/scene/onZoomAnim.js +16 -0
- package/src/scene/placeEntry.js +11 -0
- package/src/scene/placeUnderEntry.js +8 -0
- package/src/scene/ready3D.js +25 -0
- package/src/scene/releaseRenderer.js +14 -0
- package/src/scene/removeEntry.js +6 -0
- package/src/scene/renderPendingMapChange.js +11 -0
- package/src/scene/renderPendingUpdates.js +19 -0
- package/src/scene/renderPendingZoomAnimation.js +7 -0
- package/src/scene/rendererDeviceError.js +10 -0
- package/src/scene/rendererDeviceLost.js +11 -0
- package/src/scene/replaceEntry.js +7 -0
- package/src/scene/reportError.js +3 -0
- package/src/scene/requestAdapter.js +12 -0
- package/src/scene/requestDevice.js +9 -0
- package/src/scene/resolveNextInitialization.js +12 -0
- package/src/scene/restoreObject.js +71 -0
- package/src/scene/runPlacements.js +7 -0
- package/src/scene/showWebGPUWarning.js +16 -0
- package/src/scene/traverse.js +7 -0
- package/src/scene/underEntry.js +17 -0
- package/src/scene/update.js +19 -0
- package/src/scene/updateCamera.js +34 -0
- package/src/scene/updateWorldMatrix.js +48 -0
- package/src/shaders/materialShaders.js +246 -0
- package/src/shadows/bindSunlight.js +12 -0
- package/src/shadows/drawShadowMeshes.js +48 -0
- package/src/shadows/ensureShadowPipeline.js +53 -0
- package/src/shadows/renderSunlight.js +46 -0
- package/src/shadows/resizeSunlight.js +15 -0
- package/src/shadows/shadowBounds.js +32 -0
- package/src/shadows/shadowCacheMatches.js +23 -0
- package/src/shadows/shadowMatrix.js +39 -0
- package/src/sources/addGeneratedTriangle.js +6 -0
- package/src/sources/addTriangle.js +17 -0
- package/src/sources/attachAreaMesh.js +58 -0
- package/src/sources/buildArea.js +42 -0
- package/src/sources/buildAreaFeature.js +41 -0
- package/src/sources/buildAreaPoint.js +25 -0
- package/src/sources/buildAreaPolygon.js +29 -0
- package/src/sources/compareAreaDistance.js +4 -0
- package/src/sources/generateTreeGeometry.js +11 -0
- package/src/sources/groundOffset.js +3 -0
- package/src/sources/initializeGeoJSON.js +8 -0
- package/src/sources/instanceAreaGeometry.js +29 -0
- package/src/sources/projectRing.js +20 -0
- package/src/sources/projectedTree.js +13 -0
- package/src/sources/pump.js +54 -0
- package/src/sources/releaseArea.js +22 -0
- package/src/sources/setGeoJSONData.js +12 -0
- package/src/sources/setGeoJSONLayerData.js +5 -0
- package/src/sources/sourceAreaContext.js +9 -0
- package/src/sources/updateArea.js +45 -0
- package/src/sources/updateStatus.js +12 -0
- package/src/sunlight/addTimeLayer.js +3 -0
- package/src/sunlight/addTo.js +10 -0
- package/src/sunlight/atmosphere.js +28 -0
- package/src/sunlight/initSunlight.js +14 -0
- package/src/sunlight/initialize.js +11 -0
- package/src/sunlight/mix.js +6 -0
- package/src/sunlight/onAdd.js +5 -0
- package/src/sunlight/onAddSun.js +66 -0
- package/src/sunlight/remove.js +7 -0
- package/src/sunlight/removeSun.js +15 -0
- package/src/sunlight/removeTimeLayer.js +3 -0
- package/src/sunlight/render.js +7 -0
- package/src/sunlight/rgb.js +6 -0
- package/src/sunlight/styleTimeControl.js +7 -0
- package/src/sunlight/tickSun.js +5 -0
- package/src/sunlight/updateSky.js +20 -0
- package/src/sunlight/updateSun.js +34 -0
- package/src/sunlight/useLiveTime.js +6 -0
- package/src/sunlight/useSelectedTime.js +20 -0
- package/src/terrain/clearLayerTerrain.js +5 -0
- package/src/terrain/getElevation.js +10 -0
- package/src/terrain/initTerrain.js +20 -0
- package/src/terrain/loadReadyTerrain.js +5 -0
- package/src/terrain/loadTerrain.js +63 -0
- package/src/terrain/loadTerrainTiles.js +13 -0
- package/src/terrain/onTerrainAdd.js +21 -0
- package/src/terrain/onTerrainChange.js +14 -0
- package/src/terrain/onTerrainRemove.js +41 -0
- package/src/terrain/readBridges.js +4 -0
- package/src/terrain/sample.js +7 -0
- package/src/terrain/setLayerTerrain.js +5 -0
- package/src/terrain/terrainAtlas.js +23 -0
- package/src/terrain/terrainElevation.js +20 -0
- package/src/terrain/terrainGrid.js +24 -0
- package/src/traffic/addTraffic.js +7 -0
- package/src/traffic/along.js +14 -0
- package/src/traffic/clockMinutes.js +6 -0
- package/src/traffic/compareDepartures.js +5 -0
- package/src/traffic/createTrafficMesh.js +7 -0
- package/src/traffic/destroyTrafficGpu.js +5 -0
- package/src/traffic/disposeTrafficObject.js +13 -0
- package/src/traffic/drawTrafficRoute.js +6 -0
- package/src/traffic/failTraffic.js +6 -0
- package/src/traffic/failedTrafficLoad.js +5 -0
- package/src/traffic/fetchTrafficLanes.js +10 -0
- package/src/traffic/groundTraffic.js +15 -0
- package/src/traffic/initTraffic.js +54 -0
- package/src/traffic/loadTraffic.js +15 -0
- package/src/traffic/loadedTrafficLanes.js +16 -0
- package/src/traffic/locateTraffic.js +9 -0
- package/src/traffic/moveTraffic.js +15 -0
- package/src/traffic/placeTraffic.js +21 -0
- package/src/traffic/prepareTraffic.js +25 -0
- package/src/traffic/readyTraffic.js +6 -0
- package/src/traffic/rebaseTraffic.js +58 -0
- package/src/traffic/rebuildTrafficMesh.js +28 -0
- package/src/traffic/removeTraffic.js +17 -0
- package/src/traffic/routeColor.js +6 -0
- package/src/traffic/routeGeometry.js +31 -0
- package/src/traffic/scheduledTrips.js +40 -0
- package/src/traffic/startTraffic.js +8 -0
- package/src/traffic/tickTraffic.js +57 -0
- package/src/traffic/toLanes.js +16 -0
- package/src/traffic/tooltip.js +11 -0
- package/src/traffic/trafficBounds.js +17 -0
- package/src/traffic/trafficNow.js +4 -0
- package/src/traffic/trafficStorage.js +5 -0
- package/src/traffic/tripsAt.js +27 -0
- package/src/traffic/updateTraffic.js +8 -0
- package/src/traffic/updateTrafficTerrain.js +12 -0
- package/src/traffic/vehicleOffsets.js +11 -0
- package/src/triangulation/area.js +9 -0
- package/src/triangulation/clean.js +18 -0
- package/src/triangulation/containsVertex.js +11 -0
- package/src/triangulation/cross.js +3 -0
- package/src/triangulation/crossesBoundary.js +8 -0
- package/src/triangulation/crossesRing.js +9 -0
- package/src/triangulation/equal.js +3 -0
- package/src/triangulation/inside.js +10 -0
- package/src/triangulation/insideHole.js +7 -0
- package/src/triangulation/intersects.js +11 -0
- package/src/triangulation/isClockWise.js +13 -0
- package/src/triangulation/minimumX.js +6 -0
- package/src/triangulation/on.js +4 -0
- package/src/triangulation/sortHoles.js +26 -0
- package/src/triangulation/triangulate.js +86 -0
- package/src/utils/channel.js +2 -2
- package/src/utils/compareDistance.js +3 -0
- package/src/utils/noOperation.js +1 -0
- package/src/utils/toSRGB.js +3 -1
- package/src/utils/wrap.js +3 -1
- package/src/vehicles/bicycleModel.js +23 -0
- package/src/vehicles/boatBenches.js +8 -0
- package/src/vehicles/boatModel.js +27 -0
- package/src/vehicles/busModel.js +6 -0
- package/src/vehicles/carModel.js +22 -0
- package/src/vehicles/carriage.js +19 -0
- package/src/vehicles/metroModel.js +9 -0
- package/src/vehicles/mirror.js +8 -0
- package/src/vehicles/pedestrianModel.js +17 -0
- package/src/vehicles/tramModel.js +9 -0
- package/src/walk/blocked.js +6 -0
- package/src/walk/createWalk.js +60 -0
- package/src/walk/initWalk.js +18 -0
- package/src/walk/initialize.js +6 -0
- package/src/walk/local.js +10 -0
- package/src/walk/onAdd.js +4 -0
- package/src/walk/onBlur.js +3 -0
- package/src/walk/onKey.js +12 -0
- package/src/walk/onPointer.js +13 -0
- package/src/walk/onRemove.js +4 -0
- package/src/walk/onTerrain.js +5 -0
- package/src/walk/place.js +18 -0
- package/src/walk/start.js +37 -0
- package/src/walk/step.js +53 -0
- package/src/walk/stop.js +27 -0
- package/src/walk/toggle.js +6 -0
- package/dist/utils/CELL.js +0 -2
- package/dist/utils/CELL.js.map +0 -7
- package/dist/utils/addBridges.js +0 -2
- package/dist/utils/addBridges.js.map +0 -7
- package/dist/utils/addRasterTile.js +0 -2
- package/dist/utils/addRasterTile.js.map +0 -7
- package/dist/utils/along.js +0 -2
- package/dist/utils/along.js.map +0 -7
- package/dist/utils/atmosphere.js +0 -2
- package/dist/utils/atmosphere.js.map +0 -7
- package/dist/utils/attach.js +0 -2
- package/dist/utils/attach.js.map +0 -7
- package/dist/utils/bindSunlight.js +0 -2
- package/dist/utils/bindSunlight.js.map +0 -7
- package/dist/utils/box.js +0 -2
- package/dist/utils/box.js.map +0 -7
- package/dist/utils/bridgeElevation.js +0 -2
- package/dist/utils/bridgeElevation.js.map +0 -7
- package/dist/utils/build.js +0 -2
- package/dist/utils/build.js.map +0 -7
- package/dist/utils/cameraControls.js +0 -2
- package/dist/utils/cameraControls.js.map +0 -7
- package/dist/utils/channel.js +0 -2
- package/dist/utils/channel.js.map +0 -7
- package/dist/utils/collider.js +0 -2
- package/dist/utils/collider.js.map +0 -7
- package/dist/utils/colliders.js +0 -2
- package/dist/utils/colliders.js.map +0 -7
- package/dist/utils/computeBounds.js +0 -2
- package/dist/utils/computeBounds.js.map +0 -7
- package/dist/utils/conformModelToTerrain.js +0 -2
- package/dist/utils/conformModelToTerrain.js.map +0 -7
- package/dist/utils/createMesh.js +0 -2
- package/dist/utils/createMesh.js.map +0 -7
- package/dist/utils/createProgram.js +0 -3
- package/dist/utils/createProgram.js.map +0 -7
- package/dist/utils/decodeDirectory.js +0 -2
- package/dist/utils/decodeDirectory.js.map +0 -7
- package/dist/utils/decodeHeader.js +0 -2
- package/dist/utils/decodeHeader.js.map +0 -7
- package/dist/utils/decodeModel.js +0 -2
- package/dist/utils/decodeModel.js.map +0 -7
- package/dist/utils/decompress.js +0 -2
- package/dist/utils/decompress.js.map +0 -7
- package/dist/utils/destroyTexture.js +0 -2
- package/dist/utils/destroyTexture.js.map +0 -7
- package/dist/utils/disposeMesh.js +0 -2
- package/dist/utils/disposeMesh.js.map +0 -7
- package/dist/utils/drawGeometry.js +0 -2
- package/dist/utils/drawGeometry.js.map +0 -7
- package/dist/utils/elevationWGSL.js +0 -24
- package/dist/utils/elevationWGSL.js.map +0 -7
- package/dist/utils/emptyNode.js +0 -2
- package/dist/utils/emptyNode.js.map +0 -7
- package/dist/utils/endZoom.js +0 -2
- package/dist/utils/endZoom.js.map +0 -7
- package/dist/utils/findFeature.js +0 -2
- package/dist/utils/findFeature.js.map +0 -7
- package/dist/utils/geometry.js +0 -1
- package/dist/utils/geometry.js.map +0 -7
- package/dist/utils/getElevation.js +0 -2
- package/dist/utils/getElevation.js.map +0 -7
- package/dist/utils/getHeader.js +0 -2
- package/dist/utils/getHeader.js.map +0 -7
- package/dist/utils/getZxy.js +0 -2
- package/dist/utils/getZxy.js.map +0 -7
- package/dist/utils/glass.js +0 -2
- package/dist/utils/glass.js.map +0 -7
- package/dist/utils/headlight.js +0 -2
- package/dist/utils/headlight.js.map +0 -7
- package/dist/utils/hit.js +0 -2
- package/dist/utils/hit.js.map +0 -7
- package/dist/utils/horizontalPosition.js +0 -2
- package/dist/utils/horizontalPosition.js.map +0 -7
- package/dist/utils/horizontalRay.js +0 -2
- package/dist/utils/horizontalRay.js.map +0 -7
- package/dist/utils/hull.js +0 -2
- package/dist/utils/hull.js.map +0 -7
- package/dist/utils/initSunlight.js +0 -2
- package/dist/utils/initSunlight.js.map +0 -7
- package/dist/utils/initTerrain.js +0 -2
- package/dist/utils/initTerrain.js.map +0 -7
- package/dist/utils/initTraffic.js +0 -40
- package/dist/utils/initTraffic.js.map +0 -7
- package/dist/utils/initWalk.js +0 -2
- package/dist/utils/initWalk.js.map +0 -7
- package/dist/utils/intersectMeshes.js +0 -2
- package/dist/utils/intersectMeshes.js.map +0 -7
- package/dist/utils/isClockWise.js +0 -2
- package/dist/utils/isClockWise.js.map +0 -7
- package/dist/utils/lampPostGeometry.js +0 -2
- package/dist/utils/lampPostGeometry.js.map +0 -7
- package/dist/utils/lightGeometry.js +0 -2
- package/dist/utils/lightGeometry.js.map +0 -7
- package/dist/utils/lightGrid.js +0 -2
- package/dist/utils/lightGrid.js.map +0 -7
- package/dist/utils/limbs.js +0 -2
- package/dist/utils/limbs.js.map +0 -7
- package/dist/utils/loadModel.js +0 -2
- package/dist/utils/loadModel.js.map +0 -7
- package/dist/utils/loadSource.js +0 -2
- package/dist/utils/loadSource.js.map +0 -7
- package/dist/utils/loadTerrain.js +0 -2
- package/dist/utils/loadTerrain.js.map +0 -7
- package/dist/utils/mapCamera.js +0 -2
- package/dist/utils/mapCamera.js.map +0 -7
- package/dist/utils/materialShaders.js +0 -211
- package/dist/utils/materialShaders.js.map +0 -7
- package/dist/utils/mirror.js +0 -2
- package/dist/utils/mirror.js.map +0 -7
- package/dist/utils/moonPosition.js +0 -2
- package/dist/utils/moonPosition.js.map +0 -7
- package/dist/utils/moves.js +0 -2
- package/dist/utils/moves.js.map +0 -7
- package/dist/utils/nativeEvents.js +0 -2
- package/dist/utils/nativeEvents.js.map +0 -7
- package/dist/utils/nativeGeometry.js +0 -2
- package/dist/utils/nativeGeometry.js.map +0 -7
- package/dist/utils/nativeLayer.js +0 -2
- package/dist/utils/nativeLayer.js.map +0 -7
- package/dist/utils/nodeMatrix.js +0 -2
- package/dist/utils/nodeMatrix.js.map +0 -7
- package/dist/utils/onAdd3DLayer.js +0 -2
- package/dist/utils/onAdd3DLayer.js.map +0 -7
- package/dist/utils/onAddSun.js +0 -2
- package/dist/utils/onAddSun.js.map +0 -7
- package/dist/utils/onClick.js +0 -2
- package/dist/utils/onClick.js.map +0 -7
- package/dist/utils/onMapChange.js +0 -2
- package/dist/utils/onMapChange.js.map +0 -7
- package/dist/utils/onPMTileAdd.js +0 -2
- package/dist/utils/onPMTileAdd.js.map +0 -7
- package/dist/utils/onPMTileRemove.js +0 -2
- package/dist/utils/onPMTileRemove.js.map +0 -7
- package/dist/utils/onPointerLeave.js +0 -2
- package/dist/utils/onPointerLeave.js.map +0 -7
- package/dist/utils/onPointerMove.js +0 -2
- package/dist/utils/onPointerMove.js.map +0 -7
- package/dist/utils/onRemove3DLayer.js +0 -2
- package/dist/utils/onRemove3DLayer.js.map +0 -7
- package/dist/utils/onRemoveSun.js +0 -2
- package/dist/utils/onRemoveSun.js.map +0 -7
- package/dist/utils/onTerrainAdd.js +0 -2
- package/dist/utils/onTerrainAdd.js.map +0 -7
- package/dist/utils/onTerrainChange.js +0 -2
- package/dist/utils/onTerrainChange.js.map +0 -7
- package/dist/utils/onTerrainRemove.js +0 -2
- package/dist/utils/onTerrainRemove.js.map +0 -7
- package/dist/utils/onZoomAnim.js +0 -2
- package/dist/utils/onZoomAnim.js.map +0 -7
- package/dist/utils/paints.js +0 -2
- package/dist/utils/paints.js.map +0 -7
- package/dist/utils/parseColor.js +0 -2
- package/dist/utils/parseColor.js.map +0 -7
- package/dist/utils/parts.js +0 -2
- package/dist/utils/parts.js.map +0 -7
- package/dist/utils/projectCelestialBody.js +0 -2
- package/dist/utils/projectCelestialBody.js.map +0 -7
- package/dist/utils/pump.js +0 -2
- package/dist/utils/pump.js.map +0 -7
- package/dist/utils/rasterTiles.js +0 -2
- package/dist/utils/rasterTiles.js.map +0 -7
- package/dist/utils/raycast.js +0 -2
- package/dist/utils/raycast.js.map +0 -7
- package/dist/utils/read.js +0 -2
- package/dist/utils/read.js.map +0 -7
- package/dist/utils/readAccessor.js +0 -2
- package/dist/utils/readAccessor.js.map +0 -7
- package/dist/utils/releaseArea.js +0 -2
- package/dist/utils/releaseArea.js.map +0 -7
- package/dist/utils/removeRasterTile.js +0 -2
- package/dist/utils/removeRasterTile.js.map +0 -7
- package/dist/utils/render.js +0 -15
- package/dist/utils/render.js.map +0 -7
- package/dist/utils/renderSunlight.js +0 -13
- package/dist/utils/renderSunlight.js.map +0 -7
- package/dist/utils/renderers.js +0 -2
- package/dist/utils/renderers.js.map +0 -7
- package/dist/utils/resizeSunlight.js +0 -2
- package/dist/utils/resizeSunlight.js.map +0 -7
- package/dist/utils/roofCoverage.js +0 -2
- package/dist/utils/roofCoverage.js.map +0 -7
- package/dist/utils/routeGeometry.js +0 -2
- package/dist/utils/routeGeometry.js.map +0 -7
- package/dist/utils/scheduledTrips.js +0 -2
- package/dist/utils/scheduledTrips.js.map +0 -7
- package/dist/utils/setGeoJSONData.js +0 -2
- package/dist/utils/setGeoJSONData.js.map +0 -7
- package/dist/utils/setHighlight.js +0 -2
- package/dist/utils/setHighlight.js.map +0 -7
- package/dist/utils/setPMTileOpacity.js +0 -2
- package/dist/utils/setPMTileOpacity.js.map +0 -7
- package/dist/utils/setPMTileZIndex.js +0 -2
- package/dist/utils/setPMTileZIndex.js.map +0 -7
- package/dist/utils/setParent.js +0 -2
- package/dist/utils/setParent.js.map +0 -7
- package/dist/utils/setTerrainHeight.js +0 -2
- package/dist/utils/setTerrainHeight.js.map +0 -7
- package/dist/utils/setVertexColor.js +0 -2
- package/dist/utils/setVertexColor.js.map +0 -7
- package/dist/utils/showFeature.js +0 -2
- package/dist/utils/showFeature.js.map +0 -7
- package/dist/utils/sizes.js +0 -2
- package/dist/utils/sizes.js.map +0 -7
- package/dist/utils/skin.js +0 -2
- package/dist/utils/skin.js.map +0 -7
- package/dist/utils/solarPosition.js +0 -2
- package/dist/utils/solarPosition.js.map +0 -7
- package/dist/utils/sortMeshes.js +0 -2
- package/dist/utils/sortMeshes.js.map +0 -7
- package/dist/utils/speed.js +0 -2
- package/dist/utils/speed.js.map +0 -7
- package/dist/utils/startZoom.js +0 -2
- package/dist/utils/startZoom.js.map +0 -7
- package/dist/utils/taillight.js +0 -2
- package/dist/utils/taillight.js.map +0 -7
- package/dist/utils/terrainAtlas.js +0 -2
- package/dist/utils/terrainAtlas.js.map +0 -7
- package/dist/utils/terrainElevation.js +0 -2
- package/dist/utils/terrainElevation.js.map +0 -7
- package/dist/utils/terrainGrid.js +0 -2
- package/dist/utils/terrainGrid.js.map +0 -7
- package/dist/utils/textureSampler.js +0 -2
- package/dist/utils/textureSampler.js.map +0 -7
- package/dist/utils/tileId.js +0 -2
- package/dist/utils/tileId.js.map +0 -7
- package/dist/utils/toLanes.js +0 -2
- package/dist/utils/toLanes.js.map +0 -7
- package/dist/utils/toSRGB.js +0 -2
- package/dist/utils/toSRGB.js.map +0 -7
- package/dist/utils/tooltip.js +0 -3
- package/dist/utils/tooltip.js.map +0 -7
- package/dist/utils/traffic.js +0 -2
- package/dist/utils/traffic.js.map +0 -7
- package/dist/utils/traverse.js +0 -2
- package/dist/utils/traverse.js.map +0 -7
- package/dist/utils/treeGeometry.js +0 -2
- package/dist/utils/treeGeometry.js.map +0 -7
- package/dist/utils/triangulate.js +0 -2
- package/dist/utils/triangulate.js.map +0 -7
- package/dist/utils/tripsAt.js +0 -2
- package/dist/utils/tripsAt.js.map +0 -7
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.js.map +0 -7
- package/dist/utils/underEntry.js +0 -2
- package/dist/utils/underEntry.js.map +0 -7
- package/dist/utils/update.js +0 -2
- package/dist/utils/update.js.map +0 -7
- package/dist/utils/updateArea.js +0 -2
- package/dist/utils/updateArea.js.map +0 -7
- package/dist/utils/updateCamera.js +0 -2
- package/dist/utils/updateCamera.js.map +0 -7
- package/dist/utils/updatePointLights.js +0 -2
- package/dist/utils/updatePointLights.js.map +0 -7
- package/dist/utils/updateWorldMatrix.js +0 -2
- package/dist/utils/updateWorldMatrix.js.map +0 -7
- package/dist/utils/vehicleOffsets.js +0 -2
- package/dist/utils/vehicleOffsets.js.map +0 -7
- package/dist/utils/vehicles.js +0 -2
- package/dist/utils/vehicles.js.map +0 -7
- package/dist/utils/vertexNormals.js +0 -2
- package/dist/utils/vertexNormals.js.map +0 -7
- package/dist/utils/walk.js +0 -2
- package/dist/utils/walk.js.map +0 -7
- package/dist/utils/white.js +0 -2
- package/dist/utils/white.js.map +0 -7
- package/dist/utils/worldLights.js +0 -2
- package/dist/utils/worldLights.js.map +0 -7
- package/dist/utils/wrap.js +0 -2
- package/dist/utils/wrap.js.map +0 -7
- package/src/utils/addBridges.js +0 -66
- package/src/utils/addRasterTile.js +0 -112
- package/src/utils/along.js +0 -9
- package/src/utils/atmosphere.js +0 -20
- package/src/utils/attach.js +0 -255
- package/src/utils/bindSunlight.js +0 -12
- package/src/utils/box.js +0 -1
- package/src/utils/bridgeElevation.js +0 -18
- package/src/utils/build.js +0 -20
- package/src/utils/cameraControls.js +0 -287
- package/src/utils/collider.js +0 -62
- package/src/utils/computeBounds.js +0 -17
- package/src/utils/conformModelToTerrain.js +0 -69
- package/src/utils/createMesh.js +0 -31
- package/src/utils/createProgram.js +0 -92
- package/src/utils/decodeDirectory.js +0 -40
- package/src/utils/decodeHeader.js +0 -15
- package/src/utils/decodeModel.js +0 -43
- package/src/utils/destroyTexture.js +0 -7
- package/src/utils/disposeMesh.js +0 -13
- package/src/utils/drawGeometry.js +0 -122
- package/src/utils/elevationWGSL.js +0 -27
- package/src/utils/emptyNode.js +0 -9
- package/src/utils/endZoom.js +0 -15
- package/src/utils/findFeature.js +0 -49
- package/src/utils/geometry.js +0 -2
- package/src/utils/getElevation.js +0 -10
- package/src/utils/getZxy.js +0 -76
- package/src/utils/glass.js +0 -1
- package/src/utils/hit.js +0 -41
- package/src/utils/initSunlight.js +0 -9
- package/src/utils/initTerrain.js +0 -19
- package/src/utils/initTraffic.js +0 -93
- package/src/utils/initWalk.js +0 -72
- package/src/utils/intersectMeshes.js +0 -121
- package/src/utils/isClockWise.js +0 -12
- package/src/utils/lampPostGeometry.js +0 -26
- package/src/utils/lightGeometry.js +0 -22
- package/src/utils/lightGrid.js +0 -50
- package/src/utils/loadModel.js +0 -217
- package/src/utils/loadTerrain.js +0 -65
- package/src/utils/mapCamera.js +0 -432
- package/src/utils/materialShaders.js +0 -243
- package/src/utils/mirror.js +0 -6
- package/src/utils/nativeEvents.js +0 -77
- package/src/utils/nativeGeometry.js +0 -131
- package/src/utils/nativeLayer.js +0 -317
- package/src/utils/onAdd3DLayer.js +0 -31
- package/src/utils/onAddSun.js +0 -147
- package/src/utils/onMapChange.js +0 -16
- package/src/utils/onPMTileAdd.js +0 -15
- package/src/utils/onPMTileRemove.js +0 -8
- package/src/utils/onRemove3DLayer.js +0 -78
- package/src/utils/onRemoveSun.js +0 -3
- package/src/utils/onTerrainAdd.js +0 -18
- package/src/utils/onTerrainChange.js +0 -13
- package/src/utils/onTerrainRemove.js +0 -40
- package/src/utils/onZoomAnim.js +0 -14
- package/src/utils/parts.js +0 -16
- package/src/utils/pump.js +0 -226
- package/src/utils/rasterTiles.js +0 -285
- package/src/utils/raycast.js +0 -60
- package/src/utils/readAccessor.js +0 -68
- package/src/utils/releaseArea.js +0 -34
- package/src/utils/removeRasterTile.js +0 -13
- package/src/utils/render.js +0 -406
- package/src/utils/renderSunlight.js +0 -170
- package/src/utils/resizeSunlight.js +0 -15
- package/src/utils/roofCoverage.js +0 -47
- package/src/utils/routeGeometry.js +0 -22
- package/src/utils/scheduledTrips.js +0 -29
- package/src/utils/setGeoJSONData.js +0 -11
- package/src/utils/setHighlight.js +0 -13
- package/src/utils/setPMTileOpacity.js +0 -7
- package/src/utils/setPMTileZIndex.js +0 -7
- package/src/utils/setVertexColor.js +0 -14
- package/src/utils/showFeature.js +0 -27
- package/src/utils/skin.js +0 -2
- package/src/utils/sortMeshes.js +0 -12
- package/src/utils/terrainAtlas.js +0 -21
- package/src/utils/terrainElevation.js +0 -20
- package/src/utils/terrainGrid.js +0 -23
- package/src/utils/tileId.js +0 -18
- package/src/utils/toLanes.js +0 -7
- package/src/utils/tooltip.js +0 -6
- package/src/utils/traffic.js +0 -315
- package/src/utils/traverse.js +0 -6
- package/src/utils/treeGeometry.js +0 -45
- package/src/utils/triangulate.js +0 -100
- package/src/utils/tripsAt.js +0 -16
- package/src/utils/underEntry.js +0 -17
- package/src/utils/update.js +0 -18
- package/src/utils/updateArea.js +0 -40
- package/src/utils/updateCamera.js +0 -32
- package/src/utils/updatePointLights.js +0 -38
- package/src/utils/updateWorldMatrix.js +0 -47
- package/src/utils/vehicleOffsets.js +0 -8
- package/src/utils/vehicles.js +0 -65
- package/src/utils/vertexNormals.js +0 -30
- package/src/utils/walk.js +0 -187
- package/src/utils/worldLights.js +0 -25
- /package/src/{utils → archives}/decompress.js +0 -0
- /package/src/{utils → archives}/getHeader.js +0 -0
- /package/src/{utils → archives}/loadSource.js +0 -0
- /package/src/{utils → archives}/read.js +0 -0
- /package/src/{utils → collision}/horizontalRay.js +0 -0
- /package/src/{utils → constants}/CELL.js +0 -0
- /package/src/{utils/sizes.js → constants/accessorSizes.js} +0 -0
- /package/src/{utils/types.js → constants/accessorTypes.js} +0 -0
- /package/src/{utils → constants}/colliders.js +0 -0
- /package/src/{utils → constants}/headlight.js +0 -0
- /package/src/{utils → constants}/hull.js +0 -0
- /package/src/{utils → constants}/limbs.js +0 -0
- /package/src/{utils → constants}/moves.js +0 -0
- /package/src/{utils → constants}/paints.js +0 -0
- /package/src/{utils → constants}/renderers.js +0 -0
- /package/src/{utils → constants}/speed.js +0 -0
- /package/src/{utils → constants}/taillight.js +0 -0
- /package/src/{utils → constants}/white.js +0 -0
- /package/src/{utils → models}/nodeMatrix.js +0 -0
- /package/src/{utils → models}/textureSampler.js +0 -0
- /package/src/{utils → picking}/onClick.js +0 -0
- /package/src/{utils → picking}/onPointerLeave.js +0 -0
- /package/src/{utils → picking}/onPointerMove.js +0 -0
- /package/src/{utils → scene}/setParent.js +0 -0
- /package/src/{utils → scene}/startZoom.js +0 -0
- /package/src/{utils → sunlight}/horizontalPosition.js +0 -0
- /package/src/{utils → sunlight}/moonPosition.js +0 -0
- /package/src/{utils → sunlight}/projectCelestialBody.js +0 -0
- /package/src/{utils → sunlight}/solarPosition.js +0 -0
- /package/src/{utils → terrain}/setTerrainHeight.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leaflet-city-mapper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A small 3D rendering engine for leaflet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/leaflet-city-mapper.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@cucumber/cucumber": "^10.3.1",
|
|
42
|
+
"acorn": "^8.15.0",
|
|
42
43
|
"esbuild": "^0.28.2",
|
|
43
44
|
"playwright": "^1.64.1"
|
|
44
45
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { varint } from './varint.js';
|
|
2
|
+
/** Decode delta/varint directory columns, rejecting malformed entries. */
|
|
3
|
+
|
|
4
|
+
export function decodeDirectory(data) {
|
|
5
|
+
const bytes = new Uint8Array(data);
|
|
6
|
+
const reader = { bytes, cursor: 0 };
|
|
7
|
+
const count = varint(reader);
|
|
8
|
+
if (count > (bytes.length - reader.cursor) / 4) throw new Error('Invalid PMTiles directory count');
|
|
9
|
+
const entries = [];
|
|
10
|
+
let tileId = 0;
|
|
11
|
+
let i, entry, value;
|
|
12
|
+
for (i = 0; i < count; i++) {
|
|
13
|
+
tileId += varint(reader);
|
|
14
|
+
if (!Number.isSafeInteger(tileId) || (i && tileId <= entries[i - 1].tileId)) {
|
|
15
|
+
throw new Error('Invalid PMTiles directory tile IDs');
|
|
16
|
+
}
|
|
17
|
+
entries.push({ tileId });
|
|
18
|
+
}
|
|
19
|
+
for (entry of entries) entry.runLength = varint(reader);
|
|
20
|
+
for (entry of entries) {
|
|
21
|
+
entry.length = varint(reader);
|
|
22
|
+
if (!entry.length) throw new Error('Invalid PMTiles directory length');
|
|
23
|
+
}
|
|
24
|
+
for (i = 0; i < entries.length; i++) {
|
|
25
|
+
entry = entries[i];
|
|
26
|
+
value = varint(reader);
|
|
27
|
+
if (!value && !i) throw new Error('Invalid PMTiles directory offset');
|
|
28
|
+
entry.offset = value ? value - 1 : entries[i - 1].offset + entries[i - 1].length;
|
|
29
|
+
}
|
|
30
|
+
if (reader.cursor !== bytes.length) throw new Error('Trailing PMTiles directory data');
|
|
31
|
+
return entries;
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Decode the PMTiles v3 header. */
|
|
2
|
+
|
|
3
|
+
export function decodeHeader(data) {
|
|
4
|
+
if (data.byteLength < 127 || new TextDecoder().decode(new Uint8Array(data, 0, 7)) !== 'PMTiles' ||
|
|
5
|
+
new Uint8Array(data)[7] !== 3) throw new Error('Expected a PMTiles v3 archive');
|
|
6
|
+
const view = new DataView(data);
|
|
7
|
+
const header = {};
|
|
8
|
+
const offsets = ['rootDirectoryOffset', 'rootDirectoryLength', 'jsonMetadataOffset', 'jsonMetadataLength', 'leafDirectoryOffset', 'leafDirectoryLength', 'tileDataOffset', 'tileDataLength', 'numAddressedTiles', 'numTileEntries', 'numTileContents'];
|
|
9
|
+
const flags = ['clustered', 'internalCompression', 'tileCompression', 'tileType', 'minZoom', 'maxZoom'];
|
|
10
|
+
const bounds = ['minLon', 'minLat', 'maxLon', 'maxLat'];
|
|
11
|
+
let i;
|
|
12
|
+
for (i = 0; i < offsets.length; i++) header[offsets[i]] = Number(view.getBigUint64(8 + i * 8, true));
|
|
13
|
+
for (i = 0; i < flags.length; i++) header[flags[i]] = view.getUint8(96 + i);
|
|
14
|
+
for (i = 0; i < bounds.length; i++) header[bounds[i]] = view.getInt32(102 + i * 4, true) / 1e7;
|
|
15
|
+
header.centerZoom = view.getUint8(118);
|
|
16
|
+
header.centerLon = view.getInt32(119, true) / 1e7;
|
|
17
|
+
header.centerLat = view.getInt32(123, true) / 1e7;
|
|
18
|
+
return header;
|
|
19
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { loadDirectory } from './loadDirectory.js';
|
|
2
|
+
import { decompress } from './decompress.js';
|
|
3
|
+
import { tileId } from './tileId.js';
|
|
4
|
+
import { read } from './read.js';
|
|
5
|
+
import { getHeader } from './getHeader.js';
|
|
6
|
+
|
|
7
|
+
/** Nearest directory entry at/before the Hilbert ID, then follow leaf pointers. */
|
|
8
|
+
|
|
9
|
+
export async function getZxy(backend, z, x, y, signal) {
|
|
10
|
+
if (backend.options.archive && backend.options.archive !== backend && backend.options.archive.getZxy) {
|
|
11
|
+
return backend.options.archive.getZxy(z, x, y, signal);
|
|
12
|
+
}
|
|
13
|
+
const id = tileId(z, x, y);
|
|
14
|
+
signal?.throwIfAborted();
|
|
15
|
+
const header = await getHeader(backend);
|
|
16
|
+
signal?.throwIfAborted();
|
|
17
|
+
if (z < header.minZoom || z > header.maxZoom) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let offset = header.rootDirectoryOffset, length = header.rootDirectoryLength;
|
|
21
|
+
const visited = new Set();
|
|
22
|
+
let depth, key, pending, entries, low, high, mid, entry, data;
|
|
23
|
+
for (depth = 0; depth < 4; depth++) {
|
|
24
|
+
if (visited.has(offset)) {
|
|
25
|
+
throw new Error('Cyclic PMTiles directory');
|
|
26
|
+
}
|
|
27
|
+
visited.add(offset);
|
|
28
|
+
key = `${offset}:${length}`;
|
|
29
|
+
if (!backend._directories.has(key)) {
|
|
30
|
+
if (backend._directories.size >= 32) {
|
|
31
|
+
backend._directories.delete(backend._directories.keys().next().value);
|
|
32
|
+
}
|
|
33
|
+
backend._directories.set(key, loadDirectory(backend, offset, length, header.internalCompression));
|
|
34
|
+
}
|
|
35
|
+
pending = backend._directories.get(key);
|
|
36
|
+
entries = void 0;
|
|
37
|
+
try {
|
|
38
|
+
entries = await pending;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (backend._directories.get(key) === pending) backend._directories.delete(key);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
signal?.throwIfAborted();
|
|
44
|
+
low = 0, high = entries.length - 1;
|
|
45
|
+
while (low <= high) {
|
|
46
|
+
mid = (low + high) >> 1;
|
|
47
|
+
if (entries[mid].tileId <= id) {
|
|
48
|
+
low = mid + 1;
|
|
49
|
+
} else {
|
|
50
|
+
high = mid - 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
entry = entries[high];
|
|
54
|
+
if (!entry) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (entry.runLength) {
|
|
58
|
+
if (id - entry.tileId >= entry.runLength) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (entry.offset + entry.length > header.tileDataLength) {
|
|
62
|
+
throw new Error('PMTiles tile outside data section');
|
|
63
|
+
}
|
|
64
|
+
data = await decompress(await read(backend, header.tileDataOffset + entry.offset, entry.length, signal), header.tileCompression);
|
|
65
|
+
signal?.throwIfAborted();
|
|
66
|
+
return { data };
|
|
67
|
+
}
|
|
68
|
+
if (entry.offset + entry.length > header.leafDirectoryLength) {
|
|
69
|
+
throw new Error('PMTiles directory outside leaf section');
|
|
70
|
+
}
|
|
71
|
+
offset = header.leafDirectoryOffset + entry.offset;
|
|
72
|
+
length = entry.length;
|
|
73
|
+
}
|
|
74
|
+
throw new Error('PMTiles directory depth exceeds four levels');
|
|
75
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { decodeDirectory } from "./decodeDirectory.js";
|
|
2
|
+
import { decompress } from "./decompress.js";
|
|
3
|
+
import { read } from "./read.js";
|
|
4
|
+
|
|
5
|
+
export async function loadDirectory(backend, offset, length, compression) {
|
|
6
|
+
return decodeDirectory(await decompress(await read(backend, offset, length), compression));
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Cumulative Hilbert ID for an archive tile. */
|
|
2
|
+
|
|
3
|
+
export function tileId(z, x, y) {
|
|
4
|
+
if (!Number.isInteger(z) || !Number.isInteger(x) || !Number.isInteger(y) || z < 0 || z > 26 ||
|
|
5
|
+
x < 0 || y < 0 || x >= 2 ** z || y >= 2 ** z) throw new Error('Invalid PMTiles tile coordinates');
|
|
6
|
+
let id = (4 ** z - 1) / 3;
|
|
7
|
+
const n = 2 ** z;
|
|
8
|
+
// Same cumulative Hilbert ordering used by build/pmtiles.js.
|
|
9
|
+
let s, rx, ry;
|
|
10
|
+
for (s = n / 2; s >= 1; s /= 2) {
|
|
11
|
+
rx = (x & s) ? 1 : 0, ry = (y & s) ? 1 : 0;
|
|
12
|
+
id += s * s * ((3 * rx) ^ ry);
|
|
13
|
+
if (!ry) {
|
|
14
|
+
if (rx) { x = n - 1 - x; y = n - 1 - y; }
|
|
15
|
+
[x, y] = [y, x];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return id;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export function varint(reader) {
|
|
4
|
+
const { bytes } = reader;
|
|
5
|
+
let value = 0;
|
|
6
|
+
let factor, byte;
|
|
7
|
+
for (factor = 1; factor <= 2 ** 49; factor *= 128) {
|
|
8
|
+
if (reader.cursor >= bytes.length) throw new Error('Truncated PMTiles directory');
|
|
9
|
+
byte = bytes[reader.cursor++];
|
|
10
|
+
value += (byte & 127) * factor;
|
|
11
|
+
if (!Number.isSafeInteger(value)) throw new Error('Invalid PMTiles directory integer');
|
|
12
|
+
if (byte < 128) return value;
|
|
13
|
+
}
|
|
14
|
+
throw new Error('Invalid PMTiles directory integer');
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
|
|
3
|
+
export function angles(map) {
|
|
4
|
+
const bearing = map.getBearing() * mapCameraState.radians, pitch = map.getPitch() * mapCameraState.radians;
|
|
5
|
+
return [Math.cos(bearing), Math.sin(bearing), Math.cos(pitch), Math.sin(pitch)];
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function animationPoint(map, point, inverse = false) {
|
|
2
|
+
const view = map._cameraView;
|
|
3
|
+
if (!view) return point;
|
|
4
|
+
const half = map.getSize().divideBy(2), scale = map.getZoomScale(view.zoom);
|
|
5
|
+
const shift = map.project(map.getCenter(), view.zoom).subtract(map.project(view.center, view.zoom));
|
|
6
|
+
return inverse ? point.subtract(half).subtract(shift).divideBy(scale).add(half) :
|
|
7
|
+
point.subtract(half).multiplyBy(scale).add(shift).add(half);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { adjustCameraDrag } from '../controls/adjustCameraDrag.js';
|
|
2
|
+
|
|
3
|
+
export function cameraMapReady() {
|
|
4
|
+
const draggable = this.dragging?._draggable;
|
|
5
|
+
if (!draggable) return;
|
|
6
|
+
this._cameraDraggable = draggable;
|
|
7
|
+
draggable.on('predrag', adjustCameraDrag, this);
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
|
|
3
|
+
export function cancelCameraAnimation(map) {
|
|
4
|
+
mapCameraState.cameraAnimations.delete(map);
|
|
5
|
+
map._cameraAnimation = null;
|
|
6
|
+
map._cameraFrame = null;
|
|
7
|
+
if (!mapCameraState.cameraAnimations.size && mapCameraState.cameraAnimationFrame !== null) {
|
|
8
|
+
cancelAnimationFrame(mapCameraState.cameraAnimationFrame);
|
|
9
|
+
mapCameraState.cameraAnimationFrame = null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cancelCameraAnimation } from './cancelCameraAnimation.js';
|
|
2
|
+
import { adjustCameraDrag } from '../controls/adjustCameraDrag.js';
|
|
3
|
+
|
|
4
|
+
export function cleanupCameraMap() {
|
|
5
|
+
cancelCameraAnimation(this);
|
|
6
|
+
this._pitchSky?.remove();
|
|
7
|
+
if (this._cameraDraggable) {
|
|
8
|
+
this._cameraDraggable.off('predrag', adjustCameraDrag, this);
|
|
9
|
+
delete this._cameraDraggable;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { pointOf } from './pointOf.js';
|
|
2
|
+
import { angles } from './angles.js';
|
|
3
|
+
import { verticalGroundY } from './verticalGroundY.js';
|
|
4
|
+
|
|
5
|
+
export function fitCameraBounds(map, bounds, options = {}) {
|
|
6
|
+
bounds = bounds.getBounds ? bounds.getBounds() : bounds instanceof L.LatLngBounds ? bounds : new L.LatLngBounds(bounds);
|
|
7
|
+
const zoom = map.getZoom() ?? 0, half = map.getSize().divideBy(2), distance = map.getSize().y * 1.5;
|
|
8
|
+
const min = pointOf(options.paddingTopLeft || options.padding || [0, 0]).subtract(half);
|
|
9
|
+
const max = half.subtract(pointOf(options.paddingBottomRight || options.padding || [0, 0]));
|
|
10
|
+
const [cos, sin, tilt, rise] = angles(map);
|
|
11
|
+
const far = map.getSize().y * map.options.pitchMaxDistance;
|
|
12
|
+
const top = verticalGroundY(min.y, tilt, distance, rise, far);
|
|
13
|
+
const bottom = verticalGroundY(max.y, tilt, distance, rise, far);
|
|
14
|
+
const origin = map.project(bounds.getNorthWest(), zoom).add(map.project(bounds.getSouthEast(), zoom)).divideBy(2);
|
|
15
|
+
const points = [];
|
|
16
|
+
let latlng, p, point;
|
|
17
|
+
for (latlng of [bounds.getNorthWest(), bounds.getNorthEast(), bounds.getSouthWest(), bounds.getSouthEast()]) {
|
|
18
|
+
p = map.project(latlng, zoom).subtract(origin);
|
|
19
|
+
points.push(new L.Point(cos * p.x - sin * p.y, sin * p.x + cos * p.y));
|
|
20
|
+
}
|
|
21
|
+
let low = Infinity, high = -Infinity;
|
|
22
|
+
for (point of points) {
|
|
23
|
+
low = Math.min(low, point.y);
|
|
24
|
+
high = Math.max(high, point.y);
|
|
25
|
+
}
|
|
26
|
+
const leftSlope = min.x * rise / distance, rightSlope = max.x * rise / distance;
|
|
27
|
+
const slope = rightSlope - leftSlope;
|
|
28
|
+
let left = Infinity, right = -Infinity;
|
|
29
|
+
for (point of points) {
|
|
30
|
+
left = Math.min(left, point.x + leftSlope * point.y);
|
|
31
|
+
right = Math.max(right, point.x + rightSlope * point.y);
|
|
32
|
+
}
|
|
33
|
+
// Perspective viewport edges are straight lines on the ground: fit all four corners, not their screen midpoint.
|
|
34
|
+
const scale = Math.min((bottom - top) / (high - low),
|
|
35
|
+
(max.x - min.x - slope * top) / (right - left - slope * low));
|
|
36
|
+
let target = map.getScaleZoom(scale, zoom);
|
|
37
|
+
const snap = map.options.zoomSnap;
|
|
38
|
+
if (snap) target = Math.floor(Math.round(target / (snap / 100)) / 100) * snap;
|
|
39
|
+
target = Math.max(map.getMinZoom(), Math.min(map.getMaxZoom(), options.maxZoom ?? Infinity, target));
|
|
40
|
+
if (!Number.isFinite(target)) return { center: bounds.getCenter(), zoom: target };
|
|
41
|
+
const actual = map.getZoomScale(target, zoom);
|
|
42
|
+
const vMin = high * actual - bottom, vMax = low * actual - top;
|
|
43
|
+
const v = Math.max(vMin, slope ? (actual * (right - left) - max.x + min.x) / slope : vMin);
|
|
44
|
+
const centerY = (Math.min(vMax, v) + vMax) / 2;
|
|
45
|
+
const centerX = (actual * (left + right) - min.x - max.x - (leftSlope + rightSlope) * centerY) / 2;
|
|
46
|
+
const center = origin.add(new L.Point(cos * centerX + sin * centerY, -sin * centerX + cos * centerY).divideBy(actual));
|
|
47
|
+
return { center: map.unproject(center, zoom), zoom: target };
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pointOf } from './pointOf.js';
|
|
2
|
+
import { project } from './project.js';
|
|
3
|
+
|
|
4
|
+
export function groundBounds(map, padding = [0, 0]) {
|
|
5
|
+
const min = pointOf(padding).divideBy(2), max = map.getSize().subtract(min);
|
|
6
|
+
const corners = [[min.x, min.y], [max.x, min.y], [min.x, max.y], [max.x, max.y]];
|
|
7
|
+
const points = [];
|
|
8
|
+
let point;
|
|
9
|
+
for (point of corners) points.push(project(map, point, true, true));
|
|
10
|
+
return new L.Bounds(points);
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { updateSky } from './updateSky.js';
|
|
2
|
+
import { constrainCameraToBounds } from './constrainCameraToBounds.js';
|
|
3
|
+
import { cleanupCameraMap } from './cleanupCameraMap.js';
|
|
4
|
+
import { cameraMapReady } from './cameraMapReady.js';
|
|
5
|
+
import { loadCameraControls } from '../controls/loadCameraControls.js';
|
|
6
|
+
import { noOperation } from '../utils/noOperation.js';
|
|
7
|
+
|
|
8
|
+
export function initializeCameraMap() {
|
|
9
|
+
if (!document.getElementById('leaflet-camera-zoom-style')) {
|
|
10
|
+
const style = document.createElement('style');
|
|
11
|
+
style.id = 'leaflet-camera-zoom-style';
|
|
12
|
+
style.textContent = '.leaflet-camera-zoom .leaflet-marker-icon,.leaflet-camera-zoom .leaflet-marker-shadow,' +
|
|
13
|
+
'.leaflet-camera-zoom .leaflet-popup,.leaflet-camera-zoom .leaflet-tooltip{transition:none!important}';
|
|
14
|
+
document.head.append(style);
|
|
15
|
+
}
|
|
16
|
+
this._setPitchAndBearing(this.options.pitch, this.options.bearing);
|
|
17
|
+
this.on('load resize pitch', updateSky);
|
|
18
|
+
this.on('rotate pitch', constrainCameraToBounds, this);
|
|
19
|
+
this.once('unload', cleanupCameraMap, this);
|
|
20
|
+
this.whenReady(cameraMapReady, this);
|
|
21
|
+
if (this.options.rotate || this.options.trackContainerMutation) {
|
|
22
|
+
this.cameraReady = loadCameraControls(this);
|
|
23
|
+
this.cameraReady.catch(noOperation);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cancelCameraAnimation } from './cancelCameraAnimation.js';
|
|
2
|
+
import { scheduleCameraAnimation } from './scheduleCameraAnimation.js';
|
|
3
|
+
|
|
4
|
+
export function mapAnimateCamera(pitch, bearing, options = {}) {
|
|
5
|
+
cancelCameraAnimation(this);
|
|
6
|
+
if (!Number.isFinite(pitch) || !Number.isFinite(bearing)) throw new TypeError('Camera angles must be finite numbers');
|
|
7
|
+
if (!options.animate || matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
8
|
+
return this._setPitchAndBearing(pitch, bearing);
|
|
9
|
+
}
|
|
10
|
+
const duration = options.duration ?? 0.3;
|
|
11
|
+
if (!Number.isFinite(duration) || duration < 0) throw new TypeError('Camera duration must be nonnegative');
|
|
12
|
+
const start = performance.now(), fromPitch = this.getPitch(), fromBearing = this.getBearing();
|
|
13
|
+
const delta = ((bearing - fromBearing) % 360 + 540) % 360 - 180;
|
|
14
|
+
const animation = this._cameraAnimation = { duration, start, fromPitch, fromBearing, pitch, delta };
|
|
15
|
+
scheduleCameraAnimation(this, animation);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { initNativeGPU } from '../core/initNativeGPU.js';
|
|
2
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
3
|
+
import { mapGetBearing } from './mapGetBearing.js';
|
|
4
|
+
import { mapGetPitch } from './mapGetPitch.js';
|
|
5
|
+
import { mapStopPitchBearingAnimation } from './mapStopPitchBearingAnimation.js';
|
|
6
|
+
import { mapSetPitchAndBearing } from './mapSetPitchAndBearing.js';
|
|
7
|
+
import { mapAnimateCamera } from './mapAnimateCamera.js';
|
|
8
|
+
import { mapSetBearing } from './mapSetBearing.js';
|
|
9
|
+
import { mapSetPitch } from './mapSetPitch.js';
|
|
10
|
+
import { mapResetNorth } from './mapResetNorth.js';
|
|
11
|
+
import { mapResetNorthPitch } from './mapResetNorthPitch.js';
|
|
12
|
+
import { mapLayerPointToContainerPoint } from './mapLayerPointToContainerPoint.js';
|
|
13
|
+
import { mapContainerPointToLayerPoint } from './mapContainerPointToLayerPoint.js';
|
|
14
|
+
import { mapGetCenterLayerPoint } from './mapGetCenterLayerPoint.js';
|
|
15
|
+
import { mapUpdateCameraOverlays } from './mapUpdateCameraOverlays.js';
|
|
16
|
+
import { mapPanBy } from './mapPanBy.js';
|
|
17
|
+
import { mapSetZoomAround } from './mapSetZoomAround.js';
|
|
18
|
+
import { mapPanInside } from './mapPanInside.js';
|
|
19
|
+
import { mapLimitCenter } from './mapLimitCenter.js';
|
|
20
|
+
import { mapLimitOffset } from './mapLimitOffset.js';
|
|
21
|
+
import { mapGetBoundsCenterZoom } from './mapGetBoundsCenterZoom.js';
|
|
22
|
+
import { mapGetBoundsZoom } from './mapGetBoundsZoom.js';
|
|
23
|
+
import { mapTryAnimatedPan } from './mapTryAnimatedPan.js';
|
|
24
|
+
import { mapGetBounds } from './mapGetBounds.js';
|
|
25
|
+
import { initializeCameraMap } from './initializeCameraMap.js';
|
|
26
|
+
import { markerSetIcon } from '../core/markerSetIcon.js';
|
|
27
|
+
import { markerSetRotation } from '../core/markerSetRotation.js';
|
|
28
|
+
import { markerCameraIconPoint } from '../core/markerCameraIconPoint.js';
|
|
29
|
+
import { markerGetEvents } from '../core/markerGetEvents.js';
|
|
30
|
+
import { markerSetPos } from '../core/markerSetPos.js';
|
|
31
|
+
import { markerUpdateZIndex } from '../core/markerUpdateZIndex.js';
|
|
32
|
+
import { markerInitInteraction } from '../core/markerInitInteraction.js';
|
|
33
|
+
import { popupGetEvents } from '../core/popupGetEvents.js';
|
|
34
|
+
import { tooltipGetEvents } from '../core/tooltipGetEvents.js';
|
|
35
|
+
import { popupAdjustPan } from '../core/popupAdjustPan.js';
|
|
36
|
+
import { popupUpdatePosition } from '../core/popupUpdatePosition.js';
|
|
37
|
+
import { tooltipSetPosition } from '../core/tooltipSetPosition.js';
|
|
38
|
+
import { gridlayerGetEvents } from '../core/gridlayerGetEvents.js';
|
|
39
|
+
import { gridlayerGetTiledPixelBounds } from '../core/gridlayerGetTiledPixelBounds.js';
|
|
40
|
+
|
|
41
|
+
mapCameraState.mapMethods = Object.defineProperties({}, Object.getOwnPropertyDescriptors(L.Map.prototype));
|
|
42
|
+
mapCameraState.radians = Math.PI / 180;
|
|
43
|
+
|
|
44
|
+
mapCameraState.cameraAnimations = new Map();
|
|
45
|
+
mapCameraState.cameraAnimationFrame = null;
|
|
46
|
+
|
|
47
|
+
L.Map.mergeOptions({
|
|
48
|
+
rotate: true, bearing: 0, pitch: 0, pitchMaxDistance: 3,
|
|
49
|
+
rotateControl: true, shiftKeyRotate: true, pitchDrag: true,
|
|
50
|
+
touchRotate: false, touchPitch: false, compassBearing: false,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Ground coordinates only: the GPU camera handles elevated geometry, never CSS transforms.
|
|
54
|
+
|
|
55
|
+
L.Map.include({
|
|
56
|
+
getBearing: mapGetBearing,
|
|
57
|
+
getPitch: mapGetPitch,
|
|
58
|
+
_stopPitchBearingAnimation: mapStopPitchBearingAnimation,
|
|
59
|
+
_setPitchAndBearing: mapSetPitchAndBearing,
|
|
60
|
+
_animateCamera: mapAnimateCamera,
|
|
61
|
+
setBearing: mapSetBearing,
|
|
62
|
+
setPitch: mapSetPitch,
|
|
63
|
+
resetNorth: mapResetNorth,
|
|
64
|
+
resetNorthPitch: mapResetNorthPitch,
|
|
65
|
+
layerPointToContainerPoint: mapLayerPointToContainerPoint,
|
|
66
|
+
containerPointToLayerPoint: mapContainerPointToLayerPoint,
|
|
67
|
+
_getCenterLayerPoint: mapGetCenterLayerPoint,
|
|
68
|
+
_updateCameraOverlays: mapUpdateCameraOverlays,
|
|
69
|
+
panBy: mapPanBy,
|
|
70
|
+
setZoomAround: mapSetZoomAround,
|
|
71
|
+
panInside: mapPanInside,
|
|
72
|
+
_limitCenter: mapLimitCenter,
|
|
73
|
+
_limitOffset: mapLimitOffset,
|
|
74
|
+
_getBoundsCenterZoom: mapGetBoundsCenterZoom,
|
|
75
|
+
getBoundsZoom: mapGetBoundsZoom,
|
|
76
|
+
_tryAnimatedPan: mapTryAnimatedPan,
|
|
77
|
+
getBounds: mapGetBounds,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
L.Map.addInitHook(initializeCameraMap);
|
|
81
|
+
|
|
82
|
+
mapCameraState.markerMethods = Object.defineProperties({}, Object.getOwnPropertyDescriptors(L.Marker.prototype));
|
|
83
|
+
L.Marker.mergeOptions({ rotation: 0, rotateWithView: false, keepUpright: false, scale: 1 });
|
|
84
|
+
L.Marker.include({
|
|
85
|
+
setIcon: markerSetIcon,
|
|
86
|
+
setRotation: markerSetRotation,
|
|
87
|
+
_cameraIconPoint: markerCameraIconPoint,
|
|
88
|
+
getEvents: markerGetEvents,
|
|
89
|
+
_setPos: markerSetPos,
|
|
90
|
+
_updateZIndex: markerUpdateZIndex,
|
|
91
|
+
_initInteraction: markerInitInteraction,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Keep Leaflet's focusable marker and its drag events; only translate its screen position back to ground.
|
|
95
|
+
|
|
96
|
+
mapCameraState.pendingMarkerPan = new Map();
|
|
97
|
+
mapCameraState.markerPanFrame = null;
|
|
98
|
+
|
|
99
|
+
mapCameraState.popupEvents = L.Popup.prototype.getEvents;
|
|
100
|
+
L.Popup.include({
|
|
101
|
+
getEvents: popupGetEvents,
|
|
102
|
+
});
|
|
103
|
+
mapCameraState.tooltipEvents = L.Tooltip.prototype.getEvents;
|
|
104
|
+
L.Tooltip.include({
|
|
105
|
+
getEvents: tooltipGetEvents,
|
|
106
|
+
});
|
|
107
|
+
mapCameraState.popupPosition = L.Popup.prototype._updatePosition;
|
|
108
|
+
mapCameraState.popupPan = L.Popup.prototype._adjustPan;
|
|
109
|
+
L.Popup.include({
|
|
110
|
+
_adjustPan: popupAdjustPan,
|
|
111
|
+
_updatePosition: popupUpdatePosition,
|
|
112
|
+
});
|
|
113
|
+
mapCameraState.tooltipPosition = L.Tooltip.prototype._setPosition;
|
|
114
|
+
L.Tooltip.include({
|
|
115
|
+
_setPosition: tooltipSetPosition,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
mapCameraState.tiledBounds = L.GridLayer.prototype._getTiledPixelBounds;
|
|
119
|
+
mapCameraState.gridEvents = L.GridLayer.prototype.getEvents;
|
|
120
|
+
L.GridLayer.include({
|
|
121
|
+
getEvents: gridlayerGetEvents,
|
|
122
|
+
_getTiledPixelBounds: gridlayerGetTiledPixelBounds,
|
|
123
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { animationPoint } from './animationPoint.js';
|
|
3
|
+
import { project } from './project.js';
|
|
4
|
+
|
|
5
|
+
export function mapContainerPointToLayerPoint(point) {
|
|
6
|
+
return mapCameraState.mapMethods.containerPointToLayerPoint.call(this, animationPoint(this, project(this, point, true), true));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapGetBearing() { return this._cameraBearing ?? 0; }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { groundBounds } from './groundBounds.js';
|
|
3
|
+
import { animationPoint } from './animationPoint.js';
|
|
4
|
+
|
|
5
|
+
export function mapGetBounds() {
|
|
6
|
+
if (!this.getPitch() && !this.getBearing()) return mapCameraState.mapMethods.getBounds.call(this);
|
|
7
|
+
const footprint = groundBounds(this), bounds = new L.LatLngBounds();
|
|
8
|
+
let point, raw;
|
|
9
|
+
for (point of [footprint.min, footprint.max]) {
|
|
10
|
+
raw = mapCameraState.mapMethods.containerPointToLayerPoint.call(this, animationPoint(this, point, true));
|
|
11
|
+
bounds.extend(this.layerPointToLatLng(raw));
|
|
12
|
+
}
|
|
13
|
+
return bounds;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fitCameraBounds } from './fitCameraBounds.js';
|
|
2
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
3
|
+
|
|
4
|
+
export function mapGetBoundsCenterZoom(bounds, options) {
|
|
5
|
+
return this.getPitch() || this.getBearing() ? fitCameraBounds(this, bounds, options) :
|
|
6
|
+
mapCameraState.mapMethods._getBoundsCenterZoom.call(this, bounds, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { fitCameraBounds } from './fitCameraBounds.js';
|
|
3
|
+
import { pointOf } from './pointOf.js';
|
|
4
|
+
import { groundBounds } from './groundBounds.js';
|
|
5
|
+
|
|
6
|
+
export function mapGetBoundsZoom(bounds, inside, padding) {
|
|
7
|
+
if (!this.getPitch() && !this.getBearing()) return mapCameraState.mapMethods.getBoundsZoom.call(this, bounds, inside, padding);
|
|
8
|
+
if (!inside) return fitCameraBounds(this, bounds, { padding: pointOf(padding || [0, 0]).divideBy(2) }).zoom;
|
|
9
|
+
bounds = bounds instanceof L.LatLngBounds ? bounds : new L.LatLngBounds(bounds);
|
|
10
|
+
const footprint = groundBounds(this, padding).getSize(), size = this.project(bounds.getSouthEast()).subtract(this.project(bounds.getNorthWest()));
|
|
11
|
+
const zoom = this.getScaleZoom(Math.max(footprint.x / size.x, footprint.y / size.y));
|
|
12
|
+
const snap = this.options.zoomSnap;
|
|
13
|
+
return Math.max(this.getMinZoom(), Math.min(this.getMaxZoom(), snap ? Math.ceil(zoom / snap) * snap : zoom));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapGetPitch() { return this._cameraPitch ?? 0; }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { project } from './project.js';
|
|
2
|
+
import { animationPoint } from './animationPoint.js';
|
|
3
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
4
|
+
|
|
5
|
+
export function mapLayerPointToContainerPoint(point) {
|
|
6
|
+
return project(this, animationPoint(this, mapCameraState.mapMethods.layerPointToContainerPoint.call(this, point)));
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { groundBounds } from './groundBounds.js';
|
|
3
|
+
|
|
4
|
+
export function mapLimitCenter(center, zoom, bounds) {
|
|
5
|
+
if (!bounds || !this._loaded || !this.getPitch() && !this.getBearing()) {
|
|
6
|
+
return mapCameraState.mapMethods._limitCenter.call(this, center, zoom, bounds);
|
|
7
|
+
}
|
|
8
|
+
const half = this.getSize().divideBy(2), footprint = groundBounds(this), point = this.project(center, zoom);
|
|
9
|
+
const view = new L.Bounds(point.add(footprint.min.subtract(half)), point.add(footprint.max.subtract(half)));
|
|
10
|
+
const offset = this._getBoundsOffset(view, bounds, zoom);
|
|
11
|
+
return Math.abs(offset.x) <= 1 && Math.abs(offset.y) <= 1 ? center : this.unproject(point.add(offset), zoom);
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { project } from './project.js';
|
|
3
|
+
|
|
4
|
+
export function mapLimitOffset(offset, bounds) {
|
|
5
|
+
if (!bounds || !this.getPitch() && !this.getBearing()) return mapCameraState.mapMethods._limitOffset.call(this, offset, bounds);
|
|
6
|
+
const half = this.getSize().divideBy(2), ground = half.subtract(project(this, half.subtract(offset), true));
|
|
7
|
+
const center = this.project(this.getCenter());
|
|
8
|
+
const limited = this.project(this._limitCenter(this.unproject(center.add(ground)), this.getZoom(), bounds));
|
|
9
|
+
return half.subtract(project(this, half.subtract(limited.subtract(center))));
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { project } from './project.js';
|
|
2
|
+
import { pointOf } from './pointOf.js';
|
|
3
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
4
|
+
|
|
5
|
+
export function mapPanBy(offset, options) {
|
|
6
|
+
const half = this.getSize().divideBy(2);
|
|
7
|
+
const ground = half.subtract(project(this, half.subtract(pointOf(offset)), true));
|
|
8
|
+
return mapCameraState.mapMethods.panBy.call(this, ground, options);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mapCameraState } from '../constants/mapCameraState.js';
|
|
2
|
+
import { pointOf } from './pointOf.js';
|
|
3
|
+
|
|
4
|
+
export function mapPanInside(latlng, options = {}) {
|
|
5
|
+
if (!this.getPitch() && !this.getBearing()) return mapCameraState.mapMethods.panInside.call(this, latlng, options);
|
|
6
|
+
const min = pointOf(options.paddingTopLeft || options.padding || [0, 0]);
|
|
7
|
+
const max = this.getSize().subtract(pointOf(options.paddingBottomRight || options.padding || [0, 0]));
|
|
8
|
+
const screen = this.latLngToContainerPoint(latlng);
|
|
9
|
+
const safe = new L.Point(Math.max(min.x, Math.min(max.x, screen.x)),
|
|
10
|
+
Math.max(min.y, Math.min(max.y, screen.y)));
|
|
11
|
+
if (safe.equals(screen)) return this;
|
|
12
|
+
const delta = this.latLngToLayerPoint(latlng).subtract(this.containerPointToLayerPoint(safe));
|
|
13
|
+
return this.panTo(this.unproject(this.project(this.getCenter()).add(delta)), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapResetNorth(options = { animate: true }) { return this.setBearing(0, options); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapResetNorthPitch(options = { animate: true }) { return this._animateCamera(0, 0, options); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapSetBearing(bearing, options) { return this._animateCamera(this.getPitch(), bearing, options); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mapSetPitch(pitch, options) { return this._animateCamera(pitch, this.getBearing(), options); }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { updateSky } from './updateSky.js';
|
|
2
|
+
|
|
3
|
+
export function mapSetPitchAndBearing(pitch, bearing) {
|
|
4
|
+
if (!Number.isFinite(pitch) || !Number.isFinite(bearing)) throw new TypeError('Camera angles must be finite numbers');
|
|
5
|
+
const previousPitch = this.getPitch(), previousBearing = this.getBearing();
|
|
6
|
+
this._cameraPitch = Math.max(0, Math.min(85, pitch));
|
|
7
|
+
this._cameraBearing = ((bearing % 360) + 360) % 360;
|
|
8
|
+
if (this._loaded) {
|
|
9
|
+
updateSky.call(this);
|
|
10
|
+
if (previousBearing !== this.getBearing()) this.fire('rotate', { bearing: this.getBearing() });
|
|
11
|
+
if (previousPitch !== this.getPitch()) this.fire('pitch', { pitch: this.getPitch() });
|
|
12
|
+
}
|
|
13
|
+
return this;
|
|
14
|
+
}
|