@arcgis/core 5.2.0-next.71 → 5.2.0-next.73
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00cbff0b785e24e87d97.js +1 -0
- package/assets/esri/core/workers/chunks/{359584a8fb5687a7d098.js → 014f9fd2818e2c9d9a3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b3a8a6167f2e1eeb828.js → 0823961e5d0bdedbf8cf.js} +2 -2
- package/assets/esri/core/workers/chunks/{a62f1b8ed065b2a38f1a.js → 0dbf31a663b5220a3136.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe10a95ebe1da2322af6.js → 0df660dfd941cff3ea1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{d93d0cb69f3a9a722510.js → 1418c03c4ab87f7ab5f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{c03da138651ac53cadcb.js → 186bedc377cc97731ca2.js} +2 -2
- package/assets/esri/core/workers/chunks/{fff23b2682590c4b21e3.js → 2a2ed7bd44010f24c2dd.js} +1 -1
- package/assets/esri/core/workers/chunks/2e44978ee677aa23163d.js +256 -0
- package/assets/esri/core/workers/chunks/{fc2cae359d571690d754.js → 35fd2f765d2cb3f59a22.js} +4 -4
- package/assets/esri/core/workers/chunks/{6b208bac120bcfecd9e4.js → 3e2b4e734aa20a308f3e.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa19d5923276418096da.js → 44b50d4716a2567ab6f1.js} +1 -1
- package/assets/esri/core/workers/chunks/{50e0dd74795978468625.js → 4cf2b0558a4acc141429.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d3a18d56e2e5669c562.js → 64176f7ae719289a2f79.js} +1 -1
- package/assets/esri/core/workers/chunks/{9684ab5e8254fdfcb7bb.js → 67f54586156d1ab80257.js} +1 -1
- package/assets/esri/core/workers/chunks/{2cfe6f41865ffb3a4645.js → 7e373d9c98ce910db9d2.js} +1 -1
- package/assets/esri/core/workers/chunks/{4da993c79b373b9d304e.js → 8302bffd28cc6720e0fe.js} +2 -2
- package/assets/esri/core/workers/chunks/{9dda9414104f585560a4.js → ad1d06a91121ebfe9162.js} +2 -2
- package/assets/esri/core/workers/chunks/{065e3353124fc5ac44ce.js → b33d870cbfa238762c5e.js} +1 -1
- package/assets/esri/core/workers/chunks/ba4f419f46be09a9a55c.js +1 -0
- package/assets/esri/core/workers/chunks/{684d3cb4fb233180b2d0.js → cd892c9603710d6130a9.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa5d27e47d47ff8fcb96.js → d03e7be74c57c3dbf003.js} +2 -2
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/Component.glsl.js +3 -3
- package/chunks/HUDMaterial.glsl.js +8 -8
- package/chunks/lyr3DMain.js +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/ILyr3DWasmPerSceneView.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/BitmapTile.js +1 -1
- package/views/2d/engine/BitmapTileContainer.js +1 -1
- package/views/2d/engine/flow/FlowContainer.js +1 -1
- package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/imagery/RasterTile.js +1 -1
- package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/imagery/RasterVFTile.js +1 -1
- package/views/2d/engine/imagery/RasterVFTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayContainer.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/TileContainer.js +1 -1
- package/views/2d/engine/webgl/normalizedTileUtils.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/rasterVFUtils.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ClipShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DebugOverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/Tile.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowParticlesShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowStreamlinesShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/MagDirShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterVFTransform.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/ScalarShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ReprojectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderOutline.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/settings.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/DepthConversion.glsl.js +14 -0
- package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +3 -15
- package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/assets/esri/core/workers/chunks/6357c7cac401aee9fe77.js +0 -1
- package/assets/esri/core/workers/chunks/d2faac81142586cf7509.js +0 -1
- package/assets/esri/core/workers/chunks/fd6107f95082e05f016a.js +0 -256
- package/views/2d/engine/webgl/shaderGraph/techniques/line/utils.js +0 -2
- /package/assets/esri/core/workers/chunks/{3b3a8a6167f2e1eeb828.js.LICENSE.txt → 0823961e5d0bdedbf8cf.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c03da138651ac53cadcb.js.LICENSE.txt → 186bedc377cc97731ca2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4da993c79b373b9d304e.js.LICENSE.txt → 8302bffd28cc6720e0fe.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{9dda9414104f585560a4.js.LICENSE.txt → ad1d06a91121ebfe9162.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fa5d27e47d47ff8fcb96.js.LICENSE.txt → d03e7be74c57c3dbf003.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as
|
|
2
|
+
import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,removeMaybe as n}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as a,initial as o,when as l}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as p}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as u,getEffectiveElevationMode as d}from"../../../../../support/elevationInfoUtils.js";import v from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as f}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as E}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as V}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as w}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as _}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as I}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as G}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as x,geometryTypeToDrawOperationGeometryType as S}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as D}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as L,SceneDrawSurface as C}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as O}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as T}from"../../../../../core/accessorSupport/trackingUtils.js";let b=class extends x{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t,unit:i,featureExpressionInfo:s}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new v({mode:e,offset:t,unit:i,featureExpressionInfo:s})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:u(t)}}return e}initializeGraphic(e){const{view:i}=this,s=this._createGraphicState=new G({graphic:e});return t([i.maskOccludee(e),i.trackGraphicState(s),r(()=>({element:this._outlineVisualElement,isDraped:s.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},a),T(()=>{O(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(s),...E(s)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new D({view:this.view,manipulators:this.manipulators,geometryType:S(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new C(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new L(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new g,segmentLabels:t?new f:null,labelOptions:this.sketchOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,this.elevationInfo),cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){const{view:n}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),i();const r=this._settings,a=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:a.size,outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=l;const c=r.visualElements.zVerticalLine,h=new V({view:n,extensionType:c.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=h;const p=t([this._updatingHandles.add(()=>r.visualElements.zVerticalLine,e=>e.apply(h),o),this._updatingHandles.add(()=>({selectedColor:r.colors.selected.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},o),i(()=>{this._activeVertexVisualElement=s(this._activeVertexVisualElement),this._verticalLineVisualElement=s(this._verticalLineVisualElement)})]);return l.attached=!0,this._updateVerticalLineVisualElement(e),p}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:s}=this.view;p(U,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),U[2]=I(U,s,z,i);i.toRenderCoords(U,this.view.spatialReference,U)?(t.setStartEndFromWorldDownAtLocation(U),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,i();const n=this.internalGraphicsLayer.elevationInfo,{view:r}=this,a=this._settings,l=new w({view:r,geometry:e,elevationInfo:n,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,n),attached:!1,isDecoration:!0});this._outlineVisualElement=l;const c=t([this._updatingHandles.add(()=>a.visualElements.lineObjects.outline,e=>e.apply(l),o),this._updatingHandles.add(()=>a.visualElements.lineObjects.shadowStyle,e=>e.apply(l),o),i(()=>{this._outlineVisualElement=s(this._outlineVisualElement)})]);return l.attached=!0,l.laserlineEnabled=!0,c}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,i();const{view:n}=this,r=this._settings,a=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:a.size,outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1,isDecoration:!0}),c=t([this._updatingHandles.add(()=>({color:r.manipulators.vertex.color.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},o),i(()=>{this._verticesVisualElement=s(this._verticesVisualElement)})]);return l.attached=!0,this._verticesVisualElement=l,c}updateGraphicGeometry(e){if("mesh"===this.geometryType&&"point"===e?.type){const t=this.geometryToPlace;t?.centerAt(e),O(this.tooltipInfos.mesh,t);const i=this._graphic;return void(t&&i.geometry===t||(i.geometry=t))}super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){const{drawOperation:s}=this;if(!this.geometryToPlace||e.displaying)return s.loading=!1,null;s.loading=!0;const r=i(()=>{s.loading=!1});let o;const c=()=>{o&&cancelAnimationFrame(o)},h=()=>{c(),o=requestAnimationFrame(()=>r.remove())};let p=null;return p=e.on("changed",()=>{p=n(p),h()}),t([p,l(()=>e.displaying,h,{...a,once:!0}),i(c),r])}};e([c({constructOnly:!0})],b.prototype,"elevationInfo",void 0),e([c({constructOnly:!0})],b.prototype,"geometryType",void 0),e([c()],b.prototype,"type",void 0),e([c({constructOnly:!0})],b.prototype,"view",void 0),b=e([h("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],b);const z=new j,U=m();export{b as DrawGraphicTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as r}from"../../../../../core/quantity.js";import{watch as p,initial as h,syncAndInitial as c}from"../../../../../core/reactiveUtils.js";import{property as u,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as v}from"../../../../../core/support/UpdatingHandles.js";import f from"../../../../../geometry/Point.js";import{makeDehydratedPoint as _}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as M}from"../../SnappingVisualizer3D.js";import{orientation as y}from"../geometryUtils.js";import{manipulatedObjectGeometry as b}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as T}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as w}from"../tooltipUtils3D.js";import{createVisualElements as I}from"../visualElementUtils.js";import{discRadius as S}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as D}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as x}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as P}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as B,enterInputModeIfAvailable as C}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as Z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as W}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as N}from"../../../../support/GeometryWorkerHandle.js";class q{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class J{constructor(t){this.objects=t,this.type="move-stop"}}const K=Symbol("manipulators"),Q=Symbol("tooltips"),$=Symbol("move-manipulator-display");let tt=class extends A{get _infos(){return Array.from(this._infosByType.values())}constructor(t){super(t),this._infosByType=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new z,this.type="move-3d",this._measurementWorker=new N({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new v,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=B(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles([this.objects.on("change",t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()}),this.objects.on("change",()=>this._connectTooltips())]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!C(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=b(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==O(e))continue;const t=new et(e);this._infosByType.set(e,t)}for(const e of o)this._infosByType.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infosByType.get(o);this.addHandles(T(t.object),o)}}_refreshManipulators(){if(this.removeHandles(K),this.removeHandles($),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infosByType.size)return;const t=this._infos;this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new x({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],K)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),K)}this._createMoveManipulation(t)}_updateMoveManipulatorDisplay(){const t=this._infos.some(t=>t.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!t),this.removeHandles($),t&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),$)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):S});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),K)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=r)})],K)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const r of t){this.addHandles([r.object.on("committed",i),p(()=>r.object.visible,i)],K);const o=Symbol();this.addHandles(p(()=>r.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(k({view:this.view,geometry:r.object.graphic?.geometry,elevationInfo:r.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},h),K),this.addHandles(n(()=>this.removeHandles(o)),K)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),K);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),K)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=I({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof P&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),p(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],K),this.addHandles(i,K))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=y(b(t.object)))}_updateMoveManipulation(t){const o=_(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof P&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const h=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._updateMoveManipulatorDisplay()};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>p?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new J(l)),this.destroyed||h(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new q(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>r?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new J(l)),this.destroyed)return null;h()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(Q),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new Z({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new q([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new J([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=w(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=p(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},c);this.addHandles(t,Q)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new F({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(ot(t),ot(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(ot(t),ot(e)),D(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new V({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,W))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??r}else t.distance=r}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=b(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new M,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:h}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(h),{steps:e=e.next(o=>{a.z=g(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}get test(){}};t([u({constructOnly:!0,nonNullable:!0})],tt.prototype,"view",void 0),t([u()],tt.prototype,"objects",void 0),t([u({constructOnly:!0,nonNullable:!0})],tt.prototype,"enableZ",void 0),t([u({constructOnly:!0,type:z})],tt.prototype,"sketchOptions",void 0),t([u({constructOnly:!0})],tt.prototype,"snappingManager",void 0),t([u()],tt.prototype,"type",void 0),t([u()],tt.prototype,"updating",null),t([u()],tt.prototype,"_latestTooltipInfo",void 0),t([u()],tt.prototype,"_shouldShowMovePointTooltip",null),t([u()],tt.prototype,"activeTooltipInfo",null),tt=t([m("esri.views.3d.interactive.editingTools.move.MoveTool3D")],tt);const ot=d(f);class et{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{L as MoveEvent,q as MoveStartEvent,J as MoveStopEvent,tt as MoveTool3D};
|
|
2
|
+
import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as p}from"../../../../../core/quantity.js";import{initial as r,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as u}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import v from"../../../../../geometry/Point.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as _}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as M}from"../geometryUtils.js";import{manipulatedObjectGeometry as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as T}from"../tooltipUtils3D.js";import{createVisualElements as w}from"../visualElementUtils.js";import{discRadius as I}from"../manipulations/config.js";import{MoveManipulation as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as H}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as D}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as P}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as k,resetManipulatedObjectMany as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as U}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as A}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import R from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as X}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Y,enterInputModeIfAvailable as B}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as C}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class N{constructor(t){this.objects=t,this.type="move-start"}}class q{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class L{constructor(t){this.objects=t,this.type="move-stop"}}const J=Symbol("manipulators"),K=Symbol("tooltips"),Q=Symbol("move-manipulator-display");let $=class extends U{get _infos(){return Array.from(this._infosByType.values())}constructor(t){super(t),this._infosByType=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new R,this.type="move-3d",this._measurementWorker=new W({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=Y(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators(),this._connectTooltips()}));const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!B(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=y(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==O(e))continue;const t=new ot(e);this._infosByType.set(e,t)}for(const e of o)this._infosByType.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infosByType.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(J),this.removeHandles(Q),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infosByType.size)return;const t=this._infos;this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new D({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],J)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),J)}this._createMoveManipulation(t)}_updateMoveManipulatorDisplay(){const t=this._infos.some(t=>t.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!t),this.removeHandles(Q),t&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Q)}_createMoveManipulation(t){const o=new S({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?S.radiusForSymbol(t[0].object.graphic?.symbol):I});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),J)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=p)})],J)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const p of t){this.addHandles([p.object.on("committed",i),this._updatingHandles.add(()=>p.object.visible,i)],J);const o=Symbol();this.addHandles(this._updatingHandles.add(()=>p.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(P({view:this.view,geometry:p.object.graphic?.geometry,elevationInfo:p.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},r),J),this.addHandles(n(()=>this.removeHandles(o)),J)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),J);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),J)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=w({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),this._updatingHandles.add(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],J),this.addHandles(i,J))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=M(y(t.object)))}_updateMoveManipulation(t){const o=f(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&b(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let p=null,r=null;const h=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,p=null,r=null,this._updateMoveManipulatorDisplay()};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>r?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new L(l)),this.destroyed||h(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=k(l),r=E(l),this._emitRecordUndo(),this.events.emit("move-start",new N(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>p?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new q(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new L(l)),this.destroyed)return null;h()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(K),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new C({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new N([o]))},onMove:()=>e.emit("move",new q(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new L([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=T(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=this._updatingHandles.add(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,K)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new F({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),H(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,V))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??p}else t.distance=p}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=y(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new z({elevationInfo:o,pointer:n,editGeometryOperations:A.fromGeometry(a,this.view.state.viewingMode),visualizer:new g,excludeFeature:t.graphic}),p=this.snappingManager,{snappingStep:r,cancelSnapping:h}=X({snappingContext:l,snappingManager:p,updatingHandles:this._updatingHandles});return i=i.next(h),{steps:e=e.next(o=>{a.z=_(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...r),cancel:i}}get test(){}};t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([c()],$.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:R})],$.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([c()],$.prototype,"type",void 0),t([c()],$.prototype,"updating",null),t([c()],$.prototype,"_latestTooltipInfo",void 0),t([c()],$.prototype,"_shouldShowMovePointTooltip",null),t([c()],$.prototype,"activeTooltipInfo",null),$=t([d("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=u(v);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{q as MoveEvent,N as MoveStartEvent,L as MoveStopEvent,$ as MoveTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as h,initial as d,on as u,syncAndInitial as c,when as m,sync as f}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import w from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as G}from"../../../../../symbols/support/utils.js";import{Manipulator3D as C}from"../../Manipulator3D.js";import{createManipulatorMaterial as R,createManipulatorOutlineMaterial as P,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as U}from"../../RenderObject.js";import{SegmentLabels3D as L}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as F,screenToRenderPlaneFromEvent as B,convertToMapCoordinates as Z}from"../dragEventPipeline3D.js";import{orientation as W}from"../geometryUtils.js";import{canMoveZOperations as N}from"../manipulatorUtils.js";import{Settings as q}from"../settings.js";import{createVisualElements as X}from"../visualElementUtils.js";import{discRadiusSmall as Y}from"../manipulations/config.js";import{MoveManipulation as K}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as J}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as Q,createEdgeOffsetIntersectionPlane as $,createEdgeOffsetOperation as ee,edgeOffsetRotationMatrix as te,screenEdgeLengthSquared as ie,getDistanceInGeometrySR as ne}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as oe,getUpdatedTranslateObjectTooltipInfo as se,getUpdatedEdgeOffsetTooltipInfo as re}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as le}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as pe}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as he,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as ue}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ce,addMapDelta as me,createManipulatorDragEventPipeline as fe,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ve}from"../../../../interactive/keybindings.js";import{SnappingContext as Me}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as be}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as xe,enterInputModeIfAvailable as ye}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Oe}from"../../../../support/GeometryWorkerHandle.js";const Ee=Symbol(),je=Symbol(),Ie=Symbol(),Se=Symbol();let He=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Se)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new q({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._measurementWorker=new Oe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._sketchOptions,e),this._vertexManipulatorMaterial=R(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=P(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=R(n.color.toUnitRGBA(),n.renderOccluded),this._edgeManipulatorOutlineMaterial=P(n.outlineColor.toUnitRGBA(),n.renderOccluded);const a=t.edgeOffset;this._edgeOffsetManipulatorMaterial=R(a.color.toUnitRGBA(),a.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=R(a.hoverColor.toUnitRGBA(),a.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=R(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=P(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=xe(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([h(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ae(t)&&(t.edgeManipulator.available=e)}),h(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),h(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),h(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===ve.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!ye(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(je),this.removeHandles(Se),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:n,index:a}of this._operations.data.parts){const o=e?.byPartIndex.get(a);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of n)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new L({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||a&&!o.manipulator.selected||n.push(o),i++);if(n.length===i){if(a||this._hideReshapeControls(),this._moveVertices(n,t),this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(n,t),this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Se)}_showReshapeControls(){this.removeHandles(Se)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){const t=this._manipulatorInfos.filter(Ae).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(je),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],je))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Ae(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Ee):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Ee)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];this._forEachVertex(t=>{const{selected:i,grabbing:n}=t.manipulator;(i&&!n||t===e.info)&&a.push(t)}),this._moveVertices(a,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new J({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,a)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=n.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),a.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new K({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&N(t.operations,t.elevationInfo),snapToScene:!1,radius:K.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=be({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Me({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ce(this.view,e,t.graphic??void 0)).next(...p).next(me()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(n,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Ie),e&&this.addHandles(pe({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Ie)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=X({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof le?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>n.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.part.vertices.length<=2||!n)return null;const a=n.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=o,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=he(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=he(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const f=[new U(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],g=new C({view:i,renderObjects:f,elevationInfo:"on-the-ground"!==t.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:Te(a)}),_=new C({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:Te(a)}),v={manipulator:g,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,o.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(g,!0),this._watchAndUpdateGrabState(_,!0),fe(g,this._createEdgeOffsetPipeline(v,t,n)),fe(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),g.events.on("immediate-click",b),g.events.on("focus-changed",()=>this._resetTooltip()),g.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?Q(e,this.view,this.object,v):null})],g),this._manipulatorInfos.push(v),this.manipulators.addMany([g,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=p(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=r&&ie(a.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),o(()=>{p(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)})],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=$(this.view,e.manipulator.elevationAlignedLocation,ee(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?te(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next(e=>this._trackNumDragging(e)).next(ge(this.view,r)).next(F(this.view,r,t,s,e)).next(_e()).next(me()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!n.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next(e=>this._trackNumDragging(e)).next(ge(this.view,n.elevationAlignedLocation)).next(r).next(B(this.view)).next(Z(this.view,i.data.spatialReference)).next(me()).next(we()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:o}=this,r=ee(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),h=$(a,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=p(d)},c=this.events.on("undo",u);return d=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{n.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==h?(u(),null):{...e,operation:r,plane:h},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const a=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),o=new le({view:this.view,isDraped:t.isDraped,geometry:a(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=a()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Re){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Re){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!ye(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ae).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=ee(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()})],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??Q(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,o=a=>{n(),queueMicrotask(()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ne(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()})},r=()=>{const e=a();null!=e?o(e):n()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",n),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,o=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ve(o.manipulators.vertex);this._vertexManipulatorGeometry=de(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=de(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ve(o.manipulators.edge);this._edgeManipulatorGeometry=de(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=de(this._edgeManipulatorOutlineMaterial,t,16,16)}const h="point"===r||"mesh"===r?[]:[new U(this._vertexManipulatorGeometry.instantiate(),4|Pe),new U(this._vertexManipulatorOutlineGeometry.instantiate(),5|Pe),new U(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Pe),new U(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new U(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new U(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&h.push(new U(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|ke),new U(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|ke),new U(this._edgeManipulatorGeometry.instantiate(),5|ke),new U(this._edgeManipulatorOutlineGeometry.instantiate(),5|ke));const d="vertex"===e.type,u=()=>new C({view:n,renderObjects:h,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===r||"mesh"===r,available:this.object.visible,metadata:{deleting:!1},location:Te(l)});let c=null;d&&(c=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:u,elevationInfo:t,selected:i})??null),c??=u(),c.selected=i,this._setTypeSpecificManipulatorSettings(c,e,t);const m=d?{manipulator:c,handle:e,type:"vertex",selectedIndex:0}:{manipulator:c,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(c),this._updateManipulatorPosition(m),"edge"===m.type){const e=[];for(const t of[m.handle.leftVertex,m.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=s(e),this._manipulatorHandles.add(m.locationUpdateHandle,c)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(c,!0),c);const f=fe(c,(e,i,o,s)=>{let r=null;const{snappingStep:h,cancelSnapping:d}=be({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Me({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(d);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,f=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,a,c):F(n,u,t,l,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===m.type){const t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(ge(n,u)).next(f).next(ce(n,t,c)).next(...h).next(me()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([f,c.events.on("immediate-click",e=>this._manipulatorClickCallback(e,m)),c.events.on("select-changed",()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),c.events.on("focus-changed",()=>{this._resetTooltip()})],c),this.events.emit("manipulators-changed"),m}_screenToSceneMapForVertexDrag(e,t,i){const{view:n}=this,{coordinateHelper:a,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=a.vectorToPoint(t.snapOrigin)),null==s)return null;const r=n.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,n,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=n.manipulators.vertex;e.radius=t/2+i,e.state=Pe}break}case"line":{e.state=ke,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(je),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ae(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ge),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),"line"===n.leftSegment?.type&&this._createVertexOrEdgeManipulator(n.leftSegment),"line"===n.rightSegment?.type&&this._createVertexOrEdgeManipulator(n.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(n.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&N(this._operations,o.elevationInfo),this._moveManipulation.angle=W(s),this._moveManipulation.radius=K.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&N(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftSegment?.leftVertex?n.handle.leftSegment.leftVertex.pos:null,o=null==a&&n.handle.rightSegment?.rightVertex?n.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=De(t,e):o&&(i=De(e,o))}const s=n?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=Y}0!==t&&i?(E(e,e,1/t),Ge.spatialReference=this._operations.data.spatialReference,Ge.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ge),this._moveManipulation.elevationAlignedLocation=Ge):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const n=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(n.length>0){const e=this._createBeforeVertexRemoveEvent(n);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const a of n){const e=a.handle.part;if(i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightSegment));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),n=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let n=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return n},preventDefault(){n=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const n=this._operations;if(n&&(e.length>0&&n.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const a of e)this._updateManipulatorPosition(a)}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=re(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?re(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function we(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ve(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function De(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Te(e){return new H({x:0,y:0,z:0,spatialReference:e})}function Ae(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],He.prototype,"_numGrabbing",void 0),e([g()],He.prototype,"_numDragging",void 0),e([g()],He.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],He.prototype,"_operations",null),e([g()],He.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],He.prototype,"tool",void 0),e([g()],He.prototype,"tooltip",void 0),e([g()],He.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],He.prototype,"updating",null),e([g()],He.prototype,"manipulators",null),e([g()],He.prototype,"view",null),e([g()],He.prototype,"object",null),e([g()],He.prototype,"enableZShape",null),e([g()],He.prototype,"enableDeleteVertices",null),e([g()],He.prototype,"enableZVertex",null),e([g()],He.prototype,"autoHideManipulators",null),e([g()],He.prototype,"enableMoveObject",null),e([g()],He.prototype,"enableMidpoints",null),e([g()],He.prototype,"enableEdgeOffset",null),e([g()],He.prototype,"_sketchOptions",null),e([g()],He.prototype,"_accentColor",null),e([g()],He.prototype,"_tooltipsContext",null),He=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],He);const Ge=T(0,0,void 0,D.WGS84),Ce=I(),Re=1e-6,Pe=16,ke=32;export{He as ReshapeOperation};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{initial as d,on as h,watch as u,syncAndInitial as c,when as m,sync as f}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as C}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterials as R,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as z,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as B}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as W}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as le}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as pe,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as he}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as fe,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as _e}from"../../../../interactive/keybindings.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as ye}from"../../../../support/GeometryWorkerHandle.js";const Oe=Symbol(),Ee=Symbol(),je=Symbol(),Ie=Symbol();let Se=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Ie)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._measurementWorker=new ye({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._sketchOptions,e),this._vertexManipulatorMaterials=R({color:i.color.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA(),focusedOutlineColor:i.focusedOutlineColor.toUnitRGBA(),renderOccluded:i.renderOccluded});const a=t.edge;this._edgeManipulatorMaterials=R({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),renderOccluded:a.renderOccluded});const n=t.edgeOffset;this._edgeOffsetManipulatorMaterials=R({color:n.color.toUnitRGBA(),focusedColor:n.focusedColor.toUnitRGBA(),renderOccluded:n.renderOccluded,shaded:!1});const o=t.selected;this._selectedManipulatorMaterials=R({color:o.color.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA(),focusedOutlineColor:o.focusedOutlineColor.toUnitRGBA(),renderOccluded:o.renderOccluded}),this.tooltip=be(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterials.material),i.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),a.applyColor(this._selectedManipulatorMaterials.material),a.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),a.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Te(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),h(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),h(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===_e.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!xe(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(Ee),this.removeHandles(Ie),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||n&&!o.manipulator.selected||a.push(o),i++);if(a.length===i){if(n||this._hideReshapeControls(),this._moveVertices(a,t),this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(a,t),this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Ie)}_showReshapeControls(){this.removeHandles(Ie)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){const t=this._manipulatorInfos.filter(Te).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(Ee),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],Ee))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Te(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Oe):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Oe)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];this._forEachVertex(t=>{const{selected:i,grabbing:a}=t.manipulator;(i&&!a||t===e.info)&&n.push(t)}),this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Me({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ue(this.view,e,t.graphic??void 0)).next(...p).next(ce()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(je),e&&this.addHandles(le({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),je)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(h(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,{material:m,focusedMaterial:f}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){const e=pe(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=pe(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:f}),2),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:f}),2)],_=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:De(n)}),v=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:De(n)}),M={manipulator:_,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(M,o.minSquaredEdgeLength);const b=()=>this._updateEdgeOffsetManipulator(M);b(),M.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",b)}));const x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([M.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),me(_,this._createEdgeOffsetPipeline(M,t,a)),me(v,this._createEdgePipeline(M,t,a)),v.events.on("immediate-click",x),_.events.on("immediate-click",x),_.events.on("focus-changed",()=>this._resetTooltip()),_.events.on("grab-changed",({screenPoint:e,action:t})=>{M.grabMapPoint="start"===t?J(e,this.view,this.object,M):null})],_),this._manipulatorInfos.push(M),this.manipulators.addMany([_,v]),this.events.emit("manipulators-changed"),M}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&te(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),o(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(fe(this.view,r)).next(z(this.view,r,t,s,e)).next(ge()).next(ce()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(fe(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(B(this.view,i.data.spatialReference)).next(ce()).next(we()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),o=new re({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([u(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=n()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ge){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ge){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!xe(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Te).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.vertex),{material:i,outlineMaterial:a}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=de(i,e,16,16),this._vertexManipulatorOutlineGeometry=de(a,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.edge),{material:i,outlineMaterial:a}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=de(i,e,16,16),this._edgeManipulatorOutlineGeometry=de(a,t,16,16)}const d=this._vertexManipulatorGeometry,h=this._vertexManipulatorOutlineGeometry,u=[];if("point"!==r&&"mesh"!==r){u.push(new k(d.instantiate(),4|Re),new k(h.instantiate(),5|Re),new k(h.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),6|Re));{const{material:e,outlineMaterial:t,focusedMaterial:i}=this._selectedManipulatorMaterials;u.push(new k(d.instantiate({material:e}),8),new k(h.instantiate({material:t}),9),new k(h.instantiate({material:i}),10))}}if(this.enableMidpoints){const{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,i=this._edgeManipulatorGeometry,a=this._edgeManipulatorOutlineGeometry,n=6|Pe,o=5|Pe;u.push(new k(i.instantiate({material:e}),n),new k(a.instantiate({material:t}),n),new k(i.instantiate(),o),new k(a.instantiate(),o))}const c="vertex"===e.type,m=()=>new G({view:a,renderObjects:u,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===r||"mesh"===r,available:this.object.visible,metadata:{deleting:!1},location:De(l)});let f=null;c&&(f=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:m,elevationInfo:t,selected:i})??null),f??=m(),f.selected=i,this._setTypeSpecificManipulatorSettings(f,e,t);const g=c?{manipulator:f,handle:e,type:"vertex",selectedIndex:0}:{manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(g),this.manipulators.add(f),this._updateManipulatorPosition(g),"edge"===g.type){const e=[];for(const t of[g.handle.leftVertex,g.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(g)))}g.locationUpdateHandle=s(e),this._manipulatorHandles.add(g.locationUpdateHandle,f)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(f,!0),f);const _=me(f,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=Me({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,m=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,n,c):z(a,u,t,l,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===g.type){const t=this._splitEdgeManipulator(g);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:g,snapOrigin:g.handle.pos}}).next(fe(a,u)).next(m).next(ue(a,t,c)).next(...d).next(ce()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([_,f.events.on("immediate-click",e=>this._manipulatorClickCallback(e,g)),f.events.on("select-changed",()=>{g.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),f.events.on("focus-changed",()=>{this._resetTooltip()})],f),this.events.emit("manipulators-changed"),g}_screenToSceneMapForVertexDrag(e,t,i){const{view:a}=this,{coordinateHelper:n,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=n.vectorToPoint(t.snapOrigin)),null==s)return null;const r=a.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,a,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=a.manipulators.vertex;e.radius=t/2+i,e.state=Re}break}case"line":{e.state=Pe,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(Ee),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Te(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ae),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&W(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}const s=a?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Ae.spatialReference=this._operations.data.spatialReference,Ae.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ae),this._moveManipulation.elevationAlignedLocation=Ae):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const a=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(a.length>0){const e=this._createBeforeVertexRemoveEvent(a);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const n of a){const e=n.handle.part;if(i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let a=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return a},preventDefault(){a=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a&&(e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function we(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function He(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function De(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Te(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],Se.prototype,"_numGrabbing",void 0),e([g()],Se.prototype,"_numDragging",void 0),e([g()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],Se.prototype,"_operations",null),e([g()],Se.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],Se.prototype,"tool",void 0),e([g()],Se.prototype,"tooltip",void 0),e([g()],Se.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],Se.prototype,"updating",null),e([g()],Se.prototype,"manipulators",null),e([g()],Se.prototype,"view",null),e([g()],Se.prototype,"object",null),e([g()],Se.prototype,"enableZShape",null),e([g()],Se.prototype,"enableDeleteVertices",null),e([g()],Se.prototype,"enableZVertex",null),e([g()],Se.prototype,"autoHideManipulators",null),e([g()],Se.prototype,"enableMoveObject",null),e([g()],Se.prototype,"enableMidpoints",null),e([g()],Se.prototype,"enableEdgeOffset",null),e([g()],Se.prototype,"_sketchOptions",null),e([g()],Se.prototype,"_accentColor",null),e([g()],Se.prototype,"_tooltipsContext",null),Se=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ae=T(0,0,void 0,D.WGS84),Ce=I(),Ge=1e-6,Re=16,Pe=32;export{Se as ReshapeOperation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import t from"../../../../Color.js";import e from"../../../../core/Accessor.js";import{getContrast as l,multiplyOpacity as i,desaturate as s}from"../../../../core/colorUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{createStipplePatternSimple as c}from"../../webgl-engine/materials/lineStippleUtils.js";const h=.3;function a(o,t){t&&Object.assign(o,t)}class d{constructor(o){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=16,this.color=o.accent}}class p{constructor({colors:o,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=16,this.
|
|
2
|
+
import{__decorate as o}from"tslib";import t from"../../../../Color.js";import e from"../../../../core/Accessor.js";import{getContrast as l,multiplyOpacity as i,desaturate as s}from"../../../../core/colorUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{createStipplePatternSimple as c}from"../../webgl-engine/materials/lineStippleUtils.js";const h=.3;function a(o,t){t&&Object.assign(o,t)}class d{constructor(o){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=16,this.color=o.accent}}class p{constructor({colors:o,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=16,this.focusedOutlineColor=o.selectedOutline,a(this,t)}applyColor(o){this._apply(this.color,o)}applyOutline(o){this._apply(this.outlineColor,o)}applyFocusedOutline(o){this._apply(this.focusedOutlineColor,o)}_apply(o,t){t.setParameters({color:o.toUnitRGBA(),renderOccluded:this.renderOccluded})}}class u{constructor({colors:o,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=2,this.minSquaredEdgeLength=900,this.color=i(o.accent,.5),this.focusedColor=o.accent,a(this,t)}applyColor(o){this._apply(this.color,o)}applyFocused(o){this._apply(this.focusedColor,o)}_apply(o,t){t.setParameters({color:o.toUnitRGBA(),renderOccluded:this.renderOccluded})}}class f{constructor(o){this.vertex=new p({colors:o,color:o.accent,outlineColor:o.outline}),this.edge=new p({colors:o,color:s(i(o.accent,2/3),.5),outlineColor:i(o.outline,.5),size:8,collisionPadding:8}),this.selected=new p({colors:o,color:o.selected,outlineColor:o.outline}),this.edgeOffset=new u({colors:o})}}class g{constructor({colors:o,...t}){this.width=1.5,this.stipplePattern=c(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=4,this.color=o.selected,this.stippleOffColor=o.outline,this.innerColor=o.selected,a(this,t)}apply(o){o.color=this.color.toUnitRGBA(),o.width=this.width,o.stipplePattern=this.stipplePattern,o.stippleOffColor=this.stippleOffColor.toUnitRGBA(),o.falloff=this.falloff,o.innerWidth=this.innerWidth,o.innerColor=this.innerColor.toUnitRGBA(),o.renderOccluded=this.renderOccluded}}class w{constructor({colors:o,...t}){this.size=4,this.outlineSize=1,this.shape="square",this.color=o.selected,this.outlineColor=o.outline,a(this,t)}apply(o){o.color=this.color.toUnitRGBA(),o.size=this.size,o.outlineSize=this.outlineSize,o.outlineColor=this.outlineColor.toUnitRGBA(),o.primitive=this.shape}}class C{constructor({colors:o,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=h,this.globalAlphaContrastBoost=1.5,this.radius=3,this.innerColor=o.selected,this.glowColor=o.accent,this.heightFillColor=o.accent,a(this,t)}apply(o,t=1){const e={glowColor:this.glowColor.toUnitRGB(),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:this.innerColor.toUnitRGB(),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*t*this.glowColor.a,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in o?o.style=e:o.laserlineStyle=e}}class y{constructor(o){this.outline=new g({colors:o,color:o.stippleOff,renderOccluded:8,stippleOffColor:o.stippleOn,innerWidth:0}),this.staged=new g({colors:o,color:o.stippleOn,renderOccluded:8,innerColor:o.stagedSolid,stippleOffColor:o.stippleOff}),this.shadowStyle=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1})}}class O{constructor(o){this.outline=new w({colors:o,color:o.selected,outlineColor:o.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:1.5,glowWidth:6,innerColor:o.selected,innerWidth:1,radius:2})}}class m extends g{constructor({colors:o,...t}){super({colors:o}),this.extensionType=2,a(this,t)}}class A{constructor(o){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,this.lineObjects=new y(o),this.pointObjects=new O(o),this.heightPlane=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1}),this.heightBox=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:0,heightFillColor:o.accent}),this.zVerticalLine=new m({colors:o,color:i(o.accent,5*h/3),falloff:2,innerColor:i(o.selected,0),renderOccluded:4,stipplePattern:null,width:5,extensionType:2})}}let W=class extends e{constructor(o){super(o)}get colors(){const o=this.getTheme().accentColor,e=o.a;return{accent:o,contrast:l(o),selected:t.fromArray([255,255,255,e]),selectedOutline:t.fromArray([255,255,255,e]),staged:t.fromArray([12,207,255,e]),stagedSolid:t.fromArray([12,207,255,1]),outline:t.fromArray([0,0,0,.5*e]),stippleOn:t.fromArray([255,255,255,1]),stippleOff:t.fromArray([0,0,0,.5])}}get visualElements(){return new A(this.colors)}get manipulators(){return new f(this.colors)}get zManipulator(){return new d(this.colors)}};o([r()],W.prototype,"colors",null),o([r()],W.prototype,"visualElements",null),o([r()],W.prototype,"manipulators",null),o([r()],W.prototype,"zManipulator",null),o([r()],W.prototype,"getTheme",void 0),W=o([n("esri.views.3d.interactive.editingTools.settings")],W);export{W as Settings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{property as n,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import r from"../../../../../geometry/Point.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{placeAtObject as c}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as h}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as d}from"../manipulatedObjectUtils.js";import{canMoveZOperations as m}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as u}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as v}from"../tooltipUtils3D.js";import{createVisualElements as g}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as _}from"../manipulations/config.js";import{MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as f}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as y}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as S}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import w from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as O}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as x}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as I}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let k=class extends M{constructor(t){super(t),this.events=new i,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new w,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:i,view:a}=this;this.tooltip=A(()=>({view:a,options:this.sketchOptions.tooltips})),this._moveManipulation=new b({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&m(i.operations,i.elevationInfo),radius:b.radiusForSymbol(i.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles(e.events.on("immediate-click",e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})));const n=i.elevationInfo;if(this._moveManipulation.elevationInfo=n,this.addHandles(u(i)),this._moveManipulation.createManipulatedObjectDragPipeline((t,e,o,s,l)=>{if(0===t){const{snappingStep:t,cancelSnapping:e}=T({snappingContext:new O({elevationInfo:n,pointer:l,editGeometryOperations:R.fromGeometry(new r({spatialReference:i.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new h,excludeFeature:i.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});s=s.next(e),o=o.next(S(this.view,n)).next(...t)}return{steps:o,cancel:s}},i,e=>{const{action:i,object:o,dxScreen:a,dyScreen:n}=e,s={object:o,dxScreen:a,dyScreen:n};switch(i){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}}),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(this._updatingHandles.add(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new y({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([g({view:this.view,object:i,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>o()}),i.on("committed",()=>this._onGeometryChanged()),this._hideManipulatorsForObjectState(),this._updatingHandles.add(()=>a.scale,()=>this._updateMoveAngle())].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(t=>{t instanceof p&&this.addHandles(t.events.on("grab-changed",()=>this._updateManipulatorsForGrabState()))});const s=a?.type,{sketchOptions:l}=this;this._meshTooltipInfo=new H({viewType:s,sketchOptions:l}),this._pointTooltipInfo=new I({viewType:s,sketchOptions:l});const c={object:i,dxScreen:0,dyScreen:0},d={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:i,angle:e})},onRotate:e=>t.emit("rotate",{object:i,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:i,angle:e}),onScaleStart:(e,o)=>{this._emitRecordUndo(),t.emit("scale-start",{object:i,xScale:e,yScale:o})},onScale:(e,o)=>t.emit("scale",{object:i,xScale:e,yScale:o}),onScaleStop:(e,o)=>t.emit("scale-stop",{object:i,xScale:e,yScale:o})};this.addHandles(v(this.tooltip,this.object,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:d,scaleRotateTransform:this._scaleRotate}))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!x(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsForGrabState(){if(null==this._scaleRotate)return;this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing;let t=null;this._moveManipulation.grabbing?t=this._scaleRotate.disableDisplay():this._scaleRotate.grabbing&&(t=this._moveManipulation.hideManipulators()),this.removeHandles(U),t&&this.addHandles(t,U)}_createScaleRotateAdapter(){const t=d(this.object);return"mesh"===t?.type?new f({object:this.object,viewingMode:this.view.state.viewingMode}):new j({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find(t=>t.layer===this.object.graphic?.layer),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return this._updatingHandles.add(()=>this.object.visible,t=>{this._forEachManipulator(e=>e.available=t),this._moveManipulation.zManipulation.available=t&&this.enableZ&&m(this.object.operations,this.object.elevationInfo)})}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating||!!this.snappingManager?.updating}get activeTooltipInfo(){return"mesh"===d(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onActivate(){this.tooltip.hidden=!this.internallyEditable}onEditableChange(){this.internallyEditable||(this.tooltip.hidden=!0,this.tooltip.exitInputMode({focusOnView:!1}))}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=2===t.state.viewingMode||t.scale<_;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){c(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"view",void 0),t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"object",void 0),t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"enableZ",void 0),t([n()],k.prototype,"enableRotation",void 0),t([n()],k.prototype,"enableScaling",void 0),t([n({constructOnly:!0,type:w})],k.prototype,"sketchOptions",void 0),t([n({value:!1})],k.prototype,"snapToScene",null),t([n({constructOnly:!0})],k.prototype,"snappingManager",void 0),t([n({readOnly:!0})],k.prototype,"type",void 0),t([n({readOnly:!0})],k.prototype,"updating",null),t([n()],k.prototype,"activeTooltipInfo",null),k=t([s("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],k);const U=Symbol();export{k as TransformTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{colorVectorToColorAndOpacity as
|
|
2
|
+
import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as o,cross as r,transformMat4 as n,normalize as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{sv3d as c,sm4d as l}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as a}from"../../../layers/graphics/hydratedFeatures.js";import{manipulatedObjectGeometry as s}from"./editingTools/manipulatedObjectUtils.js";import{computeCentroid as u}from"../layers/graphics/graphicUtils.js";import{ColorMaterial as m}from"../webgl-engine/materials/ColorMaterial.js";function d(t,o=4,r=!0){const n=e(t),i=t[3]<1;return new m({color:n,writeDepth:!i,cullFace:2,renderOccluded:o,isDecoration:!0,shadingEnabled:r})}function f({color:e,focusedColor:t,outlineColor:o,focusedOutlineColor:r,renderOccluded:n=4,shaded:i=!0}){const c=d(e,n,i);let l,a;if(null!=o){l=g(r??o,n),a=g(o,n)}else{l=d(t??e,n,i),a=c}return{material:c,focusedMaterial:l,outlineMaterial:a}}function g(t,o=4){const r=e(t);return new m({color:r,writeDepth:!0,cullFace:1,renderOccluded:o,isDecoration:!0})}const p=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),h=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function j(e,i,a,s){const u=o(c.get(),e,a),m=O(u,r(c.get(),s,u),a,l.get());t(m,m);const d=n(c.get(),i,m);return Math.atan2(d[1],d[0])}function O(e,t,o,n){const l=i(c.get(),e),a=i(c.get(),t),s=r(c.get(),l,a);return n[0]=l[0],n[1]=l[1],n[2]=l[2],n[3]=0,n[4]=a[0],n[5]=a[1],n[6]=a[2],n[7]=0,n[8]=s[0],n[9]=s[1],n[10]=s[2],n[11]=0,n[12]=o[0],n[13]=o[1],n[14]=o[2],n[15]=1,n}function b(e,t){const o=e.getViewForGraphic(t);return null!=o&&"computeAttachmentOrigin"in o?o.computeAttachmentOrigin(t,e.spatialReference):null}function w(e,t){const o=t.origin;null==o?y(e,s(t)):e.elevationAlignedLocation=o}function y(e,t){if(null==t)return;const o="mesh"===t.type?t.origin:u(t);null!=o&&(e.location=a(o))}export{j as calculateInputRotationTransform,O as calculateTranslateRotateFromBases,d as createManipulatorMaterial,f as createManipulatorMaterials,g as createManipulatorOutlineMaterial,b as getGraphicAttachmentOrigin,w as placeAtObject,p as rotateManipulatorDefaults,h as worldScaledManipulatorSettings};
|
package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{when as n,syncAndInitial as a,watch as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import u from"../../../../../geometry/Point.js";import{clonePoint as p}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as c}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{screenToMap3D as h,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as g}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as v}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as P}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as y}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,resetProperties as w}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as M}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as S}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as j}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as b}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as L}from"../../../../support/screenUtils.js";let x=class extends P{constructor(t){super(t),this._updatingHandles=new l,this._snappingManagerResult=null,this._emulatedDrag=null,this.lineState="initial",this.removeIncompleteOnCancel=!1,this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=i(t=>new S({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new M(new _("point",y(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new d}))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:r}=this;this.measurementView=new g({toolState:this,view:t,analysis:e,analysisViewData:i,visible:r});const{start:o,end:l,cursor:c}=this.measurementView.createManipulators(),d=(t,e,i)=>{const n=f(t,(t,n,a,s)=>{const r=m(t),o=this._ensureSnappingManager(),l=this._getSnappingContext(s),c=this._updatingHandles,{lineState:d}=this;a=a.next(r).next(w(this,[i,e])).next(i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i});const g=h(this.view),v=t=>{const n=g(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let P=n.next(r).next(v);if("touch"!==s||"editing"===d){const{snappingStep:t,cancelSnapping:e}=D({snappingManager:o,snappingContext:l,updatingHandles:c});a.next(e),P=P.next(...t)}P.next(t=>"start"!==t.action?t:null).next(n=>{const a=p(n.mapEnd,new u);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)})});return"cursorPoint"===e?[n]:[n,t.events.on("grab-changed",()=>{const t=o.grabbing||l.grabbing;this.lineState=t?"editing":"measured"}),
|
|
2
|
+
import{__decorate as t}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{when as n,syncAndInitial as a,watch as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import u from"../../../../../geometry/Point.js";import{clonePoint as p}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as c}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{screenToMap3D as h,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as g}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as v}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as P}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as y}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,resetProperties as w}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as M}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as S}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as j}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as b}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as L}from"../../../../support/screenUtils.js";let x=class extends P{constructor(t){super(t),this._updatingHandles=new l,this._snappingManagerResult=null,this._emulatedDrag=null,this.lineState="initial",this.removeIncompleteOnCancel=!1,this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=i(t=>new S({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new M(new _("point",y(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new d}))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:r}=this;this.measurementView=new g({toolState:this,view:t,analysis:e,analysisViewData:i,visible:r});const{start:o,end:l,cursor:c}=this.measurementView.createManipulators(),d=(t,e,i)=>{const n=f(t,(t,n,a,s)=>{const r=m(t),o=this._ensureSnappingManager(),l=this._getSnappingContext(s),c=this._updatingHandles,{lineState:d}=this;a=a.next(r).next(w(this,[i,e])).next(i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i});const g=h(this.view),v=t=>{const n=g(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let P=n.next(r).next(v);if("touch"!==s||"editing"===d){const{snappingStep:t,cancelSnapping:e}=D({snappingManager:o,snappingContext:l,updatingHandles:c});a.next(e),P=P.next(...t)}P.next(t=>"start"!==t.action?t:null).next(n=>{const a=p(n.mapEnd,new u);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)})});return"cursorPoint"===e?[n]:[n,t.events.on("grab-changed",()=>{const t=o.grabbing||l.grabbing;this.lineState=t?"editing":"measured"}),this._updatingHandles.add(()=>this.analysis[e],e=>{e&&(t.location=e)})]};this.startManipulator=o,this.endManipulator=l,this.cursorManipulator=c,this.manipulators.add(o),this.manipulators.add(l),this.manipulators.add(c),this.addHandles([...d(o,"startPoint","startPointSurfaceLocation"),...d(l,"endPoint","endPointSurfaceLocation"),...d(c,"cursorPoint","cursorPointSurfaceLocation"),n(()=>"measured"===this.state,()=>{this.finishToolCreation(),this.active&&(this.view.activeTool=null)},a),s(()=>({startPointAvailable:null!=this.startPoint,endPointAvailable:null!=this.endPoint}),({startPointAvailable:t,endPointAvailable:e})=>{this.startManipulator.available=t,this.endManipulator.available=e},a)]),b(this)}destroy(){this._updatingHandles=e(this._updatingHandles),this.measurementView=e(this.measurementView)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(null==this._snappingManagerResult){const t=j(this.view);this._snappingManagerResult=t,this.addHandles(t)}return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(null==t.startPoint&&null==t.endPoint)return"ready";const{lineState:e}=this;return this.validMeasurement&&"editing"!==e&&"drawing"!==e?"measured":"measuring"}get cursor(){return!this.active||"ready"!==this.state&&"measured"===this.lineState?null:"crosshair"}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager?.options}get validMeasurement(){return null!=this.analysis.startPoint&&null!=this.analysis.endPoint}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}resetCreated(){super.resetCreated(),this.lineState="initial",this.cursorPoint=null,"measured"===this.state&&this.finishToolCreation()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}}_handlePointerMove(t){if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if("mouse"!==e)return;const i=L(t),{lineState:n,cursorManipulator:a,endManipulator:s}=this;let r=!1;null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(a,e,i),r=!0),"initial"===n&&(this._emulatedDrag?.update(i),r=!0),"drawing"===n&&(s.events.emit("drag",{action:"update",start:i,screenPoint:i}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){if(!this.active||!c(t))return;const e=L(t),{pointerType:i}=t,{cursorManipulator:n,startManipulator:a,endManipulator:s,lineState:r}=this;let o=!1;switch(null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(n,i,e)),r){case"initial":if(this._emulatedDrag?.update(e),null!=this.cursorPoint){this._emulatedDrag?.end(e),this._emulatedDrag=null,this.endPoint=null;const{cursorPoint:t}=this;this.startPoint=t,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,a.location=t,a.interactive=!1,s.interactive=!1,this.lineState="drawing",this._emulatedDrag=V(s,i,e),o=!0}break;case"drawing":this._emulatedDrag?.update(e),null!=this.endPoint&&(this._emulatedDrag?.end(e),this._emulatedDrag=null,a.interactive=!0,s.interactive=!0,this.lineState="measured",o=!0)}o&&t.stopPropagation()}_surfaceLocation(t,e){return 0===e?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_getElevation(t){return this.view.groundView?.ready?v(this.view.elevationProvider,t)??0:0}get test(){}};function V(t,e,i){return t.events.emit("drag",{action:"start",pointerType:e,start:i,screenPoint:i}),{update:e=>t.events.emit("drag",{action:"update",start:e,screenPoint:e}),end:e=>t.events.emit("drag",{action:"end",start:e,screenPoint:e}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}t([r()],x.prototype,"_snappingManagerResult",void 0),t([r()],x.prototype,"_snappingManager",null),t([r({readOnly:!0})],x.prototype,"state",null),t([r()],x.prototype,"lineState",void 0),t([r({readOnly:!0})],x.prototype,"cursor",null),t([r()],x.prototype,"startPoint",null),t([r()],x.prototype,"endPoint",null),t([r()],x.prototype,"cursorPoint",null),t([r({constructOnly:!0})],x.prototype,"analysis",void 0),t([r({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([r()],x.prototype,"measurementView",void 0),t([r()],x.prototype,"removeIncompleteOnCancel",void 0),t([r({constructOnly:!0})],x.prototype,"view",void 0),t([r({readOnly:!0})],x.prototype,"validMeasurement",null),t([r({value:null})],x.prototype,"startPointSurfaceLocation",void 0),t([r({value:null})],x.prototype,"endPointSurfaceLocation",void 0),t([r({value:null})],x.prototype,"cursorPointSurfaceLocation",void 0),t([r()],x.prototype,"updating",null),x=t([o("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],x);const C=x;export{C as default};
|
package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../../core/Accessor.js";import{equals as i}from"../../../../../../core/arrayUtils.js";import{property as r,subclass as s}from"../../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as o}from"../../../../../../core/support/UpdatingHandles.js";import{create as n}from"../../../../../../geometry/support/aaBoundingRect.js";import{TileKey as l}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as p}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let a=class extends t{get _sortedTilesCoveringView(){const e=(this.view.featureTiles?.tiles?.toArray()??[]).map(u),t=this._effectivePointOfInterest;return null!=t&&e.sort((e,i)=>p(t,e)-p(t,i)),e}get tileInfo(){return this.view.featureTiles?.tilingScheme?.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return null!=e?e:this.view.pointsOfInterest?.focus?.location}get updating(){return
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../../core/Accessor.js";import{equals as i}from"../../../../../../core/arrayUtils.js";import{property as r,subclass as s}from"../../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as o}from"../../../../../../core/support/UpdatingHandles.js";import{create as n}from"../../../../../../geometry/support/aaBoundingRect.js";import{TileKey as l}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as p}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let a=class extends t{get _sortedTilesCoveringView(){const e=(this.view.featureTiles?.tiles?.toArray()??[]).map(u),t=this._effectivePointOfInterest;return null!=t&&e.sort((e,i)=>p(t,e)-p(t,i)),e}get tileInfo(){return this.view.featureTiles?.tilingScheme?.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return null!=e?e:this.view.pointsOfInterest?.focus?.location}get updating(){return this.view.featureTiles?.updating||this._updatingHandles.updating}constructor(e){super(e),this.tiles=[],this.pointOfInterest=null,this._updatingHandles=new o}destroy(){this._updatingHandles.destroy()}initialize(){this.addHandles(this.view.enableFeatureTiles()),this._updatingHandles.add(()=>this._sortedTilesCoveringView,e=>this._set("tiles",e),{initial:!0,equals:(e,t)=>i(e,t,(e,t)=>e.id===t.id)})}};function u({lij:[e,t,i],extent:r}){return new l(e,t,i,r??n())}e([r({readOnly:!0})],a.prototype,"tiles",void 0),e([r({readOnly:!0})],a.prototype,"_sortedTilesCoveringView",null),e([r({readOnly:!0})],a.prototype,"tileInfo",null),e([r({readOnly:!0})],a.prototype,"tileSize",null),e([r({constructOnly:!0})],a.prototype,"view",void 0),e([r()],a.prototype,"pointOfInterest",void 0),e([r()],a.prototype,"_effectivePointOfInterest",null),e([r()],a.prototype,"updating",null),a=e([s("esri.views.3d.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],a);export{a as FeatureServiceTiles3D};
|