@arcgis/core 4.34.0-next.29 → 4.34.0-next.30

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.
Files changed (130) hide show
  1. package/Map.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0260b33daf48fc207880.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f469224c6e4804fd835a.js → 140efe4735605258ecc9.js} +1 -1
  5. package/assets/esri/core/workers/chunks/173c5b8fa1ac7aa6e072.js +1 -0
  6. package/assets/esri/core/workers/chunks/1aa6719be3afbdc7c880.js +1 -0
  7. package/assets/esri/core/workers/chunks/{8552fdb3230f4dd082c6.js → 20a96c17d1a117dfdf77.js} +1 -1
  8. package/assets/esri/core/workers/chunks/28e04ef3575f164f611a.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2173012af606ac4cdf87.js → 2a695b50a384c45ace9a.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{cf635f7ca998dd33d947.js → 439ce953a25b2776cb7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{ecdbbfebca1fcef567bb.js → 4e267a813e8b10d10b3b.js} +9 -9
  12. package/assets/esri/core/workers/chunks/7099ff8dc699fedea931.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e89698fc404379627349.js → 949dc266ac6f3505d357.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0aba41e0ee0a591b254b.js → 971b16677b66c16fb6b9.js} +1 -1
  15. package/assets/esri/core/workers/chunks/a809042fdce7ced2a415.js +1 -0
  16. package/assets/esri/core/workers/chunks/{16d82cbec34bc434efcd.js → a82d7e2eecfe654a65de.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{27e089acb1cc76758b0a.js → ac30cf2f9a94597f7665.js} +8 -8
  18. package/assets/esri/core/workers/chunks/{ec4428250dbd807df0bd.js → c50c2f014e8567870686.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ce3a1ac43e8579db65cd.js → c854c3bb4440fd942c12.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{9cbed3b43d7aadc7e627.js → ca88859fc69fcb4568c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e7209654ecdfde926272.js +1 -0
  22. package/assets/esri/core/workers/chunks/e82b1f91465d569012c4.js +1 -0
  23. package/assets/esri/core/workers/chunks/e9311386f58f3cb95c22.js +1 -0
  24. package/assets/esri/core/workers/chunks/{45485d8f0b0e0e0a6365.js → efec0f496491a0647051.js} +1 -1
  25. package/chunks/RealisticTree.glsl.js +6 -6
  26. package/colorUtils.js +1 -1
  27. package/config.js +1 -1
  28. package/core/Evented.js +1 -1
  29. package/interfaces.d.ts +2 -2
  30. package/kernel.js +1 -1
  31. package/layers/CatalogLayer.js +1 -1
  32. package/layers/FeatureLayer.js +1 -1
  33. package/layers/GeoJSONLayer.js +1 -1
  34. package/layers/GraphicsLayer.js +1 -1
  35. package/layers/OGCFeatureLayer.js +1 -1
  36. package/layers/SceneLayer.js +1 -1
  37. package/layers/SubtypeGroupLayer.js +1 -1
  38. package/layers/graphics/data/FeatureStore.js +1 -1
  39. package/layers/graphics/dehydratedPoint.js +1 -1
  40. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  41. package/layers/mixins/SublayersOwner.js +1 -1
  42. package/layers/support/LayerContingentValuesCache.js +1 -1
  43. package/networks/UtilityNetwork.js +1 -1
  44. package/package.json +1 -1
  45. package/portal/support/layersLoader.js +1 -1
  46. package/rest/networks/support/CircuitTraceResult.js +1 -1
  47. package/support/revision.js +1 -1
  48. package/views/2d/engine/ManagedCanvas.js +1 -1
  49. package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
  50. package/views/2d/engine/webgl/Profiler.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  55. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  56. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  57. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  58. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  59. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  60. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  61. package/views/2d/support/hitTestUtils.js +1 -1
  62. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  63. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  64. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementVisualization.js +5 -0
  65. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +5 -0
  66. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  67. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  68. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  69. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  70. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  71. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  72. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  73. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  74. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  75. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  76. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  80. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  81. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  82. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  83. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  84. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  85. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  86. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  87. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  88. package/views/3d/state/ViewState.js +1 -1
  89. package/views/3d/support/CombinedElevationProvider.js +1 -1
  90. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  91. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  92. package/views/3d/terrain/OverlayRenderer.js +1 -1
  93. package/views/3d/terrain/TerrainSurface.js +1 -1
  94. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  95. package/views/3d/webgl-engine/lib/ChangeSet.js +1 -1
  96. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  97. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  98. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  99. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  100. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  101. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  102. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  103. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  104. package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
  105. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  106. package/views/DOMContainer.js +1 -1
  107. package/views/Viewport2DMixin.js +1 -1
  108. package/views/draw/DrawManipulator.js +1 -1
  109. package/views/draw/DrawOperation.js +1 -1
  110. package/views/interactive/snapping/SnappingManager.js +1 -1
  111. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  112. package/views/layers/FeatureLayerView.js +1 -1
  113. package/views/layers/support/editableLayerViews.js +1 -1
  114. package/views/support/Scheduler.js +1 -1
  115. package/widgets/Editor/EditorViewModel.js +1 -1
  116. package/widgets/Editor/workflowUtils.js +1 -1
  117. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  118. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  119. package/widgets/Search/SearchViewModel.js +1 -1
  120. package/widgets/support/GeolocationPositioning.js +1 -1
  121. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  122. package/assets/esri/core/workers/chunks/230e7b817ae16505ccf0.js +0 -1
  123. package/assets/esri/core/workers/chunks/450a7ebe2535a55c5193.js +0 -1
  124. package/assets/esri/core/workers/chunks/4599f5cebbafddb6720e.js +0 -1
  125. package/assets/esri/core/workers/chunks/676fec273f2f660a614d.js +0 -1
  126. package/assets/esri/core/workers/chunks/6aced8e446beceefaf2c.js +0 -1
  127. package/assets/esri/core/workers/chunks/9f459805a6698708830a.js +0 -1
  128. package/assets/esri/core/workers/chunks/a4104b21f2b282dfb14f.js +0 -1
  129. package/assets/esri/core/workers/chunks/cab3199d37411c8ed074.js +0 -1
  130. package/assets/esri/core/workers/chunks/fbfe2195ba87d18bc37a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as o}from"../../../../analysis/featureReferenceUtils.js";import n from"../../../../core/Accessor.js";import{createTask as i}from"../../../../core/asyncUtils.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Handles.js";import{handlesGroup as a,makeHandle as l}from"../../../../core/handleUtils.js";import u from"../../../../core/Logger.js";import{abortMaybe as c}from"../../../../core/maybe.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as p,on as g}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as v,d as f,n as _,g as b,f as y,F as C,a as T}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as P}from"../../../../core/support/UpdatingHandles.js";import I from"../../../../geometry/Point.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as S}from"../../../../geometry/projection/projectBoundingRect.js";import{intersectsSegment as w}from"../../../../geometry/support/aaBoundingBox.js";import{empty as R,containsPointObject as A,intersectsSegment as H}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as E,create as L}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as V}from"../../../../support/elevationInfoUtils.js";import F from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as x}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as D}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as G}from"../support/projectionUtils.js";import{toGraphic as U}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as N}from"../../../support/Scheduler.js";let k=class extends(r.EventedMixin(n)){constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new P,this._frameTask=z,this._computationHandles=new s,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(N.LINE_OF_SIGHT_TOOL):z,this._intersector=new D({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:o,computationResult:n}=t,{observerAdjusted:i,targetAdjusted:r}=o,{start:s,end:a}=n;v(s,i),v(a,r);this._canCompute(t)?this._computeIntersection(e):B(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){const{view:o}=this,{inputPoints:n}=e,{observer:i,target:r,observerAdjusted:s,targetAdjusted:a}=n;v(s,i),v(a,r),t(o,this._intersector.intersector,n);const{observerSurfaceNormal:l,targetSurfaceNormal:u}=n,c=this._screenPixelSize,d=q;null!=l?v(d,l):f(d,a,s);const p=c;_(d,d),b(d,d,Math.min(p,1)),y(s,s,d),null!=u?v(d,u):f(d,s,a);const g=o.state.camera.computeScreenPixelSizeAt(a);_(d,d),b(d,d,Math.min(g,1)),y(a,a,d)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:o}=this,{sceneIntersectionHelper:n,renderCoordsHelper:i}=o;if(null==n)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=E(c,d,J);r.options.store=0,n.intersectToolIntersectorRay(p,r);const g=r.results.min,h=s.intersection,m=q;let f=!0;if(null!=g&&g.getIntersectionPoint(h)){v(t.originalIntersection,h),v(t.originalObserver,c),v(t.originalTarget,d),i.fromRenderCoords(h,m,o.spatialReference);const e=1-C(d,u)/C(c,u);f=C(l,h)>=e*C(l,u)}const _=new I(m,o.spatialReference);{const{result:t,target:n}=e;null!=t?(t.target=n,t.intersectedGraphic=f?null:U(g,o),t.intersectedLocation=f?null:_,t.visible=f):e.result=new F({target:n,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:U(g,o),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,o=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==o)return!1;const{observerAdjusted:n,targetAdjusted:i}=e.inputPoints,r=o.intersectsPoint(n),s=o.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,t,n,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==t)return G(this.analysis,e.spatialReference,u.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=M(t,n),{absoluteZ:a,elevation:l}=V(t.x,t.y,t.z,this.view.spatialReference,this.view,s),c=t.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=O();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-l,this._observerFeatureId=o(i),this.priority=N.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,o,n,i){const{inputPoints:r}=e;switch(v(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,n){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,o,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=N.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,n,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==n)return null!=t&&G(this.analysis,t.spatialReference,u.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const l=M(n,i),{absoluteZ:c,elevation:d}=V(n.x,n.y,n.z,this.view.spatialReference,this.view,l),p=n.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=o(r),a.targetSurfaceNormal=null,l.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=N.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return a([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:j(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetElevationInfo:o,targetFeatureInfo:n,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,o,n):this._updatingHandles.addPromise(i.pending)},p)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},p)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:o,observerElevationMode:n,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,o,n,i)},p)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){const t=(o,n)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=j(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(o,n));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=j(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(o,n));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(S(o,n,K,this.view.spatialReference),null!=s&&A(K,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&A(K,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&H(K,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",({extent:e,spatialReference:o})=>t(e,o))}_connectComputationToTask(e){let t=null;const o={computation:e,interpolationInfo:{originalIntersection:O(),originalObserver:O(),originalTarget:O()}};return a([this._updatingHandles.add(()=>e.inputPoints,()=>{t=c(t),t=i(async e=>{await d(this._frameTask.schedule(()=>this._computeResult(o),e))})},{initial:!0,equals:()=>!1}),l(()=>t=c(t))])}_connectComputationToContent(e){return g(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,"request-update",t=>{const o=t?.renderBounds,{observerAdjusted:n,targetAdjusted:i}=e.inputPoints;(null==o||w(o,n,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const o of t)this._disconnectComputation(o);for(const o of e)this._connectComputation(o)}_onTargetCollectionChange({added:e,removed:t}){for(const o of t)this._removeTarget(o);for(const o of e)this._addTarget(o)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new x({target:e}))}_removeTarget(e){const t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return a([this._updatingHandles.add(()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:j(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null}),({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:o,observerFeatureInfo:n})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,o,n,!0):this._updatingHandles.addPromise(t.pending)},p)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return a([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:o}=t;if(null==e||null==o)return!1;const n=q;o.toRenderCoords(e,n);const i=t.state.camera.computeScreenPixelSizeAt(n);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>Z}};function M(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}function B({computation:e,interpolationInfo:t}){const{computationResult:o,inputPoints:n}=e,{start:i,end:r,intersection:s}=o,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(v(s,a),n.isValid){const e=q,t=C(l,a)/C(l,u);T(e,i,l),b(e,e,1-t),y(s,s,e),T(e,r,u),b(e,e,t),y(s,s,e),o.isValid=!0}else e.result=null,o.isValid=!1,o.isTargetVisible=!1}e([h({constructOnly:!0})],k.prototype,"analysis",void 0),e([h({constructOnly:!0})],k.prototype,"analysisViewData",void 0),e([h({constructOnly:!0})],k.prototype,"view",void 0),e([h()],k.prototype,"updating",null),e([h()],k.prototype,"priority",null),e([h()],k.prototype,"updateOnCameraChange",void 0),e([h()],k.prototype,"_computations",null),e([h()],k.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([h()],k.prototype,"_observerGroundOffsetRenderSpace",void 0),e([h()],k.prototype,"_effectiveObserverElevationMode",void 0),e([h()],k.prototype,"_observerFeatureId",void 0),e([h()],k.prototype,"_screenPixelSize",null),e([h({readOnly:!0})],k.prototype,"_updatingHandles",void 0),e([h()],k.prototype,"_frameTask",void 0),e([h()],k.prototype,"_isCameraDirty",null),k=e([m("esri.views.3d.analysis.LineOfSight.LineOfSightController")],k);const Z=.1,q=O(),J=L(),K=R();export{k as LineOfSightController};
5
+ import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as o}from"../../../../analysis/featureReferenceUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{initial as d,on as p}from"../../../../core/reactiveUtils.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as m,d as v,n as f,g as _,f as b,F as y,a as C}from"../../../../chunks/vec32.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as O}from"../../../../core/support/UpdatingHandles.js";import P from"../../../../geometry/Point.js";import{projectOrLoad as I}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as S}from"../../../../geometry/projection/projectBoundingRect.js";import{intersectsSegment as j}from"../../../../geometry/support/aaBoundingBox.js";import{empty as w,containsPointObject as R,intersectsSegment as A}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as H,create as E}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as L}from"../../../../support/elevationInfoUtils.js";import V from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as x}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as D}from"../support/projectionUtils.js";import{toGraphic as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as U,TaskPriority as z}from"../../../support/Scheduler.js";let N=class extends i.EventedAccessor{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new O,this._frameTask=U,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(z.LINE_OF_SIGHT_TOOL):U,this._intersector=new x({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:o,computationResult:n}=t,{observerAdjusted:i,targetAdjusted:r}=o,{start:s,end:a}=n;m(s,i),m(a,r);this._canCompute(t)?this._computeIntersection(e):M(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){const{view:o}=this,{inputPoints:n}=e,{observer:i,target:r,observerAdjusted:s,targetAdjusted:a}=n;m(s,i),m(a,r),t(o,this._intersector.intersector,n);const{observerSurfaceNormal:l,targetSurfaceNormal:u}=n,c=this._screenPixelSize,d=Z;null!=l?m(d,l):v(d,a,s);const p=c;f(d,d),_(d,d,Math.min(p,1)),b(s,s,d),null!=u?m(d,u):v(d,s,a);const g=o.state.camera.computeScreenPixelSizeAt(a);f(d,d),_(d,d,Math.min(g,1)),b(a,a,d)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:o}=this,{sceneIntersectionHelper:n,renderCoordsHelper:i}=o;if(null==n)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=H(c,d,q);r.options.store=0,n.intersectToolIntersectorRay(p,r);const g=r.results.min,h=s.intersection,v=Z;let f=!0;if(null!=g&&g.getIntersectionPoint(h)){m(t.originalIntersection,h),m(t.originalObserver,c),m(t.originalTarget,d),i.fromRenderCoords(h,v,o.spatialReference);const e=1-y(d,u)/y(c,u);f=y(l,h)>=e*y(l,u)}const _=new P(v,o.spatialReference);{const{result:t,target:n}=e;null!=t?(t.target=n,t.intersectedGraphic=f?null:G(g,o),t.intersectedLocation=f?null:_,t.visible=f):e.result=new V({target:n,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:G(g,o),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,o=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==o)return!1;const{observerAdjusted:n,targetAdjusted:i}=e.inputPoints,r=o.intersectsPoint(n),s=o.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,t,n,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==t)return D(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=k(t,n),{absoluteZ:a,elevation:u}=L(t.x,t.y,t.z,this.view.spatialReference,this.view,s),c=t.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=T();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=o(i),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,o,n,i){const{inputPoints:r}=e;switch(m(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,n){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,o,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,n,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==n)return null!=t&&D(this.analysis,t.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=k(n,i),{absoluteZ:c,elevation:d}=L(n.x,n.y,n.z,this.view.spatialReference,this.view,u),p=n.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=o(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:I(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetElevationInfo:o,targetFeatureInfo:n,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,o,n):this._updatingHandles.addPromise(i.pending)},d)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:o,observerElevationMode:n,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,o,n,i)},d)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){const t=(o,n)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=I(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(o,n));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=I(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(o,n));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(S(o,n,J,this.view.spatialReference),null!=s&&R(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&R(J,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&A(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",({extent:e,spatialReference:o})=>t(e,o))}_connectComputationToTask(e){let t=null;const o={computation:e,interpolationInfo:{originalIntersection:T(),originalObserver:T(),originalTarget:T()}};return s([this._updatingHandles.add(()=>e.inputPoints,()=>{t=u(t),t=n(async e=>{await c(this._frameTask.schedule(()=>this._computeResult(o),e))})},{initial:!0,equals:()=>!1}),a(()=>t=u(t))])}_connectComputationToContent(e){return p(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,"request-update",t=>{const o=t?.renderBounds,{observerAdjusted:n,targetAdjusted:i}=e.inputPoints;(null==o||j(o,n,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const o of t)this._disconnectComputation(o);for(const o of e)this._connectComputation(o)}_onTargetCollectionChange({added:e,removed:t}){for(const o of t)this._removeTarget(o);for(const o of e)this._addTarget(o)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add(()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:I(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null}),({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:o,observerFeatureInfo:n})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,o,n,!0):this._updatingHandles.addPromise(t.pending)},d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:o}=t;if(null==e||null==o)return!1;const n=Z;o.toRenderCoords(e,n);const i=t.state.camera.computeScreenPixelSizeAt(n);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>B}};function k(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}function M({computation:e,interpolationInfo:t}){const{computationResult:o,inputPoints:n}=e,{start:i,end:r,intersection:s}=o,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(m(s,a),n.isValid){const e=Z,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),o.isValid=!0}else e.result=null,o.isValid=!1,o.isTargetVisible=!1}e([g({constructOnly:!0})],N.prototype,"analysis",void 0),e([g({constructOnly:!0})],N.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],N.prototype,"view",void 0),e([g()],N.prototype,"updating",null),e([g()],N.prototype,"priority",null),e([g()],N.prototype,"updateOnCameraChange",void 0),e([g()],N.prototype,"_computations",null),e([g()],N.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([g()],N.prototype,"_observerGroundOffsetRenderSpace",void 0),e([g()],N.prototype,"_effectiveObserverElevationMode",void 0),e([g()],N.prototype,"_observerFeatureId",void 0),e([g()],N.prototype,"_screenPixelSize",null),e([g({readOnly:!0})],N.prototype,"_updatingHandles",void 0),e([g()],N.prototype,"_frameTask",void 0),e([g()],N.prototype,"_isCameraDirty",null),N=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightController")],N);const B=.1,Z=T(),q=E(),J=w();export{N as LineOfSightController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{syncAndInitial as o,watch as r}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as p}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as d,empty as c,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as y}from"../support/projectionUtils.js";import{getElevationAtPoint as u}from"../../support/ElevationProvider.js";let g=class extends t{constructor(e){super(e),this._updatingHandles=new n}initialize(){this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:l(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},o),this.addHandles([this._createElevationUpdateHandle(),r(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry())])}destroy(){this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}_createElevationUpdateHandle(){const e=t=>{const i=this.analysis.geometry;if(null==i)return;const o=l(i,this.view.spatialReference);if(null!=o.pending)return this._updatingHandles.addPromise(o.pending),void o.pending.finally(()=>e(t));const r=o.geometry;null!=r&&null!=r.extent&&(p(t.extent,t.spatialReference,v,this.view.spatialReference),d(r.extent,f),m(v,f)&&this._onGeometryChange(i,r))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:o}=this.view;if(null==e)return void(this.analysisViewData.elevationAlignedGeometry=null);if(null==t)return y(this.analysis,e.spatialReference,i.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);const r=t.clone();h(o,r),this.analysisViewData.elevationAlignedGeometry=r}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:i}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||!i)return void(this.analysisViewData.targetGeometry=t);const o=t.clone();o.rings[0].forEach(e=>{e[2]=i}),this.analysisViewData.targetGeometry=o}};function h(e,t){t.rings[0].forEach(t=>{t[2]=u(e,t,"ground")??0})}e([s({constructOnly:!0})],g.prototype,"analysis",void 0),e([s({constructOnly:!0})],g.prototype,"analysisViewData",void 0),e([s({constructOnly:!0})],g.prototype,"view",void 0),e([s()],g.prototype,"updating",null),e([s({readOnly:!0})],g.prototype,"_updatingHandles",void 0),g=e([a("esri.views.3d.analysis.VolumeMeasurement.CutFillVolumeMeasurementController")],g);const v=c(),f=c();export{g as CutFillVolumeMeasurementController};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{syncAndInitial as o,watch as r}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as p}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as d,empty as c,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as y}from"../support/projectionUtils.js";import{getElevationAtPoint as u}from"../../support/ElevationProvider.js";let g=class extends t{constructor(e){super(e),this._updatingHandles=new n}initialize(){this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:l(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},o),this.addHandles([this._createElevationUpdateHandle(),r(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry())])}destroy(){this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}_createElevationUpdateHandle(){const e=t=>{const i=this.analysis.geometry;if(null==i)return;const o=l(i,this.view.spatialReference);if(null!=o.pending)return this._updatingHandles.addPromise(o.pending),void o.pending.finally(()=>e(t));const r=o.geometry;null!=r&&null!=r.extent&&(p(t.extent,t.spatialReference,v,this.view.spatialReference),d(r.extent,f),m(v,f)&&this._onGeometryChange(i,r))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:o}=this.view,{valid:r}=this.analysis;if(null==e||!r)return void(this.analysisViewData.elevationAlignedGeometry=null);if(null==t)return y(this.analysis,e.spatialReference,i.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);const s=t.clone();h(o,s),this.analysisViewData.elevationAlignedGeometry=s}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:i}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||!i)return void(this.analysisViewData.targetGeometry=t);const o=t.clone();o.rings[0].forEach(e=>{e[2]=i}),this.analysisViewData.targetGeometry=o}};function h(e,t){t.rings[0].forEach(t=>{t[2]=u(e,t,"ground")??0})}e([s({constructOnly:!0})],g.prototype,"analysis",void 0),e([s({constructOnly:!0})],g.prototype,"analysisViewData",void 0),e([s({constructOnly:!0})],g.prototype,"view",void 0),e([s()],g.prototype,"updating",null),e([s({readOnly:!0})],g.prototype,"_updatingHandles",void 0),g=e([a("esri.views.3d.analysis.VolumeMeasurement.CutFillVolumeMeasurementController")],g);const v=c(),f=c();export{g as CutFillVolumeMeasurementController};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as l}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{cutFillConfiguration as m}from"./VolumeMeasurementConfiguration.js";import{LineVisualElement as c}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as p}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as h}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as u}from"../../webgl-engine/materials/lineStippleUtils.js";let d=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}constructor(e){super(e)}initialize(){const{accentColor:e}=this.view.effectiveTheme,i={view:this.view,isDecoration:!0},o=m,r={...i,width:o.geometryOutlineWidth},n=t.toUnitRGBA(e),l=t.toUnitRGBA(o.targetGeometryOutlineColor);this._elevationAlignedGeometry=new p({...r,isDraped:!0,color:n}),this._targetGeometry=new p({...r,color:l});const a={...i,attached:!0,width:o.projectionLineWidth,stipplePattern:u(o.projectionLineStippleSize),renderOccluded:4},h=t.toUnitRGBA(o.cutProjectionLineColor),d=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new c({...a,color:h}),this._fillProjectionLines=new c({...a,color:d}),this.addHandles([s(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),s(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)})])}destroy(){this._elevationAlignedGeometry=o(this._elevationAlignedGeometry),this._targetGeometry=o(this._targetGeometry),this._cutProjectionLines=o(this._cutProjectionLines),this._fillProjectionLines=o(this._fillProjectionLines)}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:o}=this.view,s=o.spatialReference,r=[],n=[],a=t.spatialReference;for(let m=0;m<t.rings[0].length;++m){const e=t.rings[0][m],c=l(y,e[0],e[1],e[2]);o.toRenderCoords(c,a,c);const p=i.rings[0][m],u=l(v,p[0],p[1],p[2]);o.toRenderCoords(u,a,u);const d=new h(c,u,s);c[2]>u[2]?r.push(d):n.push(d)}this._cutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(n)}};e([r({constructOnly:!0})],d.prototype,"view",void 0),e([r({constructOnly:!0})],d.prototype,"analysisViewData",void 0),e([r({readOnly:!0})],d.prototype,"visible",null),d=e([n("esri.views.3d.analysis.VolumeMeasurement.CutFillVolumeMeasurementVisualization")],d);const y=a(),v=a();export{d as CutFillVolumeMeasurementVisualization};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import o from"../../../../Color.js";const t=new o("black");class i{constructor(){this.geometryOutlineWidth=1.5,this.targetGeometryOutlineColor=new o("grey"),this.cutColor=new o([153,198,111,.9]),this.fillColor=new o([200,200,230,.8]),this.cutProjectionLineColor=o.blendColors(this.cutColor,t,.4),this.fillProjectionLineColor=o.blendColors(this.fillColor,t,.4),this.projectionLineWidth=2,this.projectionLineStippleSize=4}}const e=new i;export{e as cutFillConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as l}from"./AnalysisView3D.js";import{CutFillVolumeMeasurementController as i}from"./VolumeMeasurement/CutFillVolumeMeasurementController.js";let n=class extends(l(t)){constructor(e){super(e),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null}initialize(){const{analysis:e,view:t}=this;this._analysisController=new i({view:t,analysis:e,analysisViewData:this})}destroy(){this._analysisController=o(this._analysisController)}get result(){return null}get effectiveTargetElevation(){const{targetElevation:e}=this.analysis.cutFillOptions;if(null!=e)return e;const t=this.elevationAlignedGeometry?.extent;return t&&t.zmin&&t.zmax?(t.zmax+t.zmin)/2:null}get updating(){return null!=this._analysisController&&this._analysisController.updating}};e([r({readOnly:!0})],n.prototype,"type",void 0),e([r({constructOnly:!0,nonNullable:!0})],n.prototype,"analysis",void 0),e([r()],n.prototype,"result",null),e([r()],n.prototype,"elevationAlignedGeometry",void 0),e([r({type:Number})],n.prototype,"effectiveTargetElevation",null),e([r()],n.prototype,"targetGeometry",void 0),e([r()],n.prototype,"updating",null),n=e([s("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],n);const a=n;export{a as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as r}from"./AnalysisView3D.js";import{CutFillVolumeMeasurementController as l}from"./VolumeMeasurement/CutFillVolumeMeasurementController.js";import{CutFillVolumeMeasurementVisualization as a}from"./VolumeMeasurement/CutFillVolumeMeasurementVisualization.js";let n=class extends(r(t)){constructor(e){super(e),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null}initialize(){const{analysis:e,view:t}=this;this._analysisController=new l({view:t,analysis:e,analysisViewData:this}),this._analysisVisualization=new a({view:t,analysisViewData:this})}destroy(){this._analysisController=s(this._analysisController),this._analysisVisualization=s(this._analysisVisualization)}get result(){return null}get effectiveTargetElevation(){const{targetElevation:e}=this.analysis.cutFillOptions;if(null!=e)return e;const t=this.elevationAlignedGeometry?.extent;return t&&t.zmin&&t.zmax?(t.zmax+t.zmin)/2:null}get updating(){return null!=this._analysisController&&this._analysisController.updating}};e([o({readOnly:!0})],n.prototype,"type",void 0),e([o({constructOnly:!0,nonNullable:!0})],n.prototype,"analysis",void 0),e([o()],n.prototype,"result",null),e([o()],n.prototype,"elevationAlignedGeometry",void 0),e([o({type:Number})],n.prototype,"effectiveTargetElevation",null),e([o()],n.prototype,"targetGeometry",void 0),e([o()],n.prototype,"updating",null),n=e([i("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],n);const u=n;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import a from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{makeHandle as e,handlesGroup as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{watch as s,initial as n}from"../../../../../core/reactiveUtils.js";import{fromTranslation as l,fromZRotation as p,multiply as u,fromRotation as h,fromScaling as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d}from"../../../../../chunks/vec32.js";import{fromValues as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as _,sm4d as g}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as M}from"../../Manipulator3D.js";import{RenderObject as w}from"../../RenderObject.js";import{screenToMapXYAtLocation as v}from"../dragEventPipeline3D.js";import{discRadius as j,discTranslateArrowOffset as b,discTranslateArrowSize as y,discHeight as A}from"./config.js";import{Manipulation as I}from"./Manipulation.js";import{createManipulatedMoveDragPipeline as x}from"./moveUtils.js";import{createExtrudedTriangle as D,transformInPlace as T}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as P}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as S,dragAtLocation as E,constrainToMapAxis as O,addScreenDelta as U}from"../../../../interactive/dragEventPipeline.js";class R extends I{constructor(t){super(),this._handles=new r,this._arrowManipulatorInfos=new Array,this._angle=0,this._scale=1,this._radius=j,this._updateAfterDrag=!1,this.events=new a,this._tool=t.tool,this._view=t.view,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),null!=t.radius&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}set orthogonalAvailable(t){this._arrowManipulatorInfos.length>=3&&(this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t)}destroy(){this._handles=o(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:a}of this._arrowManipulatorInfos)t(a,1)}createManipulatedObjectDragPipeline(t,a,r){if(!a.operations)return e();const i=a.operations.data.spatialReference,o=a.graphic;return x(a,r,r=>this.createDragPipeline((a,e,i,o,s)=>(({steps:e,cancel:i}=t(a,e,i,o,s)),r(a,e,i)),a.elevationInfo,i,o))}createDragPipeline(t,a,r,e){return i(this._arrowManipulatorInfos.map(({manipulator:i},o)=>S(i,(i,s,n,l,p)=>{const u=s.next(t=>({...t,manipulatorType:1})).next(E(this._view,i.elevationAlignedLocation)).next(v(this._view,i.elevationAlignedLocation,a,r,e)).next(O(i.location,this.angle+(o+1)*Math.PI*.5)).next(U());t(i,u,n,l,p)})))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t<this._arrowManipulatorInfos.length;t++)this._updateArrowManipulator(this._arrowManipulatorInfos[t],t);this._updateManipulatorTransform()}_updateArrowManipulator({manipulator:t,transform:a},r){const e=this._radius/j,i=y*e,o=i*Math.sqrt(3)/2,s=D(this._opaqueMaterial,o,i/2,i/2,A);T(s,l(g.get(),d(_.get(),0,-o/3,0))),t.renderObjects=[new w(s,2),new w(s.instantiate({material:this._transparentMaterial}),1)],t.radius=o/3*2*1.2;const n=p(g.get(),r*Math.PI/2),h=l(g.get(),d(_.get(),0,b*e,0));u(a,n,h)}_createManipulators(){for(let t=0;t<4;t++){const a=this._createArrowManipulator(t);this._arrowManipulatorInfos.push(a)}this._updateManipulatorTransform()}_updateManipulatorTransform(){const t=this.angle,a=h(g.get(),t,f(0,0,1));if(null==a)return;const r=c(g.get(),d(_.get(),this.displayScale,this.displayScale,this.displayScale)),e=u(g.get(),r,a);for(const i of this._arrowManipulatorInfos){const t=u(g.get(),e,i.transform);i.manipulator.modelTransform=t}}_createArrowManipulator(t){const a=new M({view:this._view,autoScaleRenderObjects:!1,worldOriented:!0,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:f(0,0,1)}}),r={manipulator:a,transform:m()};return this._updateArrowManipulator(r,t),this._handles.add(a.events.on("drag",t=>{this._updateAfterDrag&&"end"===t.action&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)})),r}_createMaterial(a=1){const r=new P({cullFace:2,renderOccluded:2,isDecoration:!0});return this._handles.add(s(()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor),t=>{t[3]*=a,r.setParameters({color:t})},n)),r}get test(){}}export{R as MoveXYAxisManipulation};
5
+ import t from"../../../../../Color.js";import a from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{makeHandle as e,handlesGroup as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{watch as s,initial as n}from"../../../../../core/reactiveUtils.js";import{fromTranslation as l,fromZRotation as p,multiply as u,fromRotation as h,fromScaling as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d}from"../../../../../chunks/vec32.js";import{fromValues as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as _,sm4d as g}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as M}from"../../Manipulator3D.js";import{RenderObject as w}from"../../RenderObject.js";import{screenToMapXYAtLocation as v}from"../dragEventPipeline3D.js";import{discRadius as j,discTranslateArrowOffset as b,discTranslateArrowSize as y,discHeight as A}from"./config.js";import{Manipulation as I}from"./Manipulation.js";import{createManipulatedMoveDragPipeline as x}from"./moveUtils.js";import{createExtrudedTriangle as D,transformInPlace as T}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as E}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as P,dragAtLocation as S,constrainToMapAxis as O,addScreenDelta as U}from"../../../../interactive/dragEventPipeline.js";class R extends I{constructor(t){super(),this._handles=new r,this._arrowManipulatorInfos=new Array,this._angle=0,this._scale=1,this._radius=j,this._updateAfterDrag=!1,this.events=new a.EventEmitter,this._tool=t.tool,this._view=t.view,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),null!=t.radius&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}set orthogonalAvailable(t){this._arrowManipulatorInfos.length>=3&&(this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t)}destroy(){this._handles=o(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:a}of this._arrowManipulatorInfos)t(a,1)}createManipulatedObjectDragPipeline(t,a,r){if(!a.operations)return e();const i=a.operations.data.spatialReference,o=a.graphic;return x(a,r,r=>this.createDragPipeline((a,e,i,o,s)=>(({steps:e,cancel:i}=t(a,e,i,o,s)),r(a,e,i)),a.elevationInfo,i,o))}createDragPipeline(t,a,r,e){return i(this._arrowManipulatorInfos.map(({manipulator:i},o)=>P(i,(i,s,n,l,p)=>{const u=s.next(t=>({...t,manipulatorType:1})).next(S(this._view,i.elevationAlignedLocation)).next(v(this._view,i.elevationAlignedLocation,a,r,e)).next(O(i.location,this.angle+(o+1)*Math.PI*.5)).next(U());t(i,u,n,l,p)})))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t<this._arrowManipulatorInfos.length;t++)this._updateArrowManipulator(this._arrowManipulatorInfos[t],t);this._updateManipulatorTransform()}_updateArrowManipulator({manipulator:t,transform:a},r){const e=this._radius/j,i=y*e,o=i*Math.sqrt(3)/2,s=D(this._opaqueMaterial,o,i/2,i/2,A);T(s,l(g.get(),d(_.get(),0,-o/3,0))),t.renderObjects=[new w(s,2),new w(s.instantiate({material:this._transparentMaterial}),1)],t.radius=o/3*2*1.2;const n=p(g.get(),r*Math.PI/2),h=l(g.get(),d(_.get(),0,b*e,0));u(a,n,h)}_createManipulators(){for(let t=0;t<4;t++){const a=this._createArrowManipulator(t);this._arrowManipulatorInfos.push(a)}this._updateManipulatorTransform()}_updateManipulatorTransform(){const t=this.angle,a=h(g.get(),t,f(0,0,1));if(null==a)return;const r=c(g.get(),d(_.get(),this.displayScale,this.displayScale,this.displayScale)),e=u(g.get(),r,a);for(const i of this._arrowManipulatorInfos){const t=u(g.get(),e,i.transform);i.manipulator.modelTransform=t}}_createArrowManipulator(t){const a=new M({view:this._view,autoScaleRenderObjects:!1,worldOriented:!0,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:f(0,0,1)}}),r={manipulator:a,transform:m()};return this._updateArrowManipulator(r,t),this._handles.add(a.events.on("drag",t=>{this._updateAfterDrag&&"end"===t.action&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)})),r}_createMaterial(a=1){const r=new E({cullFace:2,renderOccluded:2,isDecoration:!0});return this._handles.add(s(()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor),t=>{t[3]*=a,r.setParameters({color:t})},n)),r}get test(){}}export{R as MoveXYAxisManipulation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import{darken as e}from"../../../../../core/colorUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{clamp as a}from"../../../../../core/mathUtils.js";import{removeMaybe as o}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{translate as n,rotateX as l}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{F as m,d,n as u,e as p,h,g as f}from"../../../../../chunks/vec32.js";import{fromValues as _,create as j}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Manipulator3D as w}from"../../Manipulator3D.js";import{createManipulatorMaterial as v}from"../../manipulatorUtils.js";import{RenderObject as g}from"../../RenderObject.js";import{screenToZConstrained as M}from"../dragEventPipeline3D.js";import{Settings as O}from"../settings.js";import{discRadius as U}from"./config.js";import{Manipulation as b}from"./Manipulation.js";import{createManipulatedMoveDragPipeline as P}from"./moveUtils.js";import{createTubeGeometry as y,createConeGeometry as z}from"../../../webgl-engine/lib/GeometryUtil.js";import{createManipulatorDragEventPipeline as x,addScreenDelta as T}from"../../../../interactive/dragEventPipeline.js";class F extends b{constructor(t){super(),this._radius=U,this.events=new i,this._tool=t.tool,this._view=t.view;const e=new O({getTheme:()=>this._view.effectiveTheme});this._settings=e,null!=t.radius&&(this._radius=t.radius);const r=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:v(C(r,1,.25),1),materialFocused:v(C(r,1,0),1),materialOccludedUnfocused:v(C(r,.7,0),e.zManipulator.renderOccluded),materialOccludedFocused:v(C(r,.85,0),e.zManipulator.renderOccluded)},this._themeHandle=s(()=>this._view.effectiveTheme.accentColor,t=>{const e=C(t,1,.25),i=C(t,1,0),r=C(t,.7,0),a=C(t,.85,0),{materialUnfocused:o,materialFocused:s,materialOccludedUnfocused:n,materialOccludedFocused:l}=this._materials;o.setParameters({color:e}),s.setParameters({color:i}),n.setParameters({color:r}),l.setParameters({color:a})}),this._createManipulator(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._themeHandle=o(this._themeHandle),this._manipulator.applyObjectTransform=R,this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){t(this._manipulator,0)}createManipulatedObjectDragPipeline(t,e,i){if(!e.operations)return r();const a=e.operations.data.spatialReference;return P(e,i,e=>this.createDragPipeline((i,r,a,o,s)=>(({steps:r,cancel:a}=t(i,r,a,o,s)),e(i,r,a)),a))}createDragPipeline(t,e){const i=this._view;return x(this._manipulator,(r,a,o,s,n)=>{const l=a.next(t=>({...t,manipulatorType:0})).next(M(i,r.renderLocation,e)).next(T());t(r,l,o,s,n)})}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}_updateManipulator(){const t=this._settings,e=this._radius/U,i=t.zManipulator.height*e,r=t.zManipulator.coneHeight*e,a=t.zManipulator.coneWidth*e,o=t.zManipulator.width*e,s=[_(0,0,0),_(0,0,i)],m=[_(0,0,0),_(0,0,i+r)],d=(()=>{const t=c();return n(t,t,[0,0,i]),l(t,t,Math.PI/2),t})(),{materialUnfocused:u,materialFocused:p,materialOccludedUnfocused:h,materialOccludedFocused:f}=this._materials,j=y(u,s,o/2,16,!1),w=z(u,r,a/2,16,!1);w.transformation=d,this._manipulator.renderObjects=[new g(w,1),new g(j,1),new g(w.instantiate({material:p}),2),new g(j.instantiate({material:p}),2),new g(w.instantiate({material:h}),1),new g(j.instantiate({material:h}),1),new g(w.instantiate({material:f}),2),new g(j.instantiate({material:f}),2)],this._manipulator.radius=o/2+2,this._manipulator.collisionType={type:"line",paths:[m]}}_createManipulator(){const t=this._view,e=new w({view:t,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});e.applyObjectTransform=e=>{const i=t.state.camera,r=D;t.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,r);const o=m(i.eye,r),s=i.computeRenderPixelSizeAtDist(o),n=d(E,r,i.eye);u(n,n);const l=H;t.renderCoordsHelper.worldUpAtPosition(D,l);const c=Math.abs(p(n,l)),_=h(E,n,l),j=h(E,_,l),w=a(c,.01,1),v=1-Math.sqrt(1-w*w)/w/i.fullWidth,g=this._settings,M=this._radius/U,O=g.zManipulator.width*M;f(j,u(j,j),(1/v-1)*o+s*O),e[12]-=E[0],e[13]-=E[1],e[14]-=E[2]},this._manipulator=e,this._updateManipulator()}get test(){}}function C(i,r,a){const o=e(i,a);return o.a*=r,t.toUnitRGBA(o)}const D=j(),E=j(),H=j(),R=()=>{};export{F as MoveZManipulation};
5
+ import t from"../../../../../Color.js";import{darken as e}from"../../../../../core/colorUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{clamp as a}from"../../../../../core/mathUtils.js";import{removeMaybe as o}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{translate as n,rotateX as l}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{F as m,d,n as u,e as p,h,g as f}from"../../../../../chunks/vec32.js";import{fromValues as _,create as j}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Manipulator3D as v}from"../../Manipulator3D.js";import{createManipulatorMaterial as w}from"../../manipulatorUtils.js";import{RenderObject as g}from"../../RenderObject.js";import{screenToZConstrained as M}from"../dragEventPipeline3D.js";import{Settings as O}from"../settings.js";import{discRadius as U}from"./config.js";import{Manipulation as b}from"./Manipulation.js";import{createManipulatedMoveDragPipeline as P}from"./moveUtils.js";import{createTubeGeometry as y,createConeGeometry as z}from"../../../webgl-engine/lib/GeometryUtil.js";import{createManipulatorDragEventPipeline as x,addScreenDelta as E}from"../../../../interactive/dragEventPipeline.js";class T extends b{constructor(t){super(),this._radius=U,this.events=new i.EventEmitter,this._tool=t.tool,this._view=t.view;const e=new O({getTheme:()=>this._view.effectiveTheme});this._settings=e,null!=t.radius&&(this._radius=t.radius);const r=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:w(F(r,1,.25),1),materialFocused:w(F(r,1,0),1),materialOccludedUnfocused:w(F(r,.7,0),e.zManipulator.renderOccluded),materialOccludedFocused:w(F(r,.85,0),e.zManipulator.renderOccluded)},this._themeHandle=s(()=>this._view.effectiveTheme.accentColor,t=>{const e=F(t,1,.25),i=F(t,1,0),r=F(t,.7,0),a=F(t,.85,0),{materialUnfocused:o,materialFocused:s,materialOccludedUnfocused:n,materialOccludedFocused:l}=this._materials;o.setParameters({color:e}),s.setParameters({color:i}),n.setParameters({color:r}),l.setParameters({color:a})}),this._createManipulator(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._themeHandle=o(this._themeHandle),this._manipulator.applyObjectTransform=R,this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){t(this._manipulator,0)}createManipulatedObjectDragPipeline(t,e,i){if(!e.operations)return r();const a=e.operations.data.spatialReference;return P(e,i,e=>this.createDragPipeline((i,r,a,o,s)=>(({steps:r,cancel:a}=t(i,r,a,o,s)),e(i,r,a)),a))}createDragPipeline(t,e){const i=this._view;return x(this._manipulator,(r,a,o,s,n)=>{const l=a.next(t=>({...t,manipulatorType:0})).next(M(i,r.renderLocation,e)).next(E());t(r,l,o,s,n)})}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}_updateManipulator(){const t=this._settings,e=this._radius/U,i=t.zManipulator.height*e,r=t.zManipulator.coneHeight*e,a=t.zManipulator.coneWidth*e,o=t.zManipulator.width*e,s=[_(0,0,0),_(0,0,i)],m=[_(0,0,0),_(0,0,i+r)],d=(()=>{const t=c();return n(t,t,[0,0,i]),l(t,t,Math.PI/2),t})(),{materialUnfocused:u,materialFocused:p,materialOccludedUnfocused:h,materialOccludedFocused:f}=this._materials,j=y(u,s,o/2,16,!1),v=z(u,r,a/2,16,!1);v.transformation=d,this._manipulator.renderObjects=[new g(v,1),new g(j,1),new g(v.instantiate({material:p}),2),new g(j.instantiate({material:p}),2),new g(v.instantiate({material:h}),1),new g(j.instantiate({material:h}),1),new g(v.instantiate({material:f}),2),new g(j.instantiate({material:f}),2)],this._manipulator.radius=o/2+2,this._manipulator.collisionType={type:"line",paths:[m]}}_createManipulator(){const t=this._view,e=new v({view:t,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});e.applyObjectTransform=e=>{const i=t.state.camera,r=C;t.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,r);const o=m(i.eye,r),s=i.computeRenderPixelSizeAtDist(o),n=d(D,r,i.eye);u(n,n);const l=H;t.renderCoordsHelper.worldUpAtPosition(C,l);const c=Math.abs(p(n,l)),_=h(D,n,l),j=h(D,_,l),v=a(c,.01,1),w=1-Math.sqrt(1-v*v)/v/i.fullWidth,g=this._settings,M=this._radius/U,O=g.zManipulator.width*M;f(j,u(j,j),(1/w-1)*o+s*O),e[12]-=D[0],e[13]-=D[1],e[14]-=D[2]},this._manipulator=e,this._updateManipulator()}get test(){}}function F(i,r,a){const o=e(i,a);return o.a*=r,t.toUnitRGBA(o)}const C=j(),D=j(),H=j(),R=()=>{};export{T as MoveZManipulation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import d from"../../../../../geometry/Point.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as v}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as M}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as b}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as y}from"../tooltipUtils3D.js";import{createVisualElements as T}from"../visualElementUtils.js";import{discRadius as w}from"../manipulations/config.js";import{MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as P,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import D from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as R}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as z}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as X}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as Y}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";class B{constructor(t){this.objects=t,this.type="move-start"}}class G{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 N=Symbol("manipulators"),q=Symbol("tooltips");let J=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new D,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=A(()=>({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()}onInputEvent(t){if(!this.destroyed&&!X(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=M(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!==x(e))continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(b(t.object),o)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({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()})],N)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):w});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()}),N)});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=a)})],N)};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 a of t)this.addHandles([a.object.on("committed",i),r(()=>a.object.visible,i)],N);const n=t[t.length-1];this.addHandles(n.object.on("committed",()=>this._updateMoveManipulationAngle(n)),N);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),s.elevationInfo,l.data.spatialReference,e),N)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=T({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 E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),r(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],N),this.addHandles(i,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=_(M(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&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!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 c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};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 L(l)),this.destroyed||c(),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=P(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new B(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 G(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new L(l)),this.destroyed)return null;c()}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 Y({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new B([o]))},onMove:()=>e.emit("move",new G(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new L([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=y(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=r(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},p);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,autoLengthMeasurementUtils:i}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,(t,o)=>i.autoDistanceBetweenPoints2D(K(t),K(o)));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,(t,e)=>l(i.autoDistanceBetweenPoints2D(K(t),K(e)),S(o)));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,V)}this._latestTooltipInfo.sketchOptions=e}_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=M(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 R({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new g,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=z({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next(o=>{a.z=v(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([c({constructOnly:!0})],J.prototype,"autoLengthMeasurementUtils",void 0),t([c()],J.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:D})],J.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([c()],J.prototype,"type",void 0),t([c()],J.prototype,"updating",null),t([c()],J.prototype,"_latestTooltipInfo",void 0),t([c()],J.prototype,"_shouldShowMovePointTooltip",null),t([c()],J.prototype,"activeTooltipInfo",null),J=t([u("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);const K=h(d);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{G as MoveEvent,B as MoveStartEvent,L as MoveStopEvent,J as MoveTool3D};
5
+ import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import d from"../../../../../geometry/Point.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as v}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as M}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as b}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as y}from"../tooltipUtils3D.js";import{createVisualElements as T}from"../visualElementUtils.js";import{discRadius as w}from"../manipulations/config.js";import{MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as P,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import D from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as R}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as z}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as X}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as Y}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";class B{constructor(t){this.objects=t,this.type="move-start"}}class G{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 N=Symbol("manipulators"),q=Symbol("tooltips");let J=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i.EventEmitter,this.objects=new e,this.enableZ=!0,this.sketchOptions=new D,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=A(()=>({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()}onInputEvent(t){if(!this.destroyed&&!X(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=M(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!==x(e))continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(b(t.object),o)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({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()})],N)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):w});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()}),N)});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=a)})],N)};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 a of t)this.addHandles([a.object.on("committed",i),r(()=>a.object.visible,i)],N);const n=t[t.length-1];this.addHandles(n.object.on("committed",()=>this._updateMoveManipulationAngle(n)),N);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),s.elevationInfo,l.data.spatialReference,e),N)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=T({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 E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),r(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],N),this.addHandles(i,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=_(M(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&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!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 c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};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 L(l)),this.destroyed||c(),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=P(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new B(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 G(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new L(l)),this.destroyed)return null;c()}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 Y({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new B([o]))},onMove:()=>e.emit("move",new G(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new L([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=y(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=r(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},p);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,autoLengthMeasurementUtils:i}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,(t,o)=>i.autoDistanceBetweenPoints2D(K(t),K(o)));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,(t,e)=>l(i.autoDistanceBetweenPoints2D(K(t),K(e)),S(o)));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,V)}this._latestTooltipInfo.sketchOptions=e}_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=M(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 R({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new g,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=z({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next(o=>{a.z=v(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([c({constructOnly:!0})],J.prototype,"autoLengthMeasurementUtils",void 0),t([c()],J.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:D})],J.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([c()],J.prototype,"type",void 0),t([c()],J.prototype,"updating",null),t([c()],J.prototype,"_latestTooltipInfo",void 0),t([c()],J.prototype,"_shouldShowMovePointTooltip",null),t([c()],J.prototype,"activeTooltipInfo",null),J=t([u("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);const K=h(d);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{G as MoveEvent,B as MoveStartEvent,L as MoveStopEvent,J as MoveTool3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as d}from"../../../../../core/maybe.js";import{watch as h,on as u,initial as c,syncAndInitial as m,when as g,sync as f}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as b,d as x,m as y,i as O,f as E,g as j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as C,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as Z}from"../dragEventPipeline3D.js";import{orientation as N}from"../geometryUtils.js";import{canMoveZOperations as q}from"../manipulatorUtils.js";import{Settings as X}from"../settings.js";import{createVisualElements as Y}from"../visualElementUtils.js";import{discRadiusSmall as B}from"../manipulations/config.js";import{MoveManipulation as W}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{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{sceneSnappingAtLocation as de,addMapDelta as he,createManipulatorDragEventPipeline as ue,dragAtLocation as ce,addScreenDelta as me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as fe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as _e}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ve,enterInputModeIfAvailable as Me}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const be=Symbol();let xe=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new w,this._recreatingManipulators=!1,this._settings=new X({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,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=P(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=C(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=C(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=P(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=C(a(n.outlineColor),n.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=P(a(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(a(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=P(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=C(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=C(a(s.hoverOutlineColor),s.renderOccluded),this.tooltip=ve(()=>({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:a})=>{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),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ie(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")},c),ne(this.tooltip,this.object,()=>this._tooltipsContext),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=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}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===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!Me(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")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(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 i of this._operations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}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=p(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,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(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._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(be):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,be)}))}_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=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);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.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.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._resetTooltip(),e=d(e))}),n.next(()=>this._onDragCancel(!0,()=>e=d(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 W({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t.operations,t.elevationInfo),snapToScene:!1,radius:W.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}=_e({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),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(de(this.view,e,t.graphic??void 0)).next(...p).next(he()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),c),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},c)])}_createVisualElements(){const{object:e,view:t}=this,i=Y({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(u(()=>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.component.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,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new L(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:je(n)}),_=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:je(n)}),v={manipulator:f,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(f,!0),this._watchAndUpdateGrabState(_,!0),ue(f,this._createEdgeOffsetPipeline(v,t,a)),ue(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?J(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=d(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&te(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r(()=>{d(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):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(we,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(ce(this.view,r)).next(R(this.view,r,t,s,e)).next(me()).next(he()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&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(ce(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(Z(this.view,i.data.spatialReference)).next(he()).next(ye()).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(),p=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=d(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==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),r=new re({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{r.color=a(e),r.isDraped=t},m),t.on("committed",()=>{r.geometry=o()}),l(r)]);return r.attached=!0,p}_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.leftEdge?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightEdge?.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)<He){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)<He){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!Me(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(Ie).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.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerLocation,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([g(()=>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("edge"===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}=Oe(o.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(o.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new L(this._vertexManipulatorGeometry.instantiate(),4|Ve.Vertex),new L(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ve.Vertex),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve.Vertex),new L(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&p.push(new L(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ve.Edge),new L(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve.Edge),new L(this._edgeManipulatorGeometry.instantiate(),5|Ve.Edge),new L(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ve.Edge));const h=new G({view:a,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:je(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=ue(h,(e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:h}=_e({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=d(r)),t)).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(ce(a,c)).next(R(a,c,t,l,m)).next(de(a,t,m)).next(...p).next(he()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=d(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,h.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),h.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),h.events.on("focus-changed",()=>{this._resetTooltip()})],h),this.events.emit("manipulators-changed"),u}_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._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.state=Ve.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"edge":{e.state=Ve.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(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++;else if(this._numGrabbing--,this._updateEventState(0),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,Ie(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){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,Se),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 y(we,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=we}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=d(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)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),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.components.indexOf(a.component);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=O(we,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++,E(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&&q(this._operations,o.elevationInfo),this._moveManipulation.angle=N(s),this._moveManipulation.radius=W.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&&q(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.leftEdge?.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge?.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ee(t,e):o&&(i=Ee(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=B}0!==t&&i?(j(e,e,1/t),Se.spatialReference=this._operations.data.spatialReference,Se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Se),this._moveManipulation.elevationAlignedLocation=Se):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){for(const a of e){const e=a.handle.component;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.edges[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.components.indexOf(e.component);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()}}}_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);for(const t of e)this._updateManipulatorPosition(t)}}_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&&2===e.button&&this._removeVertices([t])),"edge"===t.type&&0===e.button&&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))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext))}_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._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"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 _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function ye(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Oe(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ee(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e){return new H({x:0,y:0,z:0,spatialReference:e})}function Ie(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],xe.prototype,"_numGrabbing",void 0),e([_()],xe.prototype,"_numDragging",void 0),e([_()],xe.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],xe.prototype,"_operations",null),e([_()],xe.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],xe.prototype,"tool",void 0),e([_()],xe.prototype,"tooltip",void 0),e([_()],xe.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],xe.prototype,"updating",null),e([_()],xe.prototype,"manipulators",null),e([_()],xe.prototype,"view",null),e([_()],xe.prototype,"automaticAreaMeasurementUtils",null),e([_()],xe.prototype,"automaticLengthMeasurementUtils",null),e([_()],xe.prototype,"object",null),e([_()],xe.prototype,"enableZShape",null),e([_()],xe.prototype,"enableDeleteVertices",null),e([_()],xe.prototype,"enableZVertex",null),e([_()],xe.prototype,"autoHideManipulators",null),e([_()],xe.prototype,"enableMoveObject",null),e([_()],xe.prototype,"enableMidpoints",null),e([_()],xe.prototype,"enableEdgeOffset",null),e([_()],xe.prototype,"_sketchOptions",null),e([_()],xe.prototype,"_accentColor",null),e([_()],xe.prototype,"_tooltipsContext",null),xe=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],xe);const Se=T(0,0,void 0,D.WGS84),we=S(),He=1e-6;var Ve;!function(e){e.Vertex=16,e.Edge=32}(Ve||(Ve={}));export{xe as ReshapeOperation};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as d}from"../../../../../core/maybe.js";import{watch as h,on as u,initial as c,syncAndInitial as m,when as g,sync as f}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as b,d as x,m as y,i as O,f as E,g as j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as C,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as Z}from"../dragEventPipeline3D.js";import{orientation as N}from"../geometryUtils.js";import{canMoveZOperations as q}from"../manipulatorUtils.js";import{Settings as X}from"../settings.js";import{createVisualElements as Y}from"../visualElementUtils.js";import{discRadiusSmall as B}from"../manipulations/config.js";import{MoveManipulation as W}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{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{sceneSnappingAtLocation as de,addMapDelta as he,createManipulatorDragEventPipeline as ue,dragAtLocation as ce,addScreenDelta as me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as fe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as _e}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ve,enterInputModeIfAvailable as Me}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const be=Symbol();let xe=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new w,this._recreatingManipulators=!1,this._settings=new X({getTheme:()=>this.view.effectiveTheme}),this.events=new n.EventEmitter,this.activeTooltipInfo=null,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=P(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=C(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=C(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=P(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=C(a(n.outlineColor),n.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=P(a(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(a(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=P(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=C(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=C(a(s.hoverOutlineColor),s.renderOccluded),this.tooltip=ve(()=>({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:a})=>{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),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ie(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")},c),ne(this.tooltip,this.object,()=>this._tooltipsContext),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=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}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===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!Me(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")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(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 i of this._operations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}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=p(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,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(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._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(be):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,be)}))}_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=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);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.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.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._resetTooltip(),e=d(e))}),n.next(()=>this._onDragCancel(!0,()=>e=d(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 W({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t.operations,t.elevationInfo),snapToScene:!1,radius:W.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}=_e({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),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(de(this.view,e,t.graphic??void 0)).next(...p).next(he()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),c),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},c)])}_createVisualElements(){const{object:e,view:t}=this,i=Y({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(u(()=>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.component.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,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new L(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:je(n)}),_=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:je(n)}),v={manipulator:f,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(f,!0),this._watchAndUpdateGrabState(_,!0),ue(f,this._createEdgeOffsetPipeline(v,t,a)),ue(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?J(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=d(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&te(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r(()=>{d(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):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(we,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(ce(this.view,r)).next(R(this.view,r,t,s,e)).next(me()).next(he()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&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(ce(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(Z(this.view,i.data.spatialReference)).next(he()).next(ye()).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(),p=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=d(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==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),r=new re({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{r.color=a(e),r.isDraped=t},m),t.on("committed",()=>{r.geometry=o()}),l(r)]);return r.attached=!0,p}_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.leftEdge?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightEdge?.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)<He){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)<He){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!Me(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(Ie).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.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerLocation,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([g(()=>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("edge"===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}=Oe(o.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(o.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new L(this._vertexManipulatorGeometry.instantiate(),4|Ve.Vertex),new L(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ve.Vertex),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve.Vertex),new L(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&p.push(new L(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ve.Edge),new L(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve.Edge),new L(this._edgeManipulatorGeometry.instantiate(),5|Ve.Edge),new L(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ve.Edge));const h=new G({view:a,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:je(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=ue(h,(e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:h}=_e({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=d(r)),t)).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(ce(a,c)).next(R(a,c,t,l,m)).next(de(a,t,m)).next(...p).next(he()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=d(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,h.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),h.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),h.events.on("focus-changed",()=>{this._resetTooltip()})],h),this.events.emit("manipulators-changed"),u}_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._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.state=Ve.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"edge":{e.state=Ve.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(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++;else if(this._numGrabbing--,this._updateEventState(0),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,Ie(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){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,Se),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 y(we,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=we}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=d(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)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),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.components.indexOf(a.component);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=O(we,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++,E(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&&q(this._operations,o.elevationInfo),this._moveManipulation.angle=N(s),this._moveManipulation.radius=W.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&&q(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.leftEdge?.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge?.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ee(t,e):o&&(i=Ee(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=B}0!==t&&i?(j(e,e,1/t),Se.spatialReference=this._operations.data.spatialReference,Se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Se),this._moveManipulation.elevationAlignedLocation=Se):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){for(const a of e){const e=a.handle.component;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.edges[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.components.indexOf(e.component);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()}}}_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);for(const t of e)this._updateManipulatorPosition(t)}}_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&&2===e.button&&this._removeVertices([t])),"edge"===t.type&&0===e.button&&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))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext))}_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._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"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 _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function ye(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Oe(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ee(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e){return new H({x:0,y:0,z:0,spatialReference:e})}function Ie(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],xe.prototype,"_numGrabbing",void 0),e([_()],xe.prototype,"_numDragging",void 0),e([_()],xe.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],xe.prototype,"_operations",null),e([_()],xe.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],xe.prototype,"tool",void 0),e([_()],xe.prototype,"tooltip",void 0),e([_()],xe.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],xe.prototype,"updating",null),e([_()],xe.prototype,"manipulators",null),e([_()],xe.prototype,"view",null),e([_()],xe.prototype,"automaticAreaMeasurementUtils",null),e([_()],xe.prototype,"automaticLengthMeasurementUtils",null),e([_()],xe.prototype,"object",null),e([_()],xe.prototype,"enableZShape",null),e([_()],xe.prototype,"enableDeleteVertices",null),e([_()],xe.prototype,"enableZVertex",null),e([_()],xe.prototype,"autoHideManipulators",null),e([_()],xe.prototype,"enableMoveObject",null),e([_()],xe.prototype,"enableMidpoints",null),e([_()],xe.prototype,"enableEdgeOffset",null),e([_()],xe.prototype,"_sketchOptions",null),e([_()],xe.prototype,"_accentColor",null),e([_()],xe.prototype,"_tooltipsContext",null),xe=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],xe);const Se=T(0,0,void 0,D.WGS84),we=S(),He=1e-6;var Ve;!function(e){e.Vertex=16,e.Edge=32}(Ve||(Ve={}));export{xe as ReshapeOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Evented.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as s}from"../../../../interactive/keybindings.js";import a from"../../../../interactive/sketch/SketchOptions.js";let h=class extends p{constructor(e){super(e),this._reshapeOperation=null,this.events=new t,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveObject=!0,this.enableDeleteVertices=!0,this.autoHideManipulators=!1,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.sketchOptions=new a,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const e=this._reshapeOperation=new r({tool:this});this.addHandles([e.events.on("reshape",e=>this.events.emit("reshape",e)),e.events.on("move",e=>this.events.emit("move",e)),e.events.on("vertex-add",e=>this.events.emit("vertex-add",e)),e.events.on("vertex-remove",e=>this.events.emit("vertex-remove",e)),e.events.on("immediate-click",e=>this.events.emit("immediate-click",{...e,object:this.object})),this.view.on("pointer-down",["Shift"],e=>e.stopPropagation())]),this.finishToolCreation()}destroy(){this._reshapeOperation=o(this._reshapeOperation)}get updating(){return((this.object.updating??!1)||this._reshapeOperation?.updating||this.snappingManager?.updating)??!1}get activeTooltipInfo(){return this._reshapeOperation?.activeTooltipInfo??null}get tooltip(){return this._reshapeOperation?.tooltip??null}onManipulatorSelectionChanged(){this._reshapeOperation?.onManipulatorSelectionChanged()}get canUndo(){return this._reshapeOperation?.canUndo??!1}undo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.undo()}get canRedo(){return this._reshapeOperation?.canRedo??!1}redo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.redo()}onInputEvent(e){const t=this._reshapeOperation;if(t&&!t.enterInputModeIfAvailable(e)&&this.enableDeleteVertices&&"key-down"===e.type&&s.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",void 0),e([i({constructOnly:!0})],h.prototype,"automaticAreaMeasurementUtils",void 0),e([i({constructOnly:!0})],h.prototype,"automaticLengthMeasurementUtils",void 0),e([i({constructOnly:!0})],h.prototype,"object",void 0),e([i()],h.prototype,"enableZShape",void 0),e([i()],h.prototype,"enableZVertex",void 0),e([i()],h.prototype,"enableMoveObject",void 0),e([i()],h.prototype,"enableDeleteVertices",void 0),e([i()],h.prototype,"autoHideManipulators",void 0),e([i()],h.prototype,"enableMidpoints",void 0),e([i()],h.prototype,"enableEdgeOffset",void 0),e([i()],h.prototype,"type",void 0),e([i({type:a})],h.prototype,"sketchOptions",void 0),e([i()],h.prototype,"snappingManager",void 0),e([i()],h.prototype,"updating",null),e([i()],h.prototype,"activeTooltipInfo",null),e([i()],h.prototype,"tooltip",null),e([i()],h.prototype,"automaticManipulatorSelection",void 0),h=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],h);export{h as ReshapeTool3D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Evented.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as s}from"../../../../interactive/keybindings.js";import a from"../../../../interactive/sketch/SketchOptions.js";let h=class extends p{constructor(e){super(e),this._reshapeOperation=null,this.events=new t.EventEmitter,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveObject=!0,this.enableDeleteVertices=!0,this.autoHideManipulators=!1,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.sketchOptions=new a,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const e=this._reshapeOperation=new r({tool:this});this.addHandles([e.events.on("reshape",e=>this.events.emit("reshape",e)),e.events.on("move",e=>this.events.emit("move",e)),e.events.on("vertex-add",e=>this.events.emit("vertex-add",e)),e.events.on("vertex-remove",e=>this.events.emit("vertex-remove",e)),e.events.on("immediate-click",e=>this.events.emit("immediate-click",{...e,object:this.object})),this.view.on("pointer-down",["Shift"],e=>e.stopPropagation())]),this.finishToolCreation()}destroy(){this._reshapeOperation=o(this._reshapeOperation)}get updating(){return((this.object.updating??!1)||this._reshapeOperation?.updating||this.snappingManager?.updating)??!1}get activeTooltipInfo(){return this._reshapeOperation?.activeTooltipInfo??null}get tooltip(){return this._reshapeOperation?.tooltip??null}onManipulatorSelectionChanged(){this._reshapeOperation?.onManipulatorSelectionChanged()}get canUndo(){return this._reshapeOperation?.canUndo??!1}undo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.undo()}get canRedo(){return this._reshapeOperation?.canRedo??!1}redo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.redo()}onInputEvent(e){const t=this._reshapeOperation;if(t&&!t.enterInputModeIfAvailable(e)&&this.enableDeleteVertices&&"key-down"===e.type&&s.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",void 0),e([i({constructOnly:!0})],h.prototype,"automaticAreaMeasurementUtils",void 0),e([i({constructOnly:!0})],h.prototype,"automaticLengthMeasurementUtils",void 0),e([i({constructOnly:!0})],h.prototype,"object",void 0),e([i()],h.prototype,"enableZShape",void 0),e([i()],h.prototype,"enableZVertex",void 0),e([i()],h.prototype,"enableMoveObject",void 0),e([i()],h.prototype,"enableDeleteVertices",void 0),e([i()],h.prototype,"autoHideManipulators",void 0),e([i()],h.prototype,"enableMidpoints",void 0),e([i()],h.prototype,"enableEdgeOffset",void 0),e([i()],h.prototype,"type",void 0),e([i({type:a})],h.prototype,"sketchOptions",void 0),e([i()],h.prototype,"snappingManager",void 0),e([i()],h.prototype,"updating",null),e([i()],h.prototype,"activeTooltipInfo",null),e([i()],h.prototype,"tooltip",null),e([i()],h.prototype,"automaticManipulatorSelection",void 0),h=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],h);export{h as ReshapeTool3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{containsXY as r}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as l}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as p,resizeNormal as h,resizeOutlineOnly as c}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as m}from"../manipulatorUtils.js";import{createVisualElements as b}from"../visualElementUtils.js";import{ExtentMove as v}from"./extentTransform/ExtentMove.js";import{ExtentRotate as _}from"./extentTransform/ExtentRotate.js";import{ExtentScale as g}from"./extentTransform/ExtentScale.js";import{TransformBounds as f}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as y}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as j}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as M}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as R}from"../../../../interactive/InteractiveToolBase.js";import x from"../../../../interactive/sketch/SketchOptions.js";import{makeTooltip as E}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let O=class extends R{get updating(){return!!this.object.updating}constructor(t){super(t),this.events=new e,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.sketchOptions=new x,this._preserveAspectRatio=new y,this._snapRotation=new j,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:t,object:e}=this,n=this._bounds=new f(this,()=>this._updateManipulators());this._extentMove=new v(this,n,this.automaticLengthMeasurementUtils),this._extentScale=new g(this,n,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new _(this,n,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([o(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),o(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(t=>this._updateManipulatorAvailability(t,2))),o(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const s=b({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()});if(null!=s){const{visualElement:t}=s;t instanceof M&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(s)}this.addHandles([e.on("committed",()=>this._onGeometryChanged()),o(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),o(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),a),o(()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>n.updateDisplayBounds())]);const r=t=>{this.addHandles(t.events.on("grab-changed",()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()}))};this._forEachManipulator(r);const l=(t,i)=>{this.addHandles(t.events.on("immediate-click",t=>{1===i&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=E(()=>({view:t,options:this.sketchOptions.tooltips}));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([o(()=>this.sketchOptions.tooltips.effectiveEnabled,e),o(()=>this.preserveAspectRatio,e)]),this._forEachManipulator(t=>{this.addHandles([t.events.on(["focus-changed","grab-changed"],e),t.events.on("drag",t=>{"cancel"===t.action?this.tooltip.clear():e()})])})}_getUpdatedTooltipInfo(){return this.sketchOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(S),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",t=>{null!=this._attachmentOrigin&&r(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),S)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=p(t,l.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this._forEachManipulator((t,e)=>this._updateManipulatorAvailability(t,e))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof d){const o=this.object.visible,a=this.enableZ&&m(this.object.operations,this.object.elevationInfo);switch(e){case 3:t.available=o&&this.enableRotation;break;case 2:t.available=o&&(this.enableScaling||this.enableRotation||a),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?h:c;break;case 0:t.available=o&&a;break;default:t.available=o}}}_forEachManipulator(t){this._extentMove.forEachManipulator(t),this._extentScale.forEachManipulator(t),this._extentRotate.forEachManipulator(t)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(t){this._snapRotation.enabled=t,this._set("snapRotation",t)}get attachmentOrigin(){const t=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=t??this.object.origin??u(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancelDrag(){if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(null!=this.inputState)this.view.activeTool=null;else if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){const t=this.object.operations?.redo();t&&this._bounds.updateMapBoundsFromOperation(t)}}get test(){}};t([n()],O.prototype,"updating",null),t([n({constructOnly:!0,nonNullable:!0})],O.prototype,"view",void 0),t([n({constructOnly:!0})],O.prototype,"automaticLengthMeasurementUtils",void 0),t([n({constructOnly:!0,nonNullable:!0})],O.prototype,"object",void 0),t([n()],O.prototype,"enableZ",void 0),t([n()],O.prototype,"enableScaling",void 0),t([n()],O.prototype,"enableRotation",void 0),t([n({constructOnly:!0,type:x})],O.prototype,"sketchOptions",void 0),t([n()],O.prototype,"preserveAspectRatio",null),t([n()],O.prototype,"snapRotation",null),t([n()],O.prototype,"grabbing",void 0),t([n()],O.prototype,"inputState",void 0),t([n({readOnly:!0})],O.prototype,"type",void 0),t([n()],O.prototype,"tooltip",void 0),O=t([s("esri.views.3d.interactive.editingTools.transform.ExtentTransformTool")],O);const S="draped-elevation-changes";export{O as ExtentTransformTool};
5
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{containsXY as r}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as l}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as p,resizeNormal as h,resizeOutlineOnly as c}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as m}from"../manipulatorUtils.js";import{createVisualElements as b}from"../visualElementUtils.js";import{ExtentMove as v}from"./extentTransform/ExtentMove.js";import{ExtentRotate as _}from"./extentTransform/ExtentRotate.js";import{ExtentScale as g}from"./extentTransform/ExtentScale.js";import{TransformBounds as f}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as y}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as j}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as M}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as R}from"../../../../interactive/InteractiveToolBase.js";import x from"../../../../interactive/sketch/SketchOptions.js";import{makeTooltip as E}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let O=class extends R{get updating(){return!!this.object.updating}constructor(t){super(t),this.events=new e.EventEmitter,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.sketchOptions=new x,this._preserveAspectRatio=new y,this._snapRotation=new j,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:t,object:e}=this,n=this._bounds=new f(this,()=>this._updateManipulators());this._extentMove=new v(this,n,this.automaticLengthMeasurementUtils),this._extentScale=new g(this,n,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new _(this,n,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([o(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),o(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(t=>this._updateManipulatorAvailability(t,2))),o(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const s=b({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()});if(null!=s){const{visualElement:t}=s;t instanceof M&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(s)}this.addHandles([e.on("committed",()=>this._onGeometryChanged()),o(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),o(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),a),o(()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>n.updateDisplayBounds())]);const r=t=>{this.addHandles(t.events.on("grab-changed",()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()}))};this._forEachManipulator(r);const l=(t,i)=>{this.addHandles(t.events.on("immediate-click",t=>{1===i&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=E(()=>({view:t,options:this.sketchOptions.tooltips}));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([o(()=>this.sketchOptions.tooltips.effectiveEnabled,e),o(()=>this.preserveAspectRatio,e)]),this._forEachManipulator(t=>{this.addHandles([t.events.on(["focus-changed","grab-changed"],e),t.events.on("drag",t=>{"cancel"===t.action?this.tooltip.clear():e()})])})}_getUpdatedTooltipInfo(){return this.sketchOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(S),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",t=>{null!=this._attachmentOrigin&&r(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),S)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=p(t,l.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this._forEachManipulator((t,e)=>this._updateManipulatorAvailability(t,e))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof d){const o=this.object.visible,a=this.enableZ&&m(this.object.operations,this.object.elevationInfo);switch(e){case 3:t.available=o&&this.enableRotation;break;case 2:t.available=o&&(this.enableScaling||this.enableRotation||a),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?h:c;break;case 0:t.available=o&&a;break;default:t.available=o}}}_forEachManipulator(t){this._extentMove.forEachManipulator(t),this._extentScale.forEachManipulator(t),this._extentRotate.forEachManipulator(t)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(t){this._snapRotation.enabled=t,this._set("snapRotation",t)}get attachmentOrigin(){const t=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=t??this.object.origin??u(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancelDrag(){if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(null!=this.inputState)this.view.activeTool=null;else if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){const t=this.object.operations?.redo();t&&this._bounds.updateMapBoundsFromOperation(t)}}get test(){}};t([n()],O.prototype,"updating",null),t([n({constructOnly:!0,nonNullable:!0})],O.prototype,"view",void 0),t([n({constructOnly:!0})],O.prototype,"automaticLengthMeasurementUtils",void 0),t([n({constructOnly:!0,nonNullable:!0})],O.prototype,"object",void 0),t([n()],O.prototype,"enableZ",void 0),t([n()],O.prototype,"enableScaling",void 0),t([n()],O.prototype,"enableRotation",void 0),t([n({constructOnly:!0,type:x})],O.prototype,"sketchOptions",void 0),t([n()],O.prototype,"preserveAspectRatio",null),t([n()],O.prototype,"snapRotation",null),t([n()],O.prototype,"grabbing",void 0),t([n()],O.prototype,"inputState",void 0),t([n({readOnly:!0})],O.prototype,"type",void 0),t([n()],O.prototype,"tooltip",void 0),O=t([s("esri.views.3d.interactive.editingTools.transform.ExtentTransformTool")],O);const S="draped-elevation-changes";export{O as ExtentTransformTool};