@cesium/engine 26.1.0 → 26.3.0
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/Build/ThirdParty/Workers/zip-web-worker.js +764 -520
- package/Build/Workers/{chunk-HS6AD4P2.js → chunk-2DKJSPYF.js} +14 -14
- package/Build/Workers/{chunk-QVLAFFJY.js → chunk-2PWVICP6.js} +1 -1
- package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
- package/Build/Workers/{chunk-ENNFMWDW.js → chunk-4DMAXPKB.js} +12 -12
- package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-4LRFYRBX.js} +2 -2
- package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
- package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
- package/Build/Workers/{chunk-A6X24AZI.js → chunk-6BSNYZZG.js} +5 -5
- package/Build/Workers/{chunk-IGAZBTFZ.js → chunk-6R6SGKYN.js} +6 -6
- package/Build/Workers/{chunk-SS5ABQGY.js → chunk-6V2KDEHL.js} +4 -4
- package/Build/Workers/{chunk-ZMBHFYOX.js → chunk-75BC2IHI.js} +7 -7
- package/Build/Workers/{chunk-LGNDTZVX.js → chunk-7SESBH2I.js} +4 -4
- package/Build/Workers/{chunk-CLCTQVVL.js → chunk-7WXBTNRV.js} +8 -8
- package/Build/Workers/{chunk-WBSY7HDY.js → chunk-A7SMPV6B.js} +12 -12
- package/Build/Workers/{chunk-CEEZE3YZ.js → chunk-ATSXKJ3L.js} +7 -7
- package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
- package/Build/Workers/{chunk-6HK6IXK2.js → chunk-B7Q2WF6Q.js} +4 -4
- package/Build/Workers/{chunk-YKU2Q3A2.js → chunk-BNDSDQ7D.js} +9 -12
- package/Build/Workers/{chunk-R4FPNAZ2.js → chunk-CKK6CUXK.js} +9 -9
- package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
- package/Build/Workers/{chunk-7D2HZKH7.js → chunk-CQ4TZXAT.js} +7 -7
- package/Build/Workers/{chunk-TVZD72WJ.js → chunk-DKSANM4A.js} +12 -12
- package/Build/Workers/{chunk-FDK4K5IA.js → chunk-DZK34ZVD.js} +1 -1
- package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
- package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
- package/Build/Workers/{chunk-2EFYUSUY.js → chunk-F34TJJLA.js} +16 -16
- package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
- package/Build/Workers/{chunk-T5QBPLE3.js → chunk-GS7RY2DH.js} +11 -11
- package/Build/Workers/{chunk-C7JQVRLM.js → chunk-HDD3RFLT.js} +25 -3
- package/Build/Workers/{chunk-E7NZJOK7.js → chunk-HDPNFEPP.js} +121 -93
- package/Build/Workers/{chunk-VAL7DYNR.js → chunk-JBJ6BRIM.js} +4 -4
- package/Build/Workers/{chunk-XQ3SKCMM.js → chunk-JKTWW7IO.js} +5 -5
- package/Build/Workers/{chunk-UVO6COT2.js → chunk-JL4NWWQY.js} +5 -5
- package/Build/Workers/{chunk-DBD5WWG2.js → chunk-JMUUAW4X.js} +10 -10
- package/Build/Workers/{chunk-UEY73NRN.js → chunk-KBGAHN5R.js} +1 -1
- package/Build/Workers/{chunk-LD64RPYV.js → chunk-KEWK6VZL.js} +12 -12
- package/Build/Workers/{chunk-JW6OZT4R.js → chunk-L73K5UPP.js} +10 -10
- package/Build/Workers/{chunk-DIGUUD6G.js → chunk-LL2SGJYH.js} +6 -6
- package/Build/Workers/{chunk-XLXSDIP5.js → chunk-LYJUL4XQ.js} +6 -6
- package/Build/Workers/{chunk-SM2CDCYF.js → chunk-M6W46OAP.js} +7 -7
- package/Build/Workers/{chunk-EHTS2YPT.js → chunk-MDDKCLMF.js} +17 -17
- package/Build/Workers/{chunk-FGQFQHN5.js → chunk-MUW4DJV7.js} +18 -18
- package/Build/Workers/{chunk-HHV3MCGV.js → chunk-N5YK44FS.js} +5 -5
- package/Build/Workers/{chunk-RG4F5R57.js → chunk-NZQUP52G.js} +9 -9
- package/Build/Workers/{chunk-B4CQSLZJ.js → chunk-PKZA44LH.js} +6 -6
- package/Build/Workers/{chunk-OBEU25PI.js → chunk-Q2JS5LCB.js} +17 -17
- package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
- package/Build/Workers/{chunk-NIWITKQK.js → chunk-SEJIXZZ4.js} +11 -11
- package/Build/Workers/{chunk-SGRGNDOD.js → chunk-SL2HCFYW.js} +10 -10
- package/Build/Workers/{chunk-SF6K72D7.js → chunk-SLHK3KAR.js} +5 -5
- package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
- package/Build/Workers/{chunk-LNSQVXFH.js → chunk-VRECSMG3.js} +2 -2
- package/Build/Workers/{chunk-A3O6EDBK.js → chunk-X27HKF5E.js} +2 -2
- package/Build/Workers/{chunk-7KVKHY7O.js → chunk-XBY3354M.js} +6 -6
- package/Build/Workers/{chunk-GSWMAFTE.js → chunk-XRZCS3HE.js} +23 -16
- package/Build/Workers/{chunk-6YR6JBMY.js → chunk-XSIUYAT6.js} +2 -2
- package/Build/Workers/{chunk-ZSGUV73H.js → chunk-Z2DW5NM2.js} +6 -6
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +35 -35
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +31 -33
- package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +24 -24
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +34 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createPolylineGeometry.js +26 -26
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +21 -21
- package/Build/Workers/createSimplePolylineGeometry.js +24 -24
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/CoplanarPolygonGeometry.js +2 -2
- package/Source/Core/CorridorGeometry.js +2 -4
- package/Source/Core/CorridorOutlineGeometry.js +1 -3
- package/Source/Core/EarthOrientationParameters.js +2 -2
- package/Source/Core/EllipseGeometryLibrary.js +2 -2
- package/Source/Core/EllipsoidGeodesic.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/GroundPolylineGeometry.js +2 -2
- package/Source/Core/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +5 -0
- package/Source/Core/IonSnapGeometryType.js +59 -0
- package/Source/Core/IonSnapHeat.js +33 -0
- package/Source/Core/IonSnapMode.js +45 -0
- package/Source/Core/IonSnapParentGeometryType.js +52 -0
- package/Source/Core/IonSnapService.js +369 -0
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +2 -2
- package/Source/Core/Matrix3.js +2 -2
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/SnapService.js +63 -0
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainPicker.js +179 -168
- package/Source/Core/TimeIntervalCollection.js +1 -3
- package/Source/Core/Tipsify.js +1 -1
- package/Source/Core/Transforms.js +5 -1
- package/Source/Core/VectorPipeline.js +1211 -0
- package/Source/Core/VectorProvider.js +669 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +2 -0
- package/Source/DataSources/DataSourceDisplay.js +1 -1
- package/Source/DataSources/GeoJsonDataSource.js +0 -1
- package/Source/DataSources/GeometryVisualizer.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -2
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +67 -2
- package/Source/Renderer/Context.js +9 -3
- package/Source/Renderer/DrawCommand.js +22 -0
- package/Source/Renderer/Framebuffer.js +4 -0
- package/Source/Renderer/Pass.js +11 -10
- package/Source/Renderer/ShaderBuilder.js +1 -1
- package/Source/Renderer/Texture.js +11 -0
- package/Source/Renderer/UniformState.js +54 -1
- package/Source/Renderer/VertexArray.js +0 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +7 -3
- package/Source/Scene/BufferPointCollection.js +4 -7
- package/Source/Scene/BufferPolygonCollection.js +56 -27
- package/Source/Scene/BufferPolylineCollection.js +61 -8
- package/Source/Scene/BufferPolylineMaterial.js +6 -5
- package/Source/Scene/BufferPrimitiveCollection.js +226 -34
- package/Source/Scene/Camera.js +71 -5
- package/Source/Scene/Cesium3DTile.js +12 -0
- package/Source/Scene/Cesium3DTileset.js +62 -9
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
- package/Source/Scene/Cesium3DTilesetCache.js +15 -0
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/ClippingPolygon.js +154 -100
- package/Source/Scene/ClippingPolygonCollection.js +352 -694
- package/Source/Scene/Controllers/Controller.js +63 -0
- package/Source/Scene/Controllers/ControllerHost.js +78 -0
- package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
- package/Source/Scene/Controllers/MouseButton.js +32 -0
- package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
- package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
- package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
- package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
- package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
- package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
- package/Source/Scene/CreditDisplay.js +62 -0
- package/Source/Scene/DerivedCommand.js +94 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GeoJsonPrimitive.js +114 -24
- package/Source/Scene/Globe.js +20 -0
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +42 -53
- package/Source/Scene/GlobeSurfaceTile.js +61 -10
- package/Source/Scene/GlobeSurfaceTileProvider.js +351 -26
- package/Source/Scene/GltfLoader.js +88 -9
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +188 -4
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +1 -1
- package/Source/Scene/MVTDataProvider.js +11 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
- package/Source/Scene/Model/I3dmLoader.js +1 -1
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
- package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
- package/Source/Scene/Model/Model.js +250 -26
- package/Source/Scene/Model/Model3DTileContent.js +5 -0
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
- package/Source/Scene/Model/ModelDrawCommand.js +160 -16
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelRenderResources.js +2 -3
- package/Source/Scene/Model/ModelSceneGraph.js +31 -1
- package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
- package/Source/Scene/Model/PickingPipelineStage.js +33 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/ModelComponents.js +71 -0
- package/Source/Scene/Picking.js +16 -5
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -1
- package/Source/Scene/PostProcessStage.js +26 -5
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +16 -13
- package/Source/Scene/Scene.js +258 -6
- package/Source/Scene/ScreenSpaceCameraController.js +1 -2
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +241 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +13 -2
- package/Source/Scene/Vector3DTileContent.js +2 -3
- package/Source/Scene/VectorGltf3DTileContent.js +31 -3
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
- package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/renderBufferPointCollection.js +1 -2
- package/Source/Scene/renderBufferPolygonCollection.js +1 -2
- package/Source/Scene/renderBufferPolylineCollection.js +6 -3
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -4
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
- package/Source/Shaders/GlobeFS.glsl +20 -14
- package/Source/Shaders/GlobeFS.js +20 -14
- package/Source/Shaders/GlobeVS.glsl +0 -32
- package/Source/Shaders/GlobeVS.js +0 -32
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
- package/Source/Shaders/Model/ModelFS.glsl +109 -0
- package/Source/Shaders/Model/ModelFS.js +109 -0
- package/Source/Shaders/Model/ModelVS.glsl +7 -2
- package/Source/Shaders/Model/ModelVS.js +7 -2
- package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
- package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
- package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
- package/Source/Shaders/VectorCommon.glsl +305 -0
- package/Source/Shaders/VectorCommon.js +307 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/index.d.ts +1326 -65
- package/index.js +179 -155
- package/package.json +6 -6
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
- package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import Cartesian2 from "../../Core/Cartesian2.js";
|
|
2
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
3
|
+
import defined from "../../Core/defined.js";
|
|
4
|
+
import Frozen from "../../Core/Frozen.js";
|
|
5
|
+
import getTimestamp from "../../Core/getTimestamp.js";
|
|
6
|
+
import CesiumMath from "../../Core/Math.js";
|
|
7
|
+
import ScreenSpaceEventHandler from "../../Core/ScreenSpaceEventHandler.js";
|
|
8
|
+
import ScreenSpaceEventType from "../../Core/ScreenSpaceEventType.js";
|
|
9
|
+
import defaultPickWorldPosition from "./defaultPickWorldPosition.js";
|
|
10
|
+
import ScreenSpaceInputBindings from "./ScreenSpaceInputBindings.js";
|
|
11
|
+
import TimeConstants from "../../Core/TimeConstants.js";
|
|
12
|
+
import MouseButton from "./MouseButton.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {object} ControllerOptions
|
|
16
|
+
* @memberof ScreenSpaceZoomCameraController
|
|
17
|
+
* @property {ScreenSpaceInputBindings.InputBinding[]} [dragInputs] The drag input bindings that control zooming.
|
|
18
|
+
* @property {ScreenSpaceEventType[]} [scrollInputs] The scroll input bindings that control zooming.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A camera controller that allows zooming the camera in and out based on the pointer location in screen space.
|
|
23
|
+
* @class
|
|
24
|
+
* @implements Controller
|
|
25
|
+
* @example
|
|
26
|
+
* viewer.scene.screenSpaceCameraController.enableInputs = false;
|
|
27
|
+
* viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
|
|
28
|
+
*
|
|
29
|
+
* const zoomCameraController = new Cesium.ScreenSpaceZoomCameraController();
|
|
30
|
+
* viewer.addController(zoomCameraController);
|
|
31
|
+
*/
|
|
32
|
+
class ScreenSpaceZoomCameraController {
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
* @returns {ScreenSpaceInputBindings.InputBinding[]} The default drag input bindings.
|
|
36
|
+
*/
|
|
37
|
+
static _getDefaultDragInputs() {
|
|
38
|
+
return [
|
|
39
|
+
Object.freeze({
|
|
40
|
+
button: MouseButton.MIDDLE,
|
|
41
|
+
}),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @private
|
|
47
|
+
* @returns {ScreenSpaceEventType[]} The default scroll input bindings.
|
|
48
|
+
*/
|
|
49
|
+
static _getDefaultScrollInputs() {
|
|
50
|
+
return [ScreenSpaceEventType.WHEEL];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new instance of <code>ScreenSpaceZoomCameraController</code>.
|
|
55
|
+
* @param {ScreenSpaceZoomCameraController.ControllerOptions} [options] The options for configuring the controller.
|
|
56
|
+
*/
|
|
57
|
+
constructor(options = Frozen.EMPTY_OBJECT) {
|
|
58
|
+
this._enabled = true;
|
|
59
|
+
this._handler = undefined;
|
|
60
|
+
this._lastUpdateTime = undefined;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* If false, the camera will zoom to the position at the center of the screen. If true, the camera will zoom to the position under the cursor or tap when dragging starts or when scrolling with the scroll wheel.
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
this.usePointerPosition = false;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The drag input bindings that control zooming. Each binding is a combination of the mouse button
|
|
71
|
+
* and an optional keyboard modifier.
|
|
72
|
+
* @type {ScreenSpaceInputBindings.InputBinding[]}
|
|
73
|
+
* @see ScreenSpaceEventHandler
|
|
74
|
+
*/
|
|
75
|
+
this.dragInputs =
|
|
76
|
+
options.dragInputs ??
|
|
77
|
+
ScreenSpaceZoomCameraController._getDefaultDragInputs();
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The scroll input bindings that control zooming.
|
|
81
|
+
* @type {ScreenSpaceEventType[]}
|
|
82
|
+
* @see ScreenSpaceEventHandler
|
|
83
|
+
* @default [ScreenSpaceEventType.WHEEL]
|
|
84
|
+
*/
|
|
85
|
+
this.scrollInputs =
|
|
86
|
+
options.scrollInputs ??
|
|
87
|
+
ScreenSpaceZoomCameraController._getDefaultScrollInputs();
|
|
88
|
+
|
|
89
|
+
this._dragInputState = undefined;
|
|
90
|
+
this._dragDelta = new Cartesian2();
|
|
91
|
+
this._scrollDelta = 0.0;
|
|
92
|
+
this._zoomInputVelocity = 0.0;
|
|
93
|
+
this._screenSpaceScrollPosition = new Cartesian2();
|
|
94
|
+
this._screenSpaceDragPosition = new Cartesian2();
|
|
95
|
+
this._screenSpaceOrigin = new Cartesian2();
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The rate at which the camera zooms in and out based on the mouse wheel delta.
|
|
99
|
+
* @type {number}
|
|
100
|
+
* @default 0.2
|
|
101
|
+
*/
|
|
102
|
+
this.zoomSensitivity = 0.2;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A callback function used to pick the world position from which to zoom. The function is called with {@link Scene}, the {@link Cartesian2} screen space position, and a {@link Cartesian3} instance to store the result. The function should return the {@link Cartesian3} world position from which to zoom, or <code>undefined</code> if no position could be picked.
|
|
106
|
+
* @type {Function(Scene, Cartesian2, Cartesian3): Cartesian3|undefined}
|
|
107
|
+
* @default defaultPickWorldPosition
|
|
108
|
+
* @example
|
|
109
|
+
* const zoomCameraController = new Cesium.ScreenSpaceZoomCameraController();
|
|
110
|
+
* zoomCameraController.pickWorldPosition = function (scene, windowPosition, result) {
|
|
111
|
+
* // Pick the world position from the depth buffer
|
|
112
|
+
* return scene.pickPosition(windowPosition, result);
|
|
113
|
+
* };
|
|
114
|
+
* viewer.addController(zoomCameraController);
|
|
115
|
+
*/
|
|
116
|
+
this.pickWorldPosition = defaultPickWorldPosition;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The ratio of the camera's distance to the zoom target that defines how much the camera zooms in and out per second.
|
|
120
|
+
* @type {number}
|
|
121
|
+
* @default 0.4
|
|
122
|
+
*/
|
|
123
|
+
this.zoomDistanceRatio = 0.4;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Enable or disable inertia when zooming. When enabled, the camera will continue to move after the user input stops, gradually slowing down based on {@link ScreenSpaceZoomCameraController#inertialDecay}.
|
|
127
|
+
* @type {boolean}
|
|
128
|
+
* @default true
|
|
129
|
+
*/
|
|
130
|
+
this.inertiaEnabled = false;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The rate at which the camera's zoom velocity decays over time.
|
|
134
|
+
* @type {number}
|
|
135
|
+
* @default 6.0
|
|
136
|
+
*/
|
|
137
|
+
this.inertialDecay = 6.0;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @private
|
|
141
|
+
* @type number
|
|
142
|
+
* @default 0.0
|
|
143
|
+
*/
|
|
144
|
+
this.minimumZoomDistance = 0.0;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Maximum distance from the zoom target that the camera can move away.
|
|
148
|
+
* @type {number}
|
|
149
|
+
* @default 100000.0
|
|
150
|
+
*/
|
|
151
|
+
this.maximumZoomDistance = 100000.0;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @private
|
|
155
|
+
* @type {number}
|
|
156
|
+
* @default CesiumMath.EPSILON20
|
|
157
|
+
*/
|
|
158
|
+
this.minimumZoomVelocity = CesiumMath.EPSILON20;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The maximum zoom velocity in meters per second. This limits the speed at which the camera can zoom in and out.
|
|
162
|
+
* @type {number}
|
|
163
|
+
* @default 1.0
|
|
164
|
+
*/
|
|
165
|
+
this.maximumZoomVelocity = 1.0;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Enables or disables damping for zooming. Damping smooths out the camera movement and makes it feel more natural or weighty, but it can also introduce a slight delay in the camera response. If damping is disabled, the camera will respond immediately to user input.
|
|
169
|
+
* @type {boolean}
|
|
170
|
+
* @default true
|
|
171
|
+
*/
|
|
172
|
+
this.dampingEnabled = true;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Specifies the length of time in seconds in which a single zoom animation is targeted to complete.
|
|
176
|
+
* @type {number}
|
|
177
|
+
* @default 0.45
|
|
178
|
+
*/
|
|
179
|
+
this.zoomAnimationDuration = 0.45;
|
|
180
|
+
|
|
181
|
+
this._target = new Cartesian3();
|
|
182
|
+
this._zoomDirection = new Cartesian3();
|
|
183
|
+
this._zoomDampenedResults = {
|
|
184
|
+
velocity: 0.0,
|
|
185
|
+
value: 0.0,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @inheritdoc
|
|
191
|
+
*/
|
|
192
|
+
get enabled() {
|
|
193
|
+
return this._enabled;
|
|
194
|
+
}
|
|
195
|
+
set enabled(value) {
|
|
196
|
+
this._enabled = value;
|
|
197
|
+
|
|
198
|
+
if (value) {
|
|
199
|
+
this._lastUpdateTime = getTimestamp();
|
|
200
|
+
this._scrollDelta = 0.0;
|
|
201
|
+
this._dragDelta.x = 0.0;
|
|
202
|
+
this._dragDelta.y = 0.0;
|
|
203
|
+
} else if (defined(this._dragInputState)) {
|
|
204
|
+
this._dragInputState.isDragging = false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @private
|
|
210
|
+
* @type {boolean}
|
|
211
|
+
*/
|
|
212
|
+
get isDragging() {
|
|
213
|
+
return defined(this._dragInputState) && this._dragInputState.isDragging;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @inheritdoc
|
|
218
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
219
|
+
*/
|
|
220
|
+
connectedCallback(element) {
|
|
221
|
+
const handler = new ScreenSpaceEventHandler(element);
|
|
222
|
+
this._handler = handler;
|
|
223
|
+
|
|
224
|
+
for (const input of this.scrollInputs) {
|
|
225
|
+
handler.setInputAction(this._handleZoom.bind(this), input);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
handler.setInputAction(
|
|
229
|
+
this._handleZoomPosition.bind(this),
|
|
230
|
+
ScreenSpaceEventType.MOUSE_MOVE,
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
this._dragInputState = ScreenSpaceInputBindings.registerDragInputBindings(
|
|
234
|
+
handler,
|
|
235
|
+
this.dragInputs,
|
|
236
|
+
{
|
|
237
|
+
start: this._handleStartDrag.bind(this),
|
|
238
|
+
change: this._handleDrag.bind(this),
|
|
239
|
+
},
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @inheritdoc
|
|
245
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
246
|
+
*/
|
|
247
|
+
disconnectedCallback(element) {
|
|
248
|
+
const handler = this._handler;
|
|
249
|
+
if (defined(handler) && !handler.isDestroyed()) {
|
|
250
|
+
handler.destroy();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @inheritdoc
|
|
256
|
+
*/
|
|
257
|
+
firstUpdate() {
|
|
258
|
+
this._lastUpdateTime = getTimestamp();
|
|
259
|
+
this._scrollDelta = 0.0;
|
|
260
|
+
this._dragDelta.x = 0.0;
|
|
261
|
+
this._dragDelta.y = 0.0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The current zoom distance of the camera in meters. This is the distance from the camera to the zoom target.
|
|
266
|
+
* @type {number}
|
|
267
|
+
* @private
|
|
268
|
+
*/
|
|
269
|
+
get zoomDistance() {
|
|
270
|
+
return this._zoomDampenedResults.value;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The current zoom velocity of the camera in radians per second.
|
|
275
|
+
* @type {number}
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
get zoomVelocity() {
|
|
279
|
+
return this._zoomDampenedResults.velocity;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The current zoom velocity of the camera in radians per second.
|
|
284
|
+
* @type {number}
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
set zoomVelocity(value) {
|
|
288
|
+
this._zoomDampenedResults.velocity = value;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @inheritdoc
|
|
293
|
+
* @param {Scene} scene
|
|
294
|
+
*/
|
|
295
|
+
update(scene) {
|
|
296
|
+
const now = getTimestamp();
|
|
297
|
+
const dt =
|
|
298
|
+
(now - this._lastUpdateTime) * TimeConstants.SECONDS_PER_MILLISECOND;
|
|
299
|
+
|
|
300
|
+
const { canvas } = scene;
|
|
301
|
+
const { clientWidth, clientHeight } = canvas;
|
|
302
|
+
if (dt === 0 || clientWidth === 0 || clientHeight === 0) {
|
|
303
|
+
this._lastUpdateTime = getTimestamp();
|
|
304
|
+
this._scrollDelta = 0.0;
|
|
305
|
+
this._dragDelta.x = 0;
|
|
306
|
+
this._dragDelta.y = 0;
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let dz = this._scrollDelta + this._dragDelta.y;
|
|
311
|
+
if (dz === 0.0 && this.inertiaEnabled) {
|
|
312
|
+
const damping = Math.exp(-this.inertialDecay * dt);
|
|
313
|
+
this._zoomInputVelocity *= damping;
|
|
314
|
+
dz = this._zoomInputVelocity * dt;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (
|
|
318
|
+
Math.abs(this.zoomVelocity) < this.minimumZoomVelocity &&
|
|
319
|
+
dz <= CesiumMath.EPSILON3 &&
|
|
320
|
+
dz >= -CesiumMath.EPSILON3 &&
|
|
321
|
+
this.zoomVelocity <= CesiumMath.EPSILON3
|
|
322
|
+
) {
|
|
323
|
+
this._lastUpdateTime = getTimestamp();
|
|
324
|
+
this._scrollDelta = 0.0;
|
|
325
|
+
this._dragDelta.x = 0;
|
|
326
|
+
this._dragDelta.y = 0;
|
|
327
|
+
this.zoomVelocity = 0.0;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
this._zoomInputVelocity = CesiumMath.clamp(
|
|
332
|
+
dz / dt,
|
|
333
|
+
-this.maximumZoomVelocity,
|
|
334
|
+
this.maximumZoomVelocity,
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
const { camera, ellipsoid } = scene;
|
|
338
|
+
|
|
339
|
+
let direction = camera.direction;
|
|
340
|
+
let distance =
|
|
341
|
+
Cartesian3.magnitude(camera.positionWC) - ellipsoid.maximumRadius;
|
|
342
|
+
|
|
343
|
+
let windowPosition = this.isDragging
|
|
344
|
+
? this._screenSpaceDragPosition
|
|
345
|
+
: this._screenSpaceScrollPosition;
|
|
346
|
+
if (!this.useDragPosition) {
|
|
347
|
+
windowPosition = this._screenSpaceOrigin;
|
|
348
|
+
windowPosition.x = clientWidth / 2.0;
|
|
349
|
+
windowPosition.y = clientHeight / 2.0;
|
|
350
|
+
}
|
|
351
|
+
const target = this.pickWorldPosition(scene, windowPosition, this._target);
|
|
352
|
+
if (defined(target)) {
|
|
353
|
+
direction = Cartesian3.subtract(
|
|
354
|
+
target,
|
|
355
|
+
camera.positionWC,
|
|
356
|
+
this._zoomDirection,
|
|
357
|
+
);
|
|
358
|
+
direction = Cartesian3.normalize(direction, this._zoomDirection);
|
|
359
|
+
distance = Cartesian3.distance(target, camera.positionWC);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
distance = CesiumMath.clamp(
|
|
363
|
+
distance,
|
|
364
|
+
distance > 0.0 ? this.minimumZoomDistance : -this.maximumZoomDistance,
|
|
365
|
+
distance > 0.0 ? this.maximumZoomDistance : -this.minimumZoomDistance,
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
const zoom = dz * distance * this.zoomDistanceRatio;
|
|
369
|
+
|
|
370
|
+
const smoothTime = this.dampingEnabled
|
|
371
|
+
? this.zoomAnimationDuration
|
|
372
|
+
: undefined;
|
|
373
|
+
this._zoomDampenedResults = CesiumMath.smoothDamp(
|
|
374
|
+
0.0,
|
|
375
|
+
zoom,
|
|
376
|
+
this.zoomVelocity,
|
|
377
|
+
dt,
|
|
378
|
+
undefined,
|
|
379
|
+
smoothTime,
|
|
380
|
+
this._zoomDampenedResults,
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
camera.move(direction, this.zoomDistance);
|
|
384
|
+
|
|
385
|
+
// Reset for next frame
|
|
386
|
+
this._lastUpdateTime = getTimestamp();
|
|
387
|
+
this._scrollDelta = 0.0;
|
|
388
|
+
this._dragDelta.x = 0;
|
|
389
|
+
this._dragDelta.y = 0;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @private
|
|
394
|
+
* @param {number} amount
|
|
395
|
+
*/
|
|
396
|
+
_handleZoom(amount) {
|
|
397
|
+
this._scrollDelta += amount * this.zoomSensitivity;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @private
|
|
402
|
+
*/
|
|
403
|
+
_handleZoomPosition(event) {
|
|
404
|
+
this._screenSpaceScrollPosition.x = event.endPosition.x;
|
|
405
|
+
this._screenSpaceScrollPosition.y = event.endPosition.y;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @private
|
|
410
|
+
*/
|
|
411
|
+
_handleStartDrag(event) {
|
|
412
|
+
if (!this.enabled) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
this._screenSpaceDragPosition.x = event.position.x;
|
|
417
|
+
this._screenSpaceDragPosition.y = event.position.y;
|
|
418
|
+
this._dragDelta.x = 0.0;
|
|
419
|
+
this._dragDelta.y = 0.0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @private
|
|
424
|
+
*/
|
|
425
|
+
_handleDrag(event) {
|
|
426
|
+
this._dragDelta.x += event.endPosition.x - event.startPosition.x;
|
|
427
|
+
this._dragDelta.y += event.endPosition.y - event.startPosition.y;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export default ScreenSpaceZoomCameraController;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
2
|
+
import Cartesian2 from "../../Core/Cartesian2.js";
|
|
3
|
+
import Check from "../../Core/Check.js";
|
|
4
|
+
import defined from "../../Core/defined.js";
|
|
5
|
+
import IntersectionTests from "../../Core/IntersectionTests.js";
|
|
6
|
+
import Plane from "../../Core/Plane.js";
|
|
7
|
+
import Ray from "../../Core/Ray.js";
|
|
8
|
+
|
|
9
|
+
const scratchSurfaceCartesian = new Cartesian3();
|
|
10
|
+
const scratchPlane = new Plane(Cartesian3.UNIT_X, 0.0);
|
|
11
|
+
const scratchRay = new Ray();
|
|
12
|
+
const defaultTargetPixelSize = new Cartesian2(1.0, 1.0, 1.0);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Picks a cartesian worldspace position based on the specified window coordinates and the camera's current position and orientation.
|
|
16
|
+
* <ol>
|
|
17
|
+
* <li>If the camera is above the scene's defined ellipsoid, the position is picked on the ellipsoid.</li>
|
|
18
|
+
* <li> If the camera is below the ellipsoid, a temporary plane is created relative to the camera's position and orientation, and the position is picked on that plane.</li>
|
|
19
|
+
* </ol>
|
|
20
|
+
* @param {Scene} scene The scene to pick the world position from.
|
|
21
|
+
* @param {Cartesian2} windowPosition The x and y coordinates of a pixel.
|
|
22
|
+
* @param {Cartesian3} result The object onto which to store the result.
|
|
23
|
+
* @param {Cartesian2} targetPixelSize The pixel size at the target position, used to preserve relative camera distance from the target position when navigating.
|
|
24
|
+
* @returns {Cartesian3|undefined} The picked cartesian worldspace position, or <code>undefined</code> if no position could be picked.
|
|
25
|
+
* @see {@link ScreenSpaceMapCameraController#pickWorldPosition}
|
|
26
|
+
* @see {@link ScreenSpaceElevatorCameraController#pickWorldPosition}
|
|
27
|
+
* @see {@link ScreenSpaceTiltOrbitCameraController#pickWorldPosition}
|
|
28
|
+
* @see {@link ScreenSpaceZoomCameraController#pickWorldPosition}
|
|
29
|
+
*/
|
|
30
|
+
export default function (
|
|
31
|
+
scene,
|
|
32
|
+
windowPosition,
|
|
33
|
+
result,
|
|
34
|
+
targetPixelSize = defaultTargetPixelSize,
|
|
35
|
+
) {
|
|
36
|
+
//>>includeStart('debug', pragmas.debug);
|
|
37
|
+
Check.typeOf.object("scene", scene);
|
|
38
|
+
Check.typeOf.object("windowPosition", windowPosition);
|
|
39
|
+
Check.typeOf.object("result", result);
|
|
40
|
+
//>>includeEnd('debug');
|
|
41
|
+
|
|
42
|
+
const { camera, ellipsoid } = scene;
|
|
43
|
+
const surface = ellipsoid.scaleToGeodeticSurface(
|
|
44
|
+
camera.positionWC,
|
|
45
|
+
scratchSurfaceCartesian,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Camera is at the origin
|
|
49
|
+
if (!defined(surface)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const cameraMagnitude = Cartesian3.magnitude(camera.positionWC);
|
|
54
|
+
const surfaceMagnitude = Cartesian3.magnitude(surface);
|
|
55
|
+
const belowEllipsoid = cameraMagnitude <= surfaceMagnitude;
|
|
56
|
+
|
|
57
|
+
const normal = ellipsoid.geodeticSurfaceNormal(
|
|
58
|
+
camera.positionWC,
|
|
59
|
+
scratchSurfaceCartesian,
|
|
60
|
+
);
|
|
61
|
+
const dot = Cartesian3.dot(normal, camera.directionWC);
|
|
62
|
+
const lookingUp = dot > 0.0;
|
|
63
|
+
|
|
64
|
+
if (belowEllipsoid || lookingUp) {
|
|
65
|
+
// Camera is inside the ellipsoid. When underground, create a temporary plane beneath the ellipsoid surface to avoid picking a position on the inside and opposite side of the ellipsoid.
|
|
66
|
+
|
|
67
|
+
const plane = Plane.fromPointNormal(
|
|
68
|
+
camera.positionWC,
|
|
69
|
+
normal,
|
|
70
|
+
scratchPlane,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const { clientHeight } = scene.canvas;
|
|
74
|
+
const focusDistance =
|
|
75
|
+
(targetPixelSize.y * clientHeight) /
|
|
76
|
+
(2.0 * Math.tan(camera.frustum.fovy * 0.5));
|
|
77
|
+
|
|
78
|
+
plane.distance -= dot * focusDistance;
|
|
79
|
+
const ray = camera.getPickRay(windowPosition, scratchRay);
|
|
80
|
+
return IntersectionTests.rayPlane(ray, plane, result);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return camera.pickEllipsoid(windowPosition, ellipsoid, result);
|
|
84
|
+
}
|
|
@@ -162,6 +162,29 @@ function styleLightboxContainer(that) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Wraps a callback so that it also runs when a keyboard user activates an element
|
|
167
|
+
* with <code>Enter</code> or <code>Space</code>. Elements exposed as <code>role="button"</code>
|
|
168
|
+
* are expected to respond to both keys, which anchors without an <code>href</code> do not do natively.
|
|
169
|
+
*
|
|
170
|
+
* @param {Function} callback The function to invoke when the element is activated.
|
|
171
|
+
* @returns {Function} A <code>keydown</code> handler.
|
|
172
|
+
*
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
function activateOnKeydown(callback) {
|
|
176
|
+
return function (event) {
|
|
177
|
+
if (event.key !== "Enter" && event.key !== " ") {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// Prevent Space from scrolling the page and stop the event from also
|
|
181
|
+
// reaching the overlay, which would immediately close the lightbox again.
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
event.stopPropagation();
|
|
184
|
+
callback();
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
165
188
|
function appendCss(container) {
|
|
166
189
|
const style = /*css*/ `
|
|
167
190
|
.cesium-credit-lightbox-overlay {
|
|
@@ -237,6 +260,12 @@ function appendCss(container) {
|
|
|
237
260
|
color: ${highlightColor};
|
|
238
261
|
}
|
|
239
262
|
|
|
263
|
+
.cesium-credit-expand-link:focus-visible,
|
|
264
|
+
.cesium-credit-lightbox-close:focus-visible {
|
|
265
|
+
outline: 2px solid ${highlightColor};
|
|
266
|
+
outline-offset: 2px;
|
|
267
|
+
}
|
|
268
|
+
|
|
240
269
|
.cesium-credit-text {
|
|
241
270
|
color: ${textColor};
|
|
242
271
|
}
|
|
@@ -312,6 +341,9 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
312
341
|
|
|
313
342
|
const lightboxCredits = document.createElement("div");
|
|
314
343
|
lightboxCredits.className = "cesium-credit-lightbox";
|
|
344
|
+
lightboxCredits.setAttribute("role", "dialog");
|
|
345
|
+
lightboxCredits.setAttribute("aria-modal", "true");
|
|
346
|
+
lightboxCredits.setAttribute("aria-label", "Data attribution");
|
|
315
347
|
lightbox.appendChild(lightboxCredits);
|
|
316
348
|
|
|
317
349
|
function hideLightbox(event) {
|
|
@@ -322,6 +354,14 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
322
354
|
}
|
|
323
355
|
lightbox.addEventListener("click", hideLightbox, false);
|
|
324
356
|
|
|
357
|
+
function hideLightboxOnEscape(event) {
|
|
358
|
+
if (event.key === "Escape") {
|
|
359
|
+
event.preventDefault();
|
|
360
|
+
that.hideLightbox();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
lightbox.addEventListener("keydown", hideLightboxOnEscape, false);
|
|
364
|
+
|
|
325
365
|
const title = document.createElement("div");
|
|
326
366
|
title.className = "cesium-credit-lightbox-title";
|
|
327
367
|
title.textContent = "Data provided by:";
|
|
@@ -329,8 +369,12 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
329
369
|
|
|
330
370
|
const closeButton = document.createElement("a");
|
|
331
371
|
closeButton.onclick = this.hideLightbox.bind(this);
|
|
372
|
+
closeButton.onkeydown = activateOnKeydown(this.hideLightbox.bind(this));
|
|
332
373
|
closeButton.innerHTML = "×";
|
|
333
374
|
closeButton.className = "cesium-credit-lightbox-close";
|
|
375
|
+
closeButton.setAttribute("role", "button");
|
|
376
|
+
closeButton.setAttribute("tabindex", "0");
|
|
377
|
+
closeButton.setAttribute("aria-label", "Close data attribution");
|
|
334
378
|
lightboxCredits.appendChild(closeButton);
|
|
335
379
|
|
|
336
380
|
const creditList = document.createElement("ul");
|
|
@@ -349,7 +393,12 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
349
393
|
const expandLink = document.createElement("a");
|
|
350
394
|
expandLink.className = "cesium-credit-expand-link";
|
|
351
395
|
expandLink.onclick = this.showLightbox.bind(this);
|
|
396
|
+
expandLink.onkeydown = activateOnKeydown(this.showLightbox.bind(this));
|
|
352
397
|
expandLink.textContent = "Data attribution";
|
|
398
|
+
expandLink.setAttribute("role", "button");
|
|
399
|
+
expandLink.setAttribute("tabindex", "0");
|
|
400
|
+
expandLink.setAttribute("aria-haspopup", "dialog");
|
|
401
|
+
expandLink.setAttribute("aria-expanded", "false");
|
|
353
402
|
container.appendChild(expandLink);
|
|
354
403
|
|
|
355
404
|
appendCss(container);
|
|
@@ -364,7 +413,9 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
364
413
|
this._creditList = creditList;
|
|
365
414
|
this._lightbox = lightbox;
|
|
366
415
|
this._hideLightbox = hideLightbox;
|
|
416
|
+
this._hideLightboxOnEscape = hideLightboxOnEscape;
|
|
367
417
|
this._expandLink = expandLink;
|
|
418
|
+
this._closeButton = closeButton;
|
|
368
419
|
this._expanded = false;
|
|
369
420
|
this._staticCredits = [];
|
|
370
421
|
this._cesiumCredit = cesiumCredit;
|
|
@@ -492,6 +543,9 @@ CreditDisplay.prototype.removeStaticCredit = function (credit) {
|
|
|
492
543
|
CreditDisplay.prototype.showLightbox = function () {
|
|
493
544
|
this._lightbox.style.display = "block";
|
|
494
545
|
this._expanded = true;
|
|
546
|
+
this._expandLink.setAttribute("aria-expanded", "true");
|
|
547
|
+
// Move focus into the dialog so keyboard users can reach its contents.
|
|
548
|
+
this._closeButton.focus();
|
|
495
549
|
};
|
|
496
550
|
|
|
497
551
|
/**
|
|
@@ -500,6 +554,9 @@ CreditDisplay.prototype.showLightbox = function () {
|
|
|
500
554
|
CreditDisplay.prototype.hideLightbox = function () {
|
|
501
555
|
this._lightbox.style.display = "none";
|
|
502
556
|
this._expanded = false;
|
|
557
|
+
this._expandLink.setAttribute("aria-expanded", "false");
|
|
558
|
+
// Restore focus to the element that opened the dialog.
|
|
559
|
+
this._expandLink.focus();
|
|
503
560
|
};
|
|
504
561
|
|
|
505
562
|
/**
|
|
@@ -581,6 +638,11 @@ CreditDisplay.prototype.endFrame = function () {
|
|
|
581
638
|
*/
|
|
582
639
|
CreditDisplay.prototype.destroy = function () {
|
|
583
640
|
this._lightbox.removeEventListener("click", this._hideLightbox, false);
|
|
641
|
+
this._lightbox.removeEventListener(
|
|
642
|
+
"keydown",
|
|
643
|
+
this._hideLightboxOnEscape,
|
|
644
|
+
false,
|
|
645
|
+
);
|
|
584
646
|
|
|
585
647
|
this.container.removeChild(this._cesiumCreditContainer);
|
|
586
648
|
this.container.removeChild(this._screenContainer);
|