@reearth/core 0.0.7-alpha.5 → 0.0.7-alpha.50
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/dist/core.js +58676 -51066
- package/dist/core.umd.cjs +3959 -3915
- package/dist/{index-DqatWUTw.js → index-DqGWVPtz.js} +0 -1
- package/dist/index.d.ts +150 -34
- package/package.json +55 -39
- package/src/Map/ClusteredLayers/index.tsx +1 -1
- package/src/Map/Geoid/index.tsx +68 -0
- package/src/Map/Geoid/types.ts +8 -0
- package/src/Map/Layer/hooks.ts +7 -4
- package/src/Map/Layer/index.tsx +3 -1
- package/src/Map/Layers/hooks.ts +19 -2
- package/src/Map/Layers/index.tsx +13 -2
- package/src/Map/Layers/keys.ts +1 -0
- package/src/Map/Sketch/hooks.ts +453 -410
- package/src/Map/Sketch/index.tsx +67 -20
- package/src/Map/Sketch/sketchMachine.ts +359 -4
- package/src/Map/Sketch/sketchMachine.typegen.ts +58 -1
- package/src/Map/Sketch/types.ts +10 -20
- package/src/Map/Sketch/usePluginSketchLayer.ts +105 -0
- package/src/Map/Sketch/useSketch.ts +559 -0
- package/src/Map/Sketch/useSketchFeature.ts +198 -0
- package/src/Map/SpatialId/constants.ts +21 -0
- package/src/Map/SpatialId/hooks.ts +448 -0
- package/src/Map/SpatialId/index.tsx +63 -0
- package/src/Map/SpatialId/types.ts +68 -0
- package/src/Map/SpatialId/utils.ts +65 -0
- package/src/Map/hooks.ts +54 -8
- package/src/Map/index.tsx +41 -8
- package/src/Map/ref.ts +32 -3
- package/src/Map/types/index.ts +39 -3
- package/src/Map/types/viewerProperty.ts +10 -0
- package/src/Map/useTimelineManager.ts +2 -2
- package/src/Map/utils.ts +1 -1
- package/src/Visualizer/context.tsx +5 -5
- package/src/Visualizer/coreContext.tsx +2 -0
- package/src/Visualizer/hooks.ts +54 -20
- package/src/Visualizer/index.tsx +22 -3
- package/src/Visualizer/interactionMode.ts +2 -1
- package/src/Visualizer/useViewport.ts +1 -1
- package/src/engines/Cesium/Feature/Box/hooks/box.ts +4 -4
- package/src/engines/Cesium/Feature/HeatMap/HeatmapMesh.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.tsx +3 -3
- package/src/engines/Cesium/Feature/PhotoOverlay/hooks.ts +1 -1
- package/src/engines/Cesium/Feature/PhotoOverlay/index.tsx +3 -1
- package/src/engines/Cesium/Feature/Polygon/index.tsx +6 -4
- package/src/engines/Cesium/Feature/Raster/mvt.ts +2 -1
- package/src/engines/Cesium/Feature/Resource/utils.ts +86 -91
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +135 -70
- package/src/engines/Cesium/Feature/Tileset/index.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +2 -2
- package/src/engines/Cesium/Feature/context.ts +1 -0
- package/src/engines/Cesium/Feature/index.tsx +7 -3
- package/src/engines/Cesium/Feature/utils.tsx +18 -7
- package/src/engines/Cesium/Shaders/OverriddenShaders/GlobeFS/IBL.glsl +6 -10
- package/src/engines/Cesium/Sketch/ControlPoint.tsx +128 -24
- package/src/engines/Cesium/Sketch/ExtrudedControlPoints.tsx +70 -25
- package/src/engines/Cesium/Sketch/ExtrudedMeasurement.tsx +3 -1
- package/src/engines/Cesium/Sketch/ExtrudedPolygonEntity.tsx +14 -14
- package/src/engines/Cesium/Sketch/PolylineEntity.tsx +7 -4
- package/src/engines/Cesium/Sketch/SurfaceAddingPoints.tsx +60 -0
- package/src/engines/Cesium/Sketch/SurfaceControlPoints.tsx +125 -35
- package/src/engines/Cesium/Sketch/constants.ts +5 -0
- package/src/engines/Cesium/Sketch/index.tsx +68 -29
- package/src/engines/Cesium/SpatialId/CoordinateIndicator.tsx +28 -0
- package/src/engines/Cesium/SpatialId/SpatialIdSpace.tsx +33 -0
- package/src/engines/Cesium/SpatialId/VerticalSpaceIndicator.tsx +32 -0
- package/src/engines/Cesium/SpatialId/index.ts +3 -0
- package/src/engines/Cesium/common.ts +52 -16
- package/src/engines/Cesium/core/Clock.tsx +1 -1
- package/src/engines/Cesium/core/Globe/index.tsx +73 -0
- package/src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts +79 -0
- package/src/engines/Cesium/core/Imagery.test.ts +29 -11
- package/src/engines/Cesium/core/Imagery.tsx +22 -6
- package/src/engines/Cesium/core/Indicator/Indicator.tsx +1 -1
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImagery.tsx +9 -2
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapVectorMapLabel.tsx +14 -2
- package/src/engines/Cesium/core/labels/LabelImageryLayers.tsx +10 -1
- package/src/engines/Cesium/core/presets.ts +24 -28
- package/src/engines/Cesium/helpers/getGeometryFromEntity.ts +55 -0
- package/src/engines/Cesium/hooks/useCamera.ts +1 -1
- package/src/engines/Cesium/hooks/useCameraLimiter.ts +1 -1
- package/src/engines/Cesium/hooks/useEngineRef.ts +48 -3
- package/src/engines/Cesium/hooks/useExplicitRender.ts +2 -2
- package/src/engines/Cesium/hooks/useInstance.ts +1 -1
- package/src/engines/Cesium/hooks/useLayerDragDrop.ts +2 -2
- package/src/engines/Cesium/hooks/useLayerSelectWithRect.ts +1 -1
- package/src/engines/Cesium/hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts +98 -52
- package/src/engines/Cesium/hooks/useViewerProperty.ts +1 -1
- package/src/engines/Cesium/hooks.ts +52 -10
- package/src/engines/Cesium/index.tsx +16 -3
- package/src/engines/Cesium/types.ts +1 -1
- package/src/mantle/atoms/compute.ts +8 -3
- package/src/mantle/data/geojson.ts +53 -22
- package/src/mantle/data/shapefile/parseZip.ts +1 -0
- package/src/mantle/evaluator/simple/expression/expression.test.ts +72 -0
- package/src/mantle/evaluator/simple/expression/node.ts +10 -12
- package/src/mantle/types/appearance.ts +4 -2
- package/src/mantle/types/index.ts +3 -0
- package/src/test/utils.tsx +1 -1
- package/src/utils/image.ts +2 -12
- package/src/utils/use-delayed-count.ts +1 -1
- package/src/utils/use-dnd/drop.ts +1 -1
- package/src/utils/util.ts +1 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1
- package/dist/cesium/Assets/Images/bing_maps_credit.png +0 -0
- package/dist/cesium/Assets/Images/cesium_credit.png +0 -0
- package/dist/cesium/Assets/Images/google_earth_credit.png +0 -0
- package/dist/cesium/Assets/Images/ion-credit.png +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- package/dist/cesium/Assets/Textures/maki/airfield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/airport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/alcohol-shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/america-football.png +0 -0
- package/dist/cesium/Assets/Textures/maki/art-gallery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bakery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bank.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bar.png +0 -0
- package/dist/cesium/Assets/Textures/maki/baseball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/basketball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/beer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bicycle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/building.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bus.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cafe.png +0 -0
- package/dist/cesium/Assets/Textures/maki/camera.png +0 -0
- package/dist/cesium/Assets/Textures/maki/campsite.png +0 -0
- package/dist/cesium/Assets/Textures/maki/car.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cemetery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cesium.png +0 -0
- package/dist/cesium/Assets/Textures/maki/chemist.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cinema.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/city.png +0 -0
- package/dist/cesium/Assets/Textures/maki/clothing-store.png +0 -0
- package/dist/cesium/Assets/Textures/maki/college.png +0 -0
- package/dist/cesium/Assets/Textures/maki/commercial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cricket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cross.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dam.png +0 -0
- package/dist/cesium/Assets/Textures/maki/danger.png +0 -0
- package/dist/cesium/Assets/Textures/maki/disability.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dog-park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/embassy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/emergency-telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/entrance.png +0 -0
- package/dist/cesium/Assets/Textures/maki/farm.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fast-food.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ferry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fire-station.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fuel.png +0 -0
- package/dist/cesium/Assets/Textures/maki/garden.png +0 -0
- package/dist/cesium/Assets/Textures/maki/gift.png +0 -0
- package/dist/cesium/Assets/Textures/maki/golf.png +0 -0
- package/dist/cesium/Assets/Textures/maki/grocery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hairdresser.png +0 -0
- package/dist/cesium/Assets/Textures/maki/harbor.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heart.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heliport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hospital.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ice-cream.png +0 -0
- package/dist/cesium/Assets/Textures/maki/industrial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/land-use.png +0 -0
- package/dist/cesium/Assets/Textures/maki/laundry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/library.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lighthouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lodging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/logging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/london-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker.png +0 -0
- package/dist/cesium/Assets/Textures/maki/minefield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/mobilephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/monument.png +0 -0
- package/dist/cesium/Assets/Textures/maki/museum.png +0 -0
- package/dist/cesium/Assets/Textures/maki/music.png +0 -0
- package/dist/cesium/Assets/Textures/maki/oil-well.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park2.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking-garage.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pharmacy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pitch.png +0 -0
- package/dist/cesium/Assets/Textures/maki/place-of-worship.png +0 -0
- package/dist/cesium/Assets/Textures/maki/playground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/police.png +0 -0
- package/dist/cesium/Assets/Textures/maki/polling-place.png +0 -0
- package/dist/cesium/Assets/Textures/maki/post.png +0 -0
- package/dist/cesium/Assets/Textures/maki/prison.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-above.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-light.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-metro.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-christian.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-jewish.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-muslim.png +0 -0
- package/dist/cesium/Assets/Textures/maki/restaurant.png +0 -0
- package/dist/cesium/Assets/Textures/maki/roadblock.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rocket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/school.png +0 -0
- package/dist/cesium/Assets/Textures/maki/scooter.png +0 -0
- package/dist/cesium/Assets/Textures/maki/shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/skiing.png +0 -0
- package/dist/cesium/Assets/Textures/maki/slaughterhouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/soccer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star.png +0 -0
- package/dist/cesium/Assets/Textures/maki/suitcase.png +0 -0
- package/dist/cesium/Assets/Textures/maki/swimming.png +0 -0
- package/dist/cesium/Assets/Textures/maki/telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/tennis.png +0 -0
- package/dist/cesium/Assets/Textures/maki/theatre.png +0 -0
- package/dist/cesium/Assets/Textures/maki/toilets.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town-hall.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/village.png +0 -0
- package/dist/cesium/Assets/Textures/maki/warehouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/waste-basket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/water.png +0 -0
- package/dist/cesium/Assets/Textures/maki/wetland.png +0 -0
- package/dist/cesium/Assets/Textures/maki/zoo.png +0 -0
- package/dist/cesium/Assets/Textures/moonSmall.jpg +0 -0
- package/dist/cesium/Assets/Textures/pin.svg +0 -1
- package/dist/cesium/Assets/Textures/waterNormals.jpg +0 -0
- package/dist/cesium/Assets/Textures/waterNormalsSmall.jpg +0 -0
- package/dist/cesium/Assets/approximateTerrainHeights.json +0 -1
- package/dist/cesium/ThirdParty/Workers/package.json +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_deflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_inflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/z-worker-pako.js +0 -1
- package/dist/cesium/ThirdParty/basis_transcoder.wasm +0 -0
- package/dist/cesium/ThirdParty/draco_decoder.wasm +0 -0
- package/dist/cesium/ThirdParty/google-earth-dbroot-parser.js +0 -1
- package/dist/cesium/Widgets/Animation/Animation.css +0 -127
- package/dist/cesium/Widgets/Animation/lighter.css +0 -70
- package/dist/cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -108
- package/dist/cesium/Widgets/BaseLayerPicker/lighter.css +0 -22
- package/dist/cesium/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -102
- package/dist/cesium/Widgets/CesiumInspector/CesiumInspector.css +0 -113
- package/dist/cesium/Widgets/CesiumWidget/CesiumWidget.css +0 -124
- package/dist/cesium/Widgets/CesiumWidget/lighter.css +0 -14
- package/dist/cesium/Widgets/FullscreenButton/FullscreenButton.css +0 -8
- package/dist/cesium/Widgets/Geocoder/Geocoder.css +0 -70
- package/dist/cesium/Widgets/Geocoder/lighter.css +0 -17
- package/dist/cesium/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
- package/dist/cesium/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/Touch.svg +0 -120
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
- package/dist/cesium/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
- package/dist/cesium/Widgets/Images/TimelineIcons.png +0 -0
- package/dist/cesium/Widgets/Images/info-loading.gif +0 -0
- package/dist/cesium/Widgets/InfoBox/InfoBox.css +0 -92
- package/dist/cesium/Widgets/InfoBox/InfoBoxDescription.css +0 -178
- package/dist/cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -93
- package/dist/cesium/Widgets/NavigationHelpButton/lighter.css +0 -38
- package/dist/cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
- package/dist/cesium/Widgets/ProjectionPicker/ProjectionPicker.css +0 -38
- package/dist/cesium/Widgets/SceneModePicker/SceneModePicker.css +0 -56
- package/dist/cesium/Widgets/SelectionIndicator/SelectionIndicator.css +0 -20
- package/dist/cesium/Widgets/Timeline/Timeline.css +0 -103
- package/dist/cesium/Widgets/Timeline/lighter.css +0 -23
- package/dist/cesium/Widgets/VRButton/VRButton.css +0 -8
- package/dist/cesium/Widgets/Viewer/Viewer.css +0 -107
- package/dist/cesium/Widgets/VoxelInspector/VoxelInspector.css +0 -16
- package/dist/cesium/Widgets/lighter.css +0 -237
- package/dist/cesium/Widgets/lighterShared.css +0 -46
- package/dist/cesium/Widgets/shared.css +0 -103
- package/dist/cesium/Widgets/widgets.css +0 -1346
- package/dist/cesium/Workers/chunk-2ED5WI77.js +0 -26
- package/dist/cesium/Workers/chunk-2MBPFWCP.js +0 -26
- package/dist/cesium/Workers/chunk-3C74MLG3.js +0 -26
- package/dist/cesium/Workers/chunk-45U7TTT3.js +0 -26
- package/dist/cesium/Workers/chunk-4N7SRDH5.js +0 -26
- package/dist/cesium/Workers/chunk-4T6AS6BZ.js +0 -26
- package/dist/cesium/Workers/chunk-5AG2MVRM.js +0 -26
- package/dist/cesium/Workers/chunk-5Z6L2FHX.js +0 -26
- package/dist/cesium/Workers/chunk-6AUUBDOF.js +0 -26
- package/dist/cesium/Workers/chunk-74N6MC2V.js +0 -26
- package/dist/cesium/Workers/chunk-7VJK3KHI.js +0 -26
- package/dist/cesium/Workers/chunk-7VZHIB6P.js +0 -26
- package/dist/cesium/Workers/chunk-7X2YQ6I4.js +0 -27
- package/dist/cesium/Workers/chunk-B2SKQ7LU.js +0 -26
- package/dist/cesium/Workers/chunk-B4TQDFIE.js +0 -26
- package/dist/cesium/Workers/chunk-B6TRTFAA.js +0 -26
- package/dist/cesium/Workers/chunk-BK3HCS7I.js +0 -26
- package/dist/cesium/Workers/chunk-BOPB43LN.js +0 -26
- package/dist/cesium/Workers/chunk-C6DMEJQ7.js +0 -26
- package/dist/cesium/Workers/chunk-CN7UN2OZ.js +0 -26
- package/dist/cesium/Workers/chunk-CSISXEG7.js +0 -26
- package/dist/cesium/Workers/chunk-CUOR5F7T.js +0 -28
- package/dist/cesium/Workers/chunk-DGCK3LD2.js +0 -30
- package/dist/cesium/Workers/chunk-DXEZYE3K.js +0 -62
- package/dist/cesium/Workers/chunk-EXBFEYPQ.js +0 -26
- package/dist/cesium/Workers/chunk-FK5KFB6H.js +0 -26
- package/dist/cesium/Workers/chunk-HPBHKP5S.js +0 -26
- package/dist/cesium/Workers/chunk-JCJ24DHF.js +0 -26
- package/dist/cesium/Workers/chunk-JEWHFDAA.js +0 -26
- package/dist/cesium/Workers/chunk-JZLZJJQD.js +0 -26
- package/dist/cesium/Workers/chunk-KRZBI2MU.js +0 -26
- package/dist/cesium/Workers/chunk-KTTUANTJ.js +0 -26
- package/dist/cesium/Workers/chunk-LDCAXLGS.js +0 -26
- package/dist/cesium/Workers/chunk-LOPN5R3I.js +0 -26
- package/dist/cesium/Workers/chunk-MDLPQIMP.js +0 -26
- package/dist/cesium/Workers/chunk-MRR3RGFO.js +0 -26
- package/dist/cesium/Workers/chunk-NPBZI5YA.js +0 -26
- package/dist/cesium/Workers/chunk-NUSW5B6A.js +0 -26
- package/dist/cesium/Workers/chunk-OUXRUXNB.js +0 -26
- package/dist/cesium/Workers/chunk-QPOPEH3M.js +0 -26
- package/dist/cesium/Workers/chunk-R2AN7EKC.js +0 -26
- package/dist/cesium/Workers/chunk-RURL6ZX2.js +0 -26
- package/dist/cesium/Workers/chunk-SUQM3OSW.js +0 -28
- package/dist/cesium/Workers/chunk-UBIRX2SP.js +0 -26
- package/dist/cesium/Workers/chunk-VAKC5J5C.js +0 -26
- package/dist/cesium/Workers/chunk-VHNZBQTR.js +0 -27
- package/dist/cesium/Workers/chunk-VKV642QV.js +0 -26
- package/dist/cesium/Workers/chunk-VMSXG4OA.js +0 -26
- package/dist/cesium/Workers/chunk-VQZSIOZW.js +0 -26
- package/dist/cesium/Workers/chunk-WZUWQMI7.js +0 -26
- package/dist/cesium/Workers/chunk-YBI55DLZ.js +0 -26
- package/dist/cesium/Workers/chunk-YEJWCH6C.js +0 -26
- package/dist/cesium/Workers/chunk-YPDO7SPO.js +0 -26
- package/dist/cesium/Workers/chunk-ZYWD6OQH.js +0 -26
- package/dist/cesium/Workers/combineGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createGeometry.js +0 -26
- package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createSimplePolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createTaskProcessorWorker.js +0 -26
- package/dist/cesium/Workers/createVectorTileClampedPolylines.js +0 -26
- package/dist/cesium/Workers/createVectorTileGeometries.js +0 -26
- package/dist/cesium/Workers/createVectorTilePoints.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolygons.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolylines.js +0 -26
- package/dist/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -26
- package/dist/cesium/Workers/createVerticesFromHeightmap.js +0 -26
- package/dist/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -26
- package/dist/cesium/Workers/createWallGeometry.js +0 -26
- package/dist/cesium/Workers/createWallOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/decodeDraco.js +0 -26
- package/dist/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +0 -26
- package/dist/cesium/Workers/decodeI3S.js +0 -26
- package/dist/cesium/Workers/transcodeKTX2.js +0 -56
- package/dist/cesium/Workers/transferTypedArrayTest.js +0 -26
- package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
- package/src/engines/Cesium/core/Globe.tsx +0 -104
- /package/src/{Map/Sketch/utils.ts → utils/use-window-event.ts} +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Dispatch, RefObject, SetStateAction, useCallback } from "react";
|
|
2
|
+
|
|
3
|
+
import { LazyLayer } from "../Layers";
|
|
4
|
+
import { LayersRef } from "../types";
|
|
5
|
+
|
|
6
|
+
import { SketchEventProps, SketchFeature, SketchOptions, SketchType } from "./types";
|
|
7
|
+
|
|
8
|
+
import { OnLayerSelectType } from ".";
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
sketchOptions: SketchOptions;
|
|
12
|
+
from: "editor" | "plugin";
|
|
13
|
+
updateType: Dispatch<SetStateAction<SketchType | undefined>>;
|
|
14
|
+
layersRef: RefObject<LayersRef | null>;
|
|
15
|
+
pluginSketchLayerCreate: (feature: SketchFeature) => {
|
|
16
|
+
layerId: string | undefined;
|
|
17
|
+
featureId: string;
|
|
18
|
+
};
|
|
19
|
+
pluginSketchLayerFeatureAdd: (
|
|
20
|
+
layer: LazyLayer,
|
|
21
|
+
feature: SketchFeature,
|
|
22
|
+
) =>
|
|
23
|
+
| {
|
|
24
|
+
layerId?: undefined;
|
|
25
|
+
featureId?: undefined;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
layerId: string;
|
|
29
|
+
featureId: string;
|
|
30
|
+
};
|
|
31
|
+
pluginSketchLayerFeatureUpdate: (
|
|
32
|
+
layer: LazyLayer,
|
|
33
|
+
feature: SketchFeature,
|
|
34
|
+
) =>
|
|
35
|
+
| {
|
|
36
|
+
layerId?: undefined;
|
|
37
|
+
featureId?: undefined;
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
layerId: string;
|
|
41
|
+
featureId: string;
|
|
42
|
+
};
|
|
43
|
+
pluginSketchLayerFeatureRemove: (layer: LazyLayer, featureId: string) => void;
|
|
44
|
+
onSketchFeatureCreate?: (feature: SketchFeature | null) => void;
|
|
45
|
+
onSketchFeatureUpdate?: (feature: SketchFeature) => void;
|
|
46
|
+
onSketchFeatureDelete?: (layerId: string, featureId: string) => void;
|
|
47
|
+
onSketchPluginFeatureCreate?: (props: SketchEventProps) => void;
|
|
48
|
+
onSketchPluginFeatureUpdate?: (props: SketchEventProps) => void;
|
|
49
|
+
onSketchPluginFeatureDelete?: (props: { layerId: string; featureId: string }) => void;
|
|
50
|
+
onLayerSelect?: OnLayerSelectType;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default ({
|
|
54
|
+
sketchOptions,
|
|
55
|
+
from,
|
|
56
|
+
updateType,
|
|
57
|
+
layersRef,
|
|
58
|
+
onSketchFeatureCreate,
|
|
59
|
+
pluginSketchLayerCreate,
|
|
60
|
+
pluginSketchLayerFeatureAdd,
|
|
61
|
+
pluginSketchLayerFeatureUpdate,
|
|
62
|
+
pluginSketchLayerFeatureRemove,
|
|
63
|
+
onSketchPluginFeatureCreate,
|
|
64
|
+
onSketchPluginFeatureUpdate,
|
|
65
|
+
onSketchPluginFeatureDelete,
|
|
66
|
+
onSketchFeatureUpdate,
|
|
67
|
+
onSketchFeatureDelete,
|
|
68
|
+
onLayerSelect,
|
|
69
|
+
}: Props) => {
|
|
70
|
+
const handleFeatureCreate = useCallback(
|
|
71
|
+
(feature: SketchFeature) => {
|
|
72
|
+
if (sketchOptions.autoResetInteractionMode) {
|
|
73
|
+
updateType(undefined);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (from === "editor" && sketchOptions.dataOnly) {
|
|
77
|
+
onSketchFeatureCreate?.(feature);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!sketchOptions.dataOnly) {
|
|
82
|
+
const selectedLayer = layersRef.current?.selectedLayer();
|
|
83
|
+
const { layerId, featureId } =
|
|
84
|
+
!layersRef?.current?.isTempLayer(selectedLayer?.id) ||
|
|
85
|
+
selectedLayer?.type !== "simple" ||
|
|
86
|
+
selectedLayer.computed?.layer.type !== "simple"
|
|
87
|
+
? pluginSketchLayerCreate(feature)
|
|
88
|
+
: pluginSketchLayerFeatureAdd(selectedLayer, feature);
|
|
89
|
+
|
|
90
|
+
if (layerId && featureId) {
|
|
91
|
+
requestAnimationFrame(() => {
|
|
92
|
+
onLayerSelect?.(
|
|
93
|
+
layerId,
|
|
94
|
+
featureId,
|
|
95
|
+
layerId
|
|
96
|
+
? () =>
|
|
97
|
+
new Promise(resolve => {
|
|
98
|
+
// Wait until computed feature is ready
|
|
99
|
+
queueMicrotask(() => {
|
|
100
|
+
resolve(layersRef.current?.findById?.(layerId)?.computed);
|
|
101
|
+
});
|
|
102
|
+
})
|
|
103
|
+
: undefined,
|
|
104
|
+
undefined,
|
|
105
|
+
undefined,
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
onSketchPluginFeatureCreate?.({ layerId, featureId, feature });
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
onSketchPluginFeatureCreate?.({ feature });
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[
|
|
116
|
+
layersRef,
|
|
117
|
+
from,
|
|
118
|
+
sketchOptions.dataOnly,
|
|
119
|
+
sketchOptions.autoResetInteractionMode,
|
|
120
|
+
pluginSketchLayerCreate,
|
|
121
|
+
pluginSketchLayerFeatureAdd,
|
|
122
|
+
onSketchFeatureCreate,
|
|
123
|
+
onSketchPluginFeatureCreate,
|
|
124
|
+
onLayerSelect,
|
|
125
|
+
updateType,
|
|
126
|
+
],
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const handleFeatureUpdate = useCallback(
|
|
130
|
+
(feature: SketchFeature) => {
|
|
131
|
+
if (from === "editor" && sketchOptions.dataOnly) {
|
|
132
|
+
onSketchFeatureUpdate?.(feature);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!sketchOptions.dataOnly) {
|
|
137
|
+
const selectedLayer = layersRef.current?.selectedLayer();
|
|
138
|
+
if (!selectedLayer) return;
|
|
139
|
+
|
|
140
|
+
const { layerId, featureId } = pluginSketchLayerFeatureUpdate(selectedLayer, feature);
|
|
141
|
+
|
|
142
|
+
if (layerId && featureId) {
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
layersRef.current?.selectFeatures([
|
|
145
|
+
{
|
|
146
|
+
layerId,
|
|
147
|
+
featureId: [featureId],
|
|
148
|
+
},
|
|
149
|
+
]);
|
|
150
|
+
}, 20);
|
|
151
|
+
|
|
152
|
+
onSketchPluginFeatureUpdate?.({ layerId, featureId, feature });
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
onSketchPluginFeatureUpdate?.({ feature });
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
[
|
|
159
|
+
from,
|
|
160
|
+
sketchOptions.dataOnly,
|
|
161
|
+
layersRef,
|
|
162
|
+
pluginSketchLayerFeatureUpdate,
|
|
163
|
+
onSketchFeatureUpdate,
|
|
164
|
+
onSketchPluginFeatureUpdate,
|
|
165
|
+
],
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const handleFeatureDelete = useCallback(
|
|
169
|
+
(layerId: string, featureId: string) => {
|
|
170
|
+
if (from === "editor" && sketchOptions.dataOnly) {
|
|
171
|
+
onSketchFeatureDelete?.(layerId, featureId);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!sketchOptions.dataOnly) {
|
|
176
|
+
const layer = layersRef.current?.findById(layerId);
|
|
177
|
+
if (!layer) return;
|
|
178
|
+
pluginSketchLayerFeatureRemove(layer, featureId);
|
|
179
|
+
layersRef.current?.selectFeatures([]);
|
|
180
|
+
}
|
|
181
|
+
onSketchPluginFeatureDelete?.({ layerId, featureId });
|
|
182
|
+
},
|
|
183
|
+
[
|
|
184
|
+
from,
|
|
185
|
+
sketchOptions.dataOnly,
|
|
186
|
+
layersRef,
|
|
187
|
+
pluginSketchLayerFeatureRemove,
|
|
188
|
+
onSketchFeatureDelete,
|
|
189
|
+
onSketchPluginFeatureDelete,
|
|
190
|
+
],
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
handleFeatureCreate,
|
|
195
|
+
handleFeatureUpdate,
|
|
196
|
+
handleFeatureDelete,
|
|
197
|
+
};
|
|
198
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SpatialIdPickSpaceOptions } from "./types";
|
|
2
|
+
|
|
3
|
+
export const SPATIALID_DEFAULT_OPTIONS: Required<SpatialIdPickSpaceOptions> = {
|
|
4
|
+
zoom: 20,
|
|
5
|
+
maxHeight: 4000,
|
|
6
|
+
minHeight: -1000,
|
|
7
|
+
dataOnly: false,
|
|
8
|
+
rightClickToExit: true,
|
|
9
|
+
color: "#00bebe44",
|
|
10
|
+
outlineColor: "#00bebe55",
|
|
11
|
+
groundIndicatorColor: "#00000066",
|
|
12
|
+
selectorColor: "#ff990099",
|
|
13
|
+
selectorOutlineColor: "#ff9900aa",
|
|
14
|
+
verticalSpaceIndicatorColor: "#ffffff33",
|
|
15
|
+
verticalSpaceIndicatorOutlineColor: "#ffffff55",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const SPATIALID_LATITUDE_RANGE = {
|
|
19
|
+
min: -85.0511,
|
|
20
|
+
max: 85.0511,
|
|
21
|
+
};
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ForwardedRef,
|
|
3
|
+
RefObject,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useImperativeHandle,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { v4 as uuid } from "uuid";
|
|
12
|
+
|
|
13
|
+
import { useWindowEvent } from "../../utils/use-window-event";
|
|
14
|
+
import { InteractionModeType } from "../../Visualizer";
|
|
15
|
+
import { GeoidRef } from "../Geoid/types";
|
|
16
|
+
import { EngineRef, MouseEventProps } from "../types";
|
|
17
|
+
|
|
18
|
+
import { SPATIALID_DEFAULT_OPTIONS, SPATIALID_LATITUDE_RANGE } from "./constants";
|
|
19
|
+
import {
|
|
20
|
+
SpatialIdRef,
|
|
21
|
+
SpatialIdSpacePickingState,
|
|
22
|
+
SpatialIdSpaceType,
|
|
23
|
+
SpatialIdSpaceData,
|
|
24
|
+
SpatialIdPickSpaceOptions,
|
|
25
|
+
VerticalSpaceIndicatorType,
|
|
26
|
+
CoordinateSelectorType,
|
|
27
|
+
} from "./types";
|
|
28
|
+
import { createSpatialIdSpace, getSpaceData, getVerticalLimits } from "./utils";
|
|
29
|
+
|
|
30
|
+
type Props = {
|
|
31
|
+
ref: ForwardedRef<SpatialIdRef>;
|
|
32
|
+
engineRef: RefObject<EngineRef | null>;
|
|
33
|
+
geoidRef: RefObject<GeoidRef | null>;
|
|
34
|
+
terrainEnabled?: boolean;
|
|
35
|
+
interactionMode?: InteractionModeType;
|
|
36
|
+
overrideInteractionMode?: (mode: InteractionModeType) => void;
|
|
37
|
+
onMount?: () => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default ({
|
|
41
|
+
ref,
|
|
42
|
+
engineRef,
|
|
43
|
+
geoidRef,
|
|
44
|
+
terrainEnabled,
|
|
45
|
+
interactionMode,
|
|
46
|
+
overrideInteractionMode,
|
|
47
|
+
onMount,
|
|
48
|
+
}: Props) => {
|
|
49
|
+
const [state, setState] = useState<SpatialIdSpacePickingState>("idle");
|
|
50
|
+
|
|
51
|
+
const [spatialIdSpaces, setSpatialIdSpaces] = useState<SpatialIdSpaceType[] | null>(null);
|
|
52
|
+
const [verticalSpaceIndicator, setVerticalSpaceIndicator] =
|
|
53
|
+
useState<VerticalSpaceIndicatorType | null>(null);
|
|
54
|
+
const [coordinateSelector, setCoordinateSelector] = useState<CoordinateSelectorType | null>(null);
|
|
55
|
+
const lastCoordinateSelector = useRef<CoordinateSelectorType | null>(null);
|
|
56
|
+
const [spaceSelector, setSpaceSelector] = useState<SpatialIdSpaceType | null>(null);
|
|
57
|
+
const centerGeoidHeightRef = useRef<number | null>(null);
|
|
58
|
+
|
|
59
|
+
const [basePosition, setBasePosition] = useState<[number, number, number] | null>(null);
|
|
60
|
+
const [baseCoordinateGeoid, setBaseCoordinateGeoid] = useState<[number, number, number] | null>(
|
|
61
|
+
null,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const [pickOptions, setPickOptions] =
|
|
65
|
+
useState<Required<SpatialIdPickSpaceOptions>>(SPATIALID_DEFAULT_OPTIONS);
|
|
66
|
+
|
|
67
|
+
const verticalLimits = useMemo(
|
|
68
|
+
() => getVerticalLimits(pickOptions.maxHeight, pickOptions.minHeight, pickOptions.zoom),
|
|
69
|
+
[pickOptions.maxHeight, pickOptions.minHeight, pickOptions.zoom],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const groundIndicators = useMemo(() => {
|
|
73
|
+
const allSpaces = [...(spatialIdSpaces ?? []), ...(spaceSelector ? [spaceSelector] : [])];
|
|
74
|
+
|
|
75
|
+
if (!allSpaces) return null;
|
|
76
|
+
|
|
77
|
+
const uniqueSpaces = allSpaces.reduce((acc, space) => {
|
|
78
|
+
if (
|
|
79
|
+
!acc.find(
|
|
80
|
+
s =>
|
|
81
|
+
s.space.zfxy.z === space.space.zfxy.z &&
|
|
82
|
+
s.space.zfxy.x === space.space.zfxy.x &&
|
|
83
|
+
s.space.zfxy.y === space.space.zfxy.y,
|
|
84
|
+
)
|
|
85
|
+
) {
|
|
86
|
+
acc.push(space);
|
|
87
|
+
}
|
|
88
|
+
return acc;
|
|
89
|
+
}, [] as SpatialIdSpaceType[]);
|
|
90
|
+
|
|
91
|
+
if (uniqueSpaces.length === 0) return null;
|
|
92
|
+
|
|
93
|
+
return uniqueSpaces.map(space => {
|
|
94
|
+
const { wsen } = space;
|
|
95
|
+
return {
|
|
96
|
+
id: uuid(),
|
|
97
|
+
spaceId: space.space.id,
|
|
98
|
+
wsen,
|
|
99
|
+
color: pickOptions.groundIndicatorColor,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}, [spatialIdSpaces, spaceSelector, pickOptions.groundIndicatorColor]);
|
|
103
|
+
|
|
104
|
+
const pickSpace = useCallback(
|
|
105
|
+
(options?: SpatialIdPickSpaceOptions) => {
|
|
106
|
+
setState("coordinate");
|
|
107
|
+
setPickOptions(prev => ({ ...prev, ...options }));
|
|
108
|
+
overrideInteractionMode?.("spatialId");
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
engineRef.current?.setCursor("crosshair");
|
|
111
|
+
}, 100);
|
|
112
|
+
},
|
|
113
|
+
[engineRef, overrideInteractionMode],
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const interactionModeRef = useRef(interactionMode);
|
|
117
|
+
interactionModeRef.current = interactionMode;
|
|
118
|
+
|
|
119
|
+
const finishPicking = useCallback(() => {
|
|
120
|
+
setState("idle");
|
|
121
|
+
setBasePosition(null);
|
|
122
|
+
setBaseCoordinateGeoid(null);
|
|
123
|
+
setSpaceSelector(null);
|
|
124
|
+
setCoordinateSelector(null);
|
|
125
|
+
lastCoordinateSelector.current = null;
|
|
126
|
+
centerGeoidHeightRef.current = null;
|
|
127
|
+
setVerticalSpaceIndicator(null);
|
|
128
|
+
overrideInteractionMode?.(
|
|
129
|
+
interactionModeRef.current === "spatialId"
|
|
130
|
+
? "default"
|
|
131
|
+
: interactionModeRef.current ?? "default",
|
|
132
|
+
);
|
|
133
|
+
engineRef.current?.setCursor("default");
|
|
134
|
+
engineRef.current?.requestRender();
|
|
135
|
+
}, [overrideInteractionMode, engineRef]);
|
|
136
|
+
|
|
137
|
+
const handleMouseUp = useCallback(
|
|
138
|
+
async (props: MouseEventProps) => {
|
|
139
|
+
if (state === "idle") return;
|
|
140
|
+
if (tempSwitchToMoveMode.current) return;
|
|
141
|
+
|
|
142
|
+
// handle coordinate picking
|
|
143
|
+
if (state === "coordinate") {
|
|
144
|
+
if (
|
|
145
|
+
!coordinateSelector ||
|
|
146
|
+
props.lat === undefined ||
|
|
147
|
+
props.lng === undefined ||
|
|
148
|
+
props.lat > SPATIALID_LATITUDE_RANGE.max ||
|
|
149
|
+
props.lat < SPATIALID_LATITUDE_RANGE.min
|
|
150
|
+
)
|
|
151
|
+
return;
|
|
152
|
+
|
|
153
|
+
setState("fetchingGeoid");
|
|
154
|
+
|
|
155
|
+
const { id, wsen, space } = createSpatialIdSpace(
|
|
156
|
+
props.lng,
|
|
157
|
+
props.lat,
|
|
158
|
+
0,
|
|
159
|
+
pickOptions.zoom,
|
|
160
|
+
0,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
requestAnimationFrame(() => {
|
|
164
|
+
engineRef.current?.setCursor("wait");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const [geoidHeight, centerGeoidHeight] = await Promise.all([
|
|
168
|
+
geoidRef.current?.getGeoidHeight(props.lng, props.lat),
|
|
169
|
+
geoidRef.current?.getGeoidHeight(space.center.lng, space.center.lat),
|
|
170
|
+
]);
|
|
171
|
+
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
engineRef.current?.setCursor("crosshair");
|
|
174
|
+
}, 100);
|
|
175
|
+
|
|
176
|
+
if (geoidHeight === undefined && centerGeoidHeight === undefined) {
|
|
177
|
+
setState("coordinate");
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// In most case the geoidHeight difference between click point and center is small
|
|
182
|
+
// The API is not that stable, it has NaN for some points for unknown reason
|
|
183
|
+
// Therefore we try use one another if one is NaN
|
|
184
|
+
const appliedGeoidHeight = geoidHeight ?? centerGeoidHeight ?? 0;
|
|
185
|
+
const appliedCenterGeoidHeight = centerGeoidHeight ?? geoidHeight ?? 0;
|
|
186
|
+
centerGeoidHeightRef.current = appliedCenterGeoidHeight;
|
|
187
|
+
|
|
188
|
+
setVerticalSpaceIndicator({
|
|
189
|
+
id,
|
|
190
|
+
wsen,
|
|
191
|
+
height: verticalLimits.top + appliedCenterGeoidHeight,
|
|
192
|
+
extrudedHeight: verticalLimits.bottom + appliedCenterGeoidHeight,
|
|
193
|
+
color: pickOptions.verticalSpaceIndicatorColor,
|
|
194
|
+
outlineColor: pickOptions.verticalSpaceIndicatorOutlineColor,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
setBaseCoordinateGeoid([
|
|
198
|
+
props.lng,
|
|
199
|
+
props.lat,
|
|
200
|
+
(terrainEnabled ? props.height ?? 0 : 0) - appliedGeoidHeight,
|
|
201
|
+
]);
|
|
202
|
+
|
|
203
|
+
setBasePosition(engineRef.current?.toXYZ(props.lng, props.lat, props.height ?? 0) ?? null);
|
|
204
|
+
|
|
205
|
+
const initialSpaceSelectorSpace = createSpatialIdSpace(
|
|
206
|
+
props.lng,
|
|
207
|
+
props.lat,
|
|
208
|
+
(terrainEnabled ? props.height ?? 0 : 0) - appliedGeoidHeight,
|
|
209
|
+
pickOptions.zoom,
|
|
210
|
+
appliedCenterGeoidHeight,
|
|
211
|
+
);
|
|
212
|
+
setSpaceSelector({
|
|
213
|
+
...initialSpaceSelectorSpace,
|
|
214
|
+
color: pickOptions.color,
|
|
215
|
+
outlineColor: pickOptions.outlineColor,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
lastCoordinateSelector.current = coordinateSelector;
|
|
219
|
+
setCoordinateSelector(null);
|
|
220
|
+
|
|
221
|
+
engineRef.current?.requestRender();
|
|
222
|
+
setState("floor");
|
|
223
|
+
} else if (state === "floor") {
|
|
224
|
+
if (!spaceSelector) return;
|
|
225
|
+
|
|
226
|
+
const confirmedSpace: SpatialIdSpaceType = {
|
|
227
|
+
...spaceSelector,
|
|
228
|
+
id: uuid(),
|
|
229
|
+
color: pickOptions.color,
|
|
230
|
+
outlineColor: pickOptions.outlineColor,
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
if (!pickOptions.dataOnly) {
|
|
234
|
+
setSpatialIdSpaces(prev => (prev ? [...prev, confirmedSpace] : [confirmedSpace]));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
finishPicking();
|
|
238
|
+
|
|
239
|
+
const spaceData = getSpaceData(confirmedSpace.space);
|
|
240
|
+
onSpacePickEvents.current.forEach(cb => cb(spaceData));
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
[
|
|
244
|
+
state,
|
|
245
|
+
terrainEnabled,
|
|
246
|
+
engineRef,
|
|
247
|
+
geoidRef,
|
|
248
|
+
spaceSelector,
|
|
249
|
+
pickOptions,
|
|
250
|
+
verticalLimits,
|
|
251
|
+
coordinateSelector,
|
|
252
|
+
finishPicking,
|
|
253
|
+
],
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const handleMouseMove = useCallback(
|
|
257
|
+
(props: MouseEventProps) => {
|
|
258
|
+
if (state === "idle") return;
|
|
259
|
+
if (tempSwitchToMoveMode.current) return;
|
|
260
|
+
|
|
261
|
+
if (state === "coordinate") {
|
|
262
|
+
if (
|
|
263
|
+
props.lat === undefined ||
|
|
264
|
+
props.lng === undefined ||
|
|
265
|
+
props.lat > SPATIALID_LATITUDE_RANGE.max ||
|
|
266
|
+
props.lat < SPATIALID_LATITUDE_RANGE.min
|
|
267
|
+
)
|
|
268
|
+
return;
|
|
269
|
+
|
|
270
|
+
// Coordinate Selector is clamp to ground, we can ignore height
|
|
271
|
+
// The space id is used to identify the selector only
|
|
272
|
+
const newSpace = createSpatialIdSpace(props.lng, props.lat, 0, pickOptions.zoom, 0);
|
|
273
|
+
|
|
274
|
+
if (newSpace.space.id === coordinateSelector?.uid) return;
|
|
275
|
+
setCoordinateSelector({
|
|
276
|
+
id: uuid(),
|
|
277
|
+
uid: newSpace.space.id,
|
|
278
|
+
wsen: newSpace.wsen,
|
|
279
|
+
color: pickOptions.selectorColor,
|
|
280
|
+
});
|
|
281
|
+
} else if (state === "floor") {
|
|
282
|
+
if (
|
|
283
|
+
props.x === undefined ||
|
|
284
|
+
props.y === undefined ||
|
|
285
|
+
basePosition === null ||
|
|
286
|
+
baseCoordinateGeoid === null
|
|
287
|
+
)
|
|
288
|
+
return;
|
|
289
|
+
|
|
290
|
+
const offset =
|
|
291
|
+
engineRef.current?.getExtrudedHeight(basePosition, [props.x, props.y], true) ?? 0;
|
|
292
|
+
|
|
293
|
+
if (
|
|
294
|
+
baseCoordinateGeoid[2] + offset > verticalLimits.top ||
|
|
295
|
+
baseCoordinateGeoid[2] + offset < verticalLimits.bottom
|
|
296
|
+
)
|
|
297
|
+
return;
|
|
298
|
+
|
|
299
|
+
const newSpace = createSpatialIdSpace(
|
|
300
|
+
baseCoordinateGeoid[0],
|
|
301
|
+
baseCoordinateGeoid[1],
|
|
302
|
+
baseCoordinateGeoid[2] + offset,
|
|
303
|
+
pickOptions.zoom,
|
|
304
|
+
centerGeoidHeightRef.current ?? 0,
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
if (newSpace.space.id === spaceSelector?.space.id) return;
|
|
308
|
+
|
|
309
|
+
setSpaceSelector({
|
|
310
|
+
...newSpace,
|
|
311
|
+
color: pickOptions.selectorColor,
|
|
312
|
+
outlineColor: pickOptions.selectorOutlineColor,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
[
|
|
317
|
+
state,
|
|
318
|
+
spaceSelector,
|
|
319
|
+
basePosition,
|
|
320
|
+
baseCoordinateGeoid,
|
|
321
|
+
engineRef,
|
|
322
|
+
pickOptions,
|
|
323
|
+
verticalLimits,
|
|
324
|
+
coordinateSelector?.uid,
|
|
325
|
+
],
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
const cancel = useCallback(() => {
|
|
329
|
+
if (state === "idle") return;
|
|
330
|
+
if (state === "coordinate" && pickOptions.rightClickToExit) {
|
|
331
|
+
finishPicking();
|
|
332
|
+
} else if (state === "floor") {
|
|
333
|
+
setSpaceSelector(null);
|
|
334
|
+
setBasePosition(null);
|
|
335
|
+
setBaseCoordinateGeoid(null);
|
|
336
|
+
setVerticalSpaceIndicator(null);
|
|
337
|
+
setCoordinateSelector(lastCoordinateSelector.current);
|
|
338
|
+
setState("coordinate");
|
|
339
|
+
centerGeoidHeightRef.current = null;
|
|
340
|
+
}
|
|
341
|
+
engineRef.current?.requestRender();
|
|
342
|
+
}, [state, pickOptions, engineRef, finishPicking]);
|
|
343
|
+
|
|
344
|
+
const handleMouseRightClick = useCallback(() => {
|
|
345
|
+
cancel();
|
|
346
|
+
}, [cancel]);
|
|
347
|
+
|
|
348
|
+
useWindowEvent("keydown", event => {
|
|
349
|
+
if (event.code === "Escape") {
|
|
350
|
+
cancel();
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// bind mouse events
|
|
355
|
+
const eventsBinded = useRef(false);
|
|
356
|
+
|
|
357
|
+
const handleMouseUpRef = useRef(handleMouseUp);
|
|
358
|
+
handleMouseUpRef.current = handleMouseUp;
|
|
359
|
+
const handleMouseUpForRef = useCallback((props: MouseEventProps) => {
|
|
360
|
+
handleMouseUpRef.current(props);
|
|
361
|
+
}, []);
|
|
362
|
+
|
|
363
|
+
const handleMouseMoveRef = useRef(handleMouseMove);
|
|
364
|
+
handleMouseMoveRef.current = handleMouseMove;
|
|
365
|
+
const handleMouseMoveForRef = useCallback((props: MouseEventProps) => {
|
|
366
|
+
handleMouseMoveRef.current(props);
|
|
367
|
+
}, []);
|
|
368
|
+
|
|
369
|
+
const handleMouseRightClickRef = useRef(handleMouseRightClick);
|
|
370
|
+
handleMouseRightClickRef.current = handleMouseRightClick;
|
|
371
|
+
const handleMouseRightClickForRef = useCallback(() => {
|
|
372
|
+
handleMouseRightClickRef.current();
|
|
373
|
+
}, []);
|
|
374
|
+
|
|
375
|
+
useEffect(() => {
|
|
376
|
+
if (eventsBinded.current || !engineRef.current) return;
|
|
377
|
+
eventsBinded.current = true;
|
|
378
|
+
engineRef.current.onMouseUp(handleMouseUpForRef);
|
|
379
|
+
engineRef.current.onMouseMove(handleMouseMoveForRef);
|
|
380
|
+
engineRef.current.onRightClick(handleMouseRightClickForRef);
|
|
381
|
+
}, [engineRef, handleMouseUpForRef, handleMouseMoveForRef, handleMouseRightClickForRef]);
|
|
382
|
+
|
|
383
|
+
// cancel picking when interaction mode changes
|
|
384
|
+
const stateRef = useRef(state);
|
|
385
|
+
stateRef.current = state;
|
|
386
|
+
const finishPickingRef = useRef(finishPicking);
|
|
387
|
+
finishPickingRef.current = finishPicking;
|
|
388
|
+
useEffect(() => {
|
|
389
|
+
if (tempSwitchToMoveMode.current) return;
|
|
390
|
+
if (interactionMode !== "spatialId" && stateRef.current !== "idle") {
|
|
391
|
+
finishPickingRef.current();
|
|
392
|
+
}
|
|
393
|
+
}, [interactionMode]);
|
|
394
|
+
|
|
395
|
+
// events
|
|
396
|
+
const onSpacePickEvents = useRef<((space: SpatialIdSpaceData) => void)[]>([]);
|
|
397
|
+
|
|
398
|
+
const bindEventOnSpacePick = useCallback((cb: (space: SpatialIdSpaceData) => void) => {
|
|
399
|
+
onSpacePickEvents.current.push(cb);
|
|
400
|
+
}, []);
|
|
401
|
+
|
|
402
|
+
// ref
|
|
403
|
+
useImperativeHandle(
|
|
404
|
+
ref,
|
|
405
|
+
() => ({
|
|
406
|
+
pickSpace,
|
|
407
|
+
onSpacePick: bindEventOnSpacePick,
|
|
408
|
+
exitPickSpace: finishPicking,
|
|
409
|
+
}),
|
|
410
|
+
[pickSpace, bindEventOnSpacePick, finishPicking],
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// press space to move
|
|
414
|
+
const tempSwitchToMoveMode = useRef(false);
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
const handleKeydown = (e: KeyboardEvent) => {
|
|
417
|
+
if (e.code === "Space" && stateRef.current !== "idle") {
|
|
418
|
+
tempSwitchToMoveMode.current = true;
|
|
419
|
+
overrideInteractionMode?.("move");
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
window.addEventListener("keydown", handleKeydown);
|
|
423
|
+
return () => {
|
|
424
|
+
window.removeEventListener("keydown", handleKeydown);
|
|
425
|
+
};
|
|
426
|
+
}, [overrideInteractionMode]);
|
|
427
|
+
|
|
428
|
+
useEffect(() => {
|
|
429
|
+
return window.addEventListener("keyup", e => {
|
|
430
|
+
if (e.code === "Space" && tempSwitchToMoveMode.current) {
|
|
431
|
+
tempSwitchToMoveMode.current = false;
|
|
432
|
+
overrideInteractionMode?.("spatialId");
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
}, [overrideInteractionMode]);
|
|
436
|
+
|
|
437
|
+
useEffect(() => {
|
|
438
|
+
onMount?.();
|
|
439
|
+
}, [onMount]);
|
|
440
|
+
|
|
441
|
+
return {
|
|
442
|
+
spatialIdSpaces,
|
|
443
|
+
verticalSpaceIndicator,
|
|
444
|
+
coordinateSelector,
|
|
445
|
+
spaceSelector,
|
|
446
|
+
groundIndicators,
|
|
447
|
+
};
|
|
448
|
+
};
|