@arcgis/core 5.2.0-next.73 → 5.2.0-next.74

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 (183) hide show
  1. package/analysis/ViewshedAnalysis.js +1 -1
  2. package/arcgisGlobal.d.ts +1 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{d3be4d914fc99a1d686c.js → 075e65cc4275ac886f08.js} +1 -1
  5. package/assets/esri/core/workers/chunks/087bd698b80ca0cea71e.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b6c7b7b7f87dce5de811.js → 0bf644f93c180a2bc2f8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0e81c6d4f1c81f9b0a1b.js +1 -0
  8. package/assets/esri/core/workers/chunks/193aed69de2dec4f36b6.js +1 -0
  9. package/assets/esri/core/workers/chunks/1a3afee3ecd806b4aa81.js +1 -0
  10. package/assets/esri/core/workers/chunks/{014f9fd2818e2c9d9a3b.js → 264fd750691d517ab1f3.js} +1 -1
  11. package/assets/esri/core/workers/chunks/28f87daaba1ae3441364.js +1 -0
  12. package/assets/esri/core/workers/chunks/2baa16ec8559e77c226f.js +1 -0
  13. package/assets/esri/core/workers/chunks/2c31648a4b95275516ee.js +1 -0
  14. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +1 -0
  15. package/assets/esri/core/workers/chunks/305eea9c1fc4aee3309e.js +1 -0
  16. package/assets/esri/core/workers/chunks/31d19bb72a9e79b30070.js +1 -0
  17. package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +1 -0
  18. package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +1 -0
  19. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +1 -0
  20. package/assets/esri/core/workers/chunks/509aecafbc629bee1c15.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d901f8503a73277cfa58.js → 553be2bd69bd311477ea.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{31669511cfddf116d991.js → 66e60351aacbd162775f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/762be5d3e6aeaea33f74.js +29 -0
  24. package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +1 -0
  25. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +1 -0
  26. package/assets/esri/core/workers/chunks/{44b50d4716a2567ab6f1.js → 7b5b66ae79e0287e3ade.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81130dbcb738d40f723b.js +1 -0
  28. package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +1 -0
  29. package/assets/esri/core/workers/chunks/859dd86c921053bf03a1.js +1 -0
  30. package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{96d861265566854760cd.js → 88fd698b940dadcc6dc5.js} +1 -1
  32. package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +1 -0
  33. package/assets/esri/core/workers/chunks/{7f208ef75ef2ce0d7cf9.js → 910c93bbbf8113a4a51f.js} +1 -1
  34. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +1 -0
  35. package/assets/esri/core/workers/chunks/{509cfac9e5d86a8ee449.js → 936d44c7bc3a181e64a3.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{b9953277d0cd4a01bdc6.js → 94368a097e6190ce3c7a.js} +1 -1
  37. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +1 -0
  38. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +1 -0
  39. package/assets/esri/core/workers/chunks/{c203df41f9d2e4b80889.js → 9ca59077712e45ef4d56.js} +1 -1
  40. package/assets/esri/core/workers/chunks/9e25f715cda59c686a4c.js +1 -0
  41. package/assets/esri/core/workers/chunks/{36171c72a3c04b0d13ef.js → a0a1f0bd3648738354a6.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +1 -0
  43. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +1 -0
  44. package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +1 -0
  45. package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +1 -0
  46. package/assets/esri/core/workers/chunks/aca5c524bd3c955e9243.js +1 -0
  47. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +1 -0
  48. package/assets/esri/core/workers/chunks/b3b53cf0a3a30164d337.js +1 -0
  49. package/assets/esri/core/workers/chunks/b6d26d9738c0787acc38.js +1 -0
  50. package/assets/esri/core/workers/chunks/b9c61b20bbc91cb63036.js +1 -0
  51. package/assets/esri/core/workers/chunks/bf3dc3ad8df8488da3f0.js +1 -0
  52. package/assets/esri/core/workers/chunks/bff75cc7413bf0d319db.js +1 -0
  53. package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +1 -0
  54. package/assets/esri/core/workers/chunks/c1a4d499a30f3d80567b.js +1 -0
  55. package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +1 -0
  56. package/assets/esri/core/workers/chunks/{8c76f31a363dd0c3354d.js → c46f79d5b7712adbbd1c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/c67e4a848d41038367b8.js +1 -0
  58. package/assets/esri/core/workers/chunks/de5013f89f0eae93978f.js +1 -0
  59. package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +1 -0
  60. package/assets/esri/core/workers/chunks/{bee5e738ecf8680909c4.js → eaf26c1cc938789d5336.js} +1 -1
  61. package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +1 -0
  62. package/assets/esri/core/workers/chunks/f1727b4a32cb6f36a5e6.js +1 -0
  63. package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +1 -0
  64. package/assets/esri/core/workers/chunks/fb0b89bbb4f8607d5f20.js +1 -0
  65. package/assets/esri/core/workers/chunks/fdca9873914b9dbd9244.js +1 -0
  66. package/assets/esri/core/workers/chunks/ff890167ff2baabfc4ce.js +1 -0
  67. package/config.js +1 -1
  68. package/kernel.js +1 -1
  69. package/layers/DimensionFeatureLayer.d.ts +22 -0
  70. package/layers/DimensionFeatureLayer.js +1 -1
  71. package/layers/save/featureLayerUtils.js +1 -1
  72. package/layers/support/layerUtils.js +1 -1
  73. package/layers/support/layersMapping.js +1 -1
  74. package/package.json +1 -1
  75. package/support/revision.js +1 -1
  76. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  77. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  78. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  79. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  80. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  81. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  82. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  83. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  84. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  85. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  86. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  87. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  88. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  89. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  90. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  91. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  92. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  93. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  94. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  95. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  96. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  97. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  98. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  99. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  100. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  101. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  102. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  103. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  104. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  105. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  106. package/views/draw/DrawGraphicTool.js +1 -1
  107. package/views/draw/DrawTool.js +1 -1
  108. package/views/draw/plugins/PolylinePlugin.js +1 -1
  109. package/views/draw/support/Box.js +1 -1
  110. package/views/draw/support/InteractiveHandle.js +1 -1
  111. package/views/draw/support/Reshape.js +1 -1
  112. package/views/draw/support/drawToolUtils.js +1 -1
  113. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  114. package/views/draw/support/managers/TooltipManager.js +1 -1
  115. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  116. package/views/draw/support/tooltipUtils.js +1 -1
  117. package/views/interactive/options/InteractiveToolOptions.d.ts +36 -0
  118. package/views/interactive/options/InteractiveToolOptions.js +2 -0
  119. package/views/interactive/sketch/SketchOptions.d.ts +4 -3
  120. package/views/interactive/sketch/SketchOptions.js +1 -1
  121. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  122. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  123. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  124. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  125. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  126. package/views/interactive/tooltip/fields/fields.js +1 -1
  127. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  128. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  129. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  130. package/widgets/Sketch/SketchViewModel.js +1 -1
  131. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  132. package/assets/esri/core/workers/chunks/00cbff0b785e24e87d97.js +0 -1
  133. package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +0 -29
  134. package/assets/esri/core/workers/chunks/06c9aac75a01d3af6d54.js +0 -1
  135. package/assets/esri/core/workers/chunks/089f8c60e96d920a2cb2.js +0 -1
  136. package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +0 -1
  137. package/assets/esri/core/workers/chunks/158d2ac0333d53556e33.js +0 -1
  138. package/assets/esri/core/workers/chunks/16cade1c2ddf44e336ee.js +0 -1
  139. package/assets/esri/core/workers/chunks/1b130af7d14eaae69d96.js +0 -1
  140. package/assets/esri/core/workers/chunks/1e0140556c2e3fa72545.js +0 -1
  141. package/assets/esri/core/workers/chunks/1e5cb72830c7f32f2961.js +0 -1
  142. package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +0 -1
  143. package/assets/esri/core/workers/chunks/2f58e1f64df2da8259a2.js +0 -1
  144. package/assets/esri/core/workers/chunks/383304d33b496c5d8baa.js +0 -1
  145. package/assets/esri/core/workers/chunks/3aacb935d632834d4154.js +0 -1
  146. package/assets/esri/core/workers/chunks/3c8e98cf23ad8ef12fcb.js +0 -1
  147. package/assets/esri/core/workers/chunks/3dc71e03a630dd50b28e.js +0 -1
  148. package/assets/esri/core/workers/chunks/3fd022df127af32782ce.js +0 -1
  149. package/assets/esri/core/workers/chunks/4344ab1250a1c550bf8b.js +0 -1
  150. package/assets/esri/core/workers/chunks/43de723f765ec8f268ac.js +0 -1
  151. package/assets/esri/core/workers/chunks/4695cd6120f60b234d5c.js +0 -1
  152. package/assets/esri/core/workers/chunks/582a1d468089b9986416.js +0 -1
  153. package/assets/esri/core/workers/chunks/5f201c77a09ae0df29d6.js +0 -1
  154. package/assets/esri/core/workers/chunks/6080e46fc79127500283.js +0 -1
  155. package/assets/esri/core/workers/chunks/67d3ff7fcefaa7d5d27f.js +0 -1
  156. package/assets/esri/core/workers/chunks/6a9002fcba11e2cf3f2e.js +0 -1
  157. package/assets/esri/core/workers/chunks/72dcd4bd1a28bf8605c5.js +0 -1
  158. package/assets/esri/core/workers/chunks/73f228d966b89c73c9e9.js +0 -1
  159. package/assets/esri/core/workers/chunks/77df0bb35d2688729479.js +0 -1
  160. package/assets/esri/core/workers/chunks/7a143ca61c0a70306185.js +0 -1
  161. package/assets/esri/core/workers/chunks/869d292a60747c93dc84.js +0 -1
  162. package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +0 -1
  163. package/assets/esri/core/workers/chunks/a7f42ada0aa69873a938.js +0 -1
  164. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +0 -1
  165. package/assets/esri/core/workers/chunks/aff0e7761276036e029d.js +0 -1
  166. package/assets/esri/core/workers/chunks/b7d8817018b3d277c454.js +0 -1
  167. package/assets/esri/core/workers/chunks/ba4f419f46be09a9a55c.js +0 -1
  168. package/assets/esri/core/workers/chunks/bfb6566c27c09deb0929.js +0 -1
  169. package/assets/esri/core/workers/chunks/c715c585c42d8c2b86f5.js +0 -1
  170. package/assets/esri/core/workers/chunks/c7e9513f75b8ec205562.js +0 -1
  171. package/assets/esri/core/workers/chunks/c838cc1c786368b78598.js +0 -1
  172. package/assets/esri/core/workers/chunks/cd4e5c948d1bfa9b9a2d.js +0 -1
  173. package/assets/esri/core/workers/chunks/cfe31b7d1c6c05fbd268.js +0 -1
  174. package/assets/esri/core/workers/chunks/d0c1bc90e474f706211c.js +0 -1
  175. package/assets/esri/core/workers/chunks/da484787bd9fd3b13d15.js +0 -1
  176. package/assets/esri/core/workers/chunks/e21b3490bfce75405e55.js +0 -1
  177. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +0 -1
  178. package/assets/esri/core/workers/chunks/e702abaeccef20b64a81.js +0 -1
  179. package/assets/esri/core/workers/chunks/ebd619533be077059494.js +0 -1
  180. package/assets/esri/core/workers/chunks/f475672ff4c2ec9367c2.js +0 -1
  181. package/assets/esri/core/workers/chunks/f69329b85b362b349a8c.js +0 -1
  182. package/assets/esri/core/workers/chunks/fba8065a3a6fbd877e23.js +0 -1
  183. package/assets/esri/core/workers/chunks/fec07a16b72cdcafc641.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{initial as d,on as h,watch as u,syncAndInitial as c,when as m,sync as f}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as C}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterials as R,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as z,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as B}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as W}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as le}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as pe,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as he}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as fe,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as _e}from"../../../../interactive/keybindings.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as ye}from"../../../../support/GeometryWorkerHandle.js";const Oe=Symbol(),Ee=Symbol(),je=Symbol(),Ie=Symbol();let Se=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Ie)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._measurementWorker=new ye({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._sketchOptions,e),this._vertexManipulatorMaterials=R({color:i.color.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA(),focusedOutlineColor:i.focusedOutlineColor.toUnitRGBA(),renderOccluded:i.renderOccluded});const a=t.edge;this._edgeManipulatorMaterials=R({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),renderOccluded:a.renderOccluded});const n=t.edgeOffset;this._edgeOffsetManipulatorMaterials=R({color:n.color.toUnitRGBA(),focusedColor:n.focusedColor.toUnitRGBA(),renderOccluded:n.renderOccluded,shaded:!1});const o=t.selected;this._selectedManipulatorMaterials=R({color:o.color.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA(),focusedOutlineColor:o.focusedOutlineColor.toUnitRGBA(),renderOccluded:o.renderOccluded}),this.tooltip=be(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterials.material),i.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),a.applyColor(this._selectedManipulatorMaterials.material),a.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),a.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Te(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),h(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),h(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===_e.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!xe(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(Ee),this.removeHandles(Ie),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||n&&!o.manipulator.selected||a.push(o),i++);if(a.length===i){if(n||this._hideReshapeControls(),this._moveVertices(a,t),this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(a,t),this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Ie)}_showReshapeControls(){this.removeHandles(Ie)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){const t=this._manipulatorInfos.filter(Te).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(Ee),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],Ee))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Te(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Oe):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Oe)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];this._forEachVertex(t=>{const{selected:i,grabbing:a}=t.manipulator;(i&&!a||t===e.info)&&n.push(t)}),this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Me({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ue(this.view,e,t.graphic??void 0)).next(...p).next(ce()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(je),e&&this.addHandles(le({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),je)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(h(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,{material:m,focusedMaterial:f}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){const e=pe(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=pe(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:f}),2),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:f}),2)],_=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:De(n)}),v=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:De(n)}),M={manipulator:_,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(M,o.minSquaredEdgeLength);const b=()=>this._updateEdgeOffsetManipulator(M);b(),M.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",b)}));const x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([M.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),me(_,this._createEdgeOffsetPipeline(M,t,a)),me(v,this._createEdgePipeline(M,t,a)),v.events.on("immediate-click",x),_.events.on("immediate-click",x),_.events.on("focus-changed",()=>this._resetTooltip()),_.events.on("grab-changed",({screenPoint:e,action:t})=>{M.grabMapPoint="start"===t?J(e,this.view,this.object,M):null})],_),this._manipulatorInfos.push(M),this.manipulators.addMany([_,v]),this.events.emit("manipulators-changed"),M}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&te(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),o(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(fe(this.view,r)).next(z(this.view,r,t,s,e)).next(ge()).next(ce()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(fe(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(B(this.view,i.data.spatialReference)).next(ce()).next(we()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),o=new re({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([u(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=n()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ge){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ge){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!xe(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Te).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.vertex),{material:i,outlineMaterial:a}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=de(i,e,16,16),this._vertexManipulatorOutlineGeometry=de(a,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.edge),{material:i,outlineMaterial:a}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=de(i,e,16,16),this._edgeManipulatorOutlineGeometry=de(a,t,16,16)}const d=this._vertexManipulatorGeometry,h=this._vertexManipulatorOutlineGeometry,u=[];if("point"!==r&&"mesh"!==r){u.push(new k(d.instantiate(),4|Re),new k(h.instantiate(),5|Re),new k(h.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),6|Re));{const{material:e,outlineMaterial:t,focusedMaterial:i}=this._selectedManipulatorMaterials;u.push(new k(d.instantiate({material:e}),8),new k(h.instantiate({material:t}),9),new k(h.instantiate({material:i}),10))}}if(this.enableMidpoints){const{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,i=this._edgeManipulatorGeometry,a=this._edgeManipulatorOutlineGeometry,n=6|Pe,o=5|Pe;u.push(new k(i.instantiate({material:e}),n),new k(a.instantiate({material:t}),n),new k(i.instantiate(),o),new k(a.instantiate(),o))}const c="vertex"===e.type,m=()=>new G({view:a,renderObjects:u,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===r||"mesh"===r,available:this.object.visible,metadata:{deleting:!1},location:De(l)});let f=null;c&&(f=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:m,elevationInfo:t,selected:i})??null),f??=m(),f.selected=i,this._setTypeSpecificManipulatorSettings(f,e,t);const g=c?{manipulator:f,handle:e,type:"vertex",selectedIndex:0}:{manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(g),this.manipulators.add(f),this._updateManipulatorPosition(g),"edge"===g.type){const e=[];for(const t of[g.handle.leftVertex,g.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(g)))}g.locationUpdateHandle=s(e),this._manipulatorHandles.add(g.locationUpdateHandle,f)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(f,!0),f);const _=me(f,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=Me({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,m=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,n,c):z(a,u,t,l,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===g.type){const t=this._splitEdgeManipulator(g);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:g,snapOrigin:g.handle.pos}}).next(fe(a,u)).next(m).next(ue(a,t,c)).next(...d).next(ce()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([_,f.events.on("immediate-click",e=>this._manipulatorClickCallback(e,g)),f.events.on("select-changed",()=>{g.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),f.events.on("focus-changed",()=>{this._resetTooltip()})],f),this.events.emit("manipulators-changed"),g}_screenToSceneMapForVertexDrag(e,t,i){const{view:a}=this,{coordinateHelper:n,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=n.vectorToPoint(t.snapOrigin)),null==s)return null;const r=a.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,a,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=a.manipulators.vertex;e.radius=t/2+i,e.state=Re}break}case"line":{e.state=Pe,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(Ee),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Te(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ae),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&W(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}const s=a?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Ae.spatialReference=this._operations.data.spatialReference,Ae.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ae),this._moveManipulation.elevationAlignedLocation=Ae):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const a=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(a.length>0){const e=this._createBeforeVertexRemoveEvent(a);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const n of a){const e=n.handle.part;if(i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let a=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return a},preventDefault(){a=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a&&(e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function we(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function He(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function De(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Te(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],Se.prototype,"_numGrabbing",void 0),e([g()],Se.prototype,"_numDragging",void 0),e([g()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],Se.prototype,"_operations",null),e([g()],Se.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],Se.prototype,"tool",void 0),e([g()],Se.prototype,"tooltip",void 0),e([g()],Se.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],Se.prototype,"updating",null),e([g()],Se.prototype,"manipulators",null),e([g()],Se.prototype,"view",null),e([g()],Se.prototype,"object",null),e([g()],Se.prototype,"enableZShape",null),e([g()],Se.prototype,"enableDeleteVertices",null),e([g()],Se.prototype,"enableZVertex",null),e([g()],Se.prototype,"autoHideManipulators",null),e([g()],Se.prototype,"enableMoveObject",null),e([g()],Se.prototype,"enableMidpoints",null),e([g()],Se.prototype,"enableEdgeOffset",null),e([g()],Se.prototype,"_sketchOptions",null),e([g()],Se.prototype,"_accentColor",null),e([g()],Se.prototype,"_tooltipsContext",null),Se=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ae=T(0,0,void 0,D.WGS84),Ce=I(),Ge=1e-6,Re=16,Pe=32;export{Se as ReshapeOperation};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{initial as d,on as h,watch as u,syncAndInitial as c,when as m,sync as f}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as C}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterials as R,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as U}from"../../RenderObject.js";import{SegmentLabels3D as k}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as z,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as B}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as W}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as le}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as pe,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as he}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as fe,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as _e}from"../../../../interactive/keybindings.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as ye}from"../../../../support/GeometryWorkerHandle.js";const Oe=Symbol(),Ee=Symbol(),je=Symbol(),Ie=Symbol();let Se=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Ie)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._measurementWorker=new ye({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._toolOptions,e),this._vertexManipulatorMaterials=R({color:i.color.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA(),focusedOutlineColor:i.focusedOutlineColor.toUnitRGBA(),renderOccluded:i.renderOccluded});const a=t.edge;this._edgeManipulatorMaterials=R({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),renderOccluded:a.renderOccluded});const n=t.edgeOffset;this._edgeOffsetManipulatorMaterials=R({color:n.color.toUnitRGBA(),focusedColor:n.focusedColor.toUnitRGBA(),renderOccluded:n.renderOccluded,shaded:!1});const o=t.selected;this._selectedManipulatorMaterials=R({color:o.color.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA(),focusedOutlineColor:o.focusedOutlineColor.toUnitRGBA(),renderOccluded:o.renderOccluded}),this.tooltip=be(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterials.material),i.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),a.applyColor(this._selectedManipulatorMaterials.material),a.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),a.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Te(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),h(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),h(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===_e.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!xe(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(Ee),this.removeHandles(Ie),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._toolOptions.labels;this._segmentLabels=new k({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||n&&!o.manipulator.selected||a.push(o),i++);if(a.length===i){if(n||this._hideReshapeControls(),this._moveVertices(a,t),this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(a,t),this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Ie)}_showReshapeControls(){this.removeHandles(Ie)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){const t=this._manipulatorInfos.filter(Te).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(Ee),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],Ee))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Te(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Oe):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Oe)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];this._forEachVertex(t=>{const{selected:i,grabbing:a}=t.manipulator;(i&&!a||t===e.info)&&n.push(t)}),this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this._showReshapeControls(),this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Me({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ue(this.view,e,t.graphic??void 0)).next(...p).next(ce()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(je),e&&this.addHandles(le({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),je)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(h(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,{material:m,focusedMaterial:f}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){const e=pe(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=pe(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new U(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryInside.instantiate({material:f}),2),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:f}),2)],_=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:De(n)}),v=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:De(n)}),M={manipulator:_,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(M,o.minSquaredEdgeLength);const b=()=>this._updateEdgeOffsetManipulator(M);b(),M.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",b)}));const x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([M.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),me(_,this._createEdgeOffsetPipeline(M,t,a)),me(v,this._createEdgePipeline(M,t,a)),v.events.on("immediate-click",x),_.events.on("immediate-click",x),_.events.on("focus-changed",()=>this._resetTooltip()),_.events.on("grab-changed",({screenPoint:e,action:t})=>{M.grabMapPoint="start"===t?J(e,this.view,this.object,M):null})],_),this._manipulatorInfos.push(M),this.manipulators.addMany([_,v]),this.events.emit("manipulators-changed"),M}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&te(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),o(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(fe(this.view,r)).next(z(this.view,r,t,s,e)).next(ge()).next(ce()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(fe(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(B(this.view,i.data.spatialReference)).next(ce()).next(we()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),o=new re({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([u(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=n()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ge){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ge){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!xe(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Te).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.vertex),{material:i,outlineMaterial:a}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=de(i,e,16,16),this._vertexManipulatorOutlineGeometry=de(a,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.edge),{material:i,outlineMaterial:a}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=de(i,e,16,16),this._edgeManipulatorOutlineGeometry=de(a,t,16,16)}const d=this._vertexManipulatorGeometry,h=this._vertexManipulatorOutlineGeometry,u=[];if("point"!==r&&"mesh"!==r){u.push(new U(d.instantiate(),4|Re),new U(h.instantiate(),5|Re),new U(h.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),6|Re));{const{material:e,outlineMaterial:t,focusedMaterial:i}=this._selectedManipulatorMaterials;u.push(new U(d.instantiate({material:e}),8),new U(h.instantiate({material:t}),9),new U(h.instantiate({material:i}),10))}}if(this.enableMidpoints){const{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,i=this._edgeManipulatorGeometry,a=this._edgeManipulatorOutlineGeometry,n=6|Pe,o=5|Pe;u.push(new U(i.instantiate({material:e}),n),new U(a.instantiate({material:t}),n),new U(i.instantiate(),o),new U(a.instantiate(),o))}const c="vertex"===e.type,m=()=>new G({view:a,renderObjects:u,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===r||"mesh"===r,available:this.object.visible,metadata:{deleting:!1},location:De(l)});let f=null;c&&(f=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:m,elevationInfo:t,selected:i})??null),f??=m(),f.selected=i,this._setTypeSpecificManipulatorSettings(f,e,t);const g=c?{manipulator:f,handle:e,type:"vertex",selectedIndex:0}:{manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(g),this.manipulators.add(f),this._updateManipulatorPosition(g),"edge"===g.type){const e=[];for(const t of[g.handle.leftVertex,g.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(g)))}g.locationUpdateHandle=s(e),this._manipulatorHandles.add(g.locationUpdateHandle,f)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(f,!0),f);const _=me(f,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=Me({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,m=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,n,c):z(a,u,t,l,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===g.type){const t=this._splitEdgeManipulator(g);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:g,snapOrigin:g.handle.pos}}).next(fe(a,u)).next(m).next(ue(a,t,c)).next(...d).next(ce()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([_,f.events.on("immediate-click",e=>this._manipulatorClickCallback(e,g)),f.events.on("select-changed",()=>{g.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),f.events.on("focus-changed",()=>{this._resetTooltip()})],f),this.events.emit("manipulators-changed"),g}_screenToSceneMapForVertexDrag(e,t,i){const{view:a}=this,{coordinateHelper:n,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=n.vectorToPoint(t.snapOrigin)),null==s)return null;const r=a.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,a,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=a.manipulators.vertex;e.radius=t/2+i,e.state=Re}break}case"line":{e.state=Pe,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(Ee),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Te(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ae),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&W(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}const s=a?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Ae.spatialReference=this._operations.data.spatialReference,Ae.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ae),this._moveManipulation.elevationAlignedLocation=Ae):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const a=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(a.length>0){const e=this._createBeforeVertexRemoveEvent(a);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const n of a){const e=n.handle.part;if(i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let a=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return a},preventDefault(){a=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a&&(e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function we(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function He(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function De(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Te(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],Se.prototype,"_numGrabbing",void 0),e([g()],Se.prototype,"_numDragging",void 0),e([g()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],Se.prototype,"_operations",null),e([g()],Se.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],Se.prototype,"tool",void 0),e([g()],Se.prototype,"tooltip",void 0),e([g()],Se.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],Se.prototype,"updating",null),e([g()],Se.prototype,"manipulators",null),e([g()],Se.prototype,"view",null),e([g()],Se.prototype,"object",null),e([g()],Se.prototype,"enableZShape",null),e([g()],Se.prototype,"enableDeleteVertices",null),e([g()],Se.prototype,"enableZVertex",null),e([g()],Se.prototype,"autoHideManipulators",null),e([g()],Se.prototype,"enableMoveObject",null),e([g()],Se.prototype,"enableMidpoints",null),e([g()],Se.prototype,"enableEdgeOffset",null),e([g()],Se.prototype,"_toolOptions",null),e([g()],Se.prototype,"_accentColor",null),e([g()],Se.prototype,"_tooltipsContext",null),Se=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ae=T(0,0,void 0,D.WGS84),Ce=I(),Ge=1e-6,Re=16,Pe=32;export{Se as ReshapeOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.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("before-vertex-remove",e=>this.events.emit("before-vertex-remove",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)}set snapToScene(e){this._set("snapToScene",e)}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()}clearSelection(){this._reshapeOperation?.clearSelection()}selectManipulator(e){return this._reshapeOperation?.selectManipulator(e)??!1}recordUndo(e,t){this._reshapeOperation?.recordUndo({apply:e,undo:t,accumulate:()=>!1})}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(){}get test(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",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({value:!1})],h.prototype,"snapToScene",null),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
+ import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as a}from"../../../../interactive/keybindings.js";import s from"../../../../interactive/options/InteractiveToolOptions.js";let l=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.toolOptions=new s,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("before-vertex-remove",e=>this.events.emit("before-vertex-remove",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)}set snapToScene(e){this._set("snapToScene",e)}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()}clearSelection(){this._reshapeOperation?.clearSelection()}selectManipulator(e){return this._reshapeOperation?.selectManipulator(e)??!1}recordUndo(e,t){this._reshapeOperation?.recordUndo({apply:e,undo:t,accumulate:()=>!1})}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&&a.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}get test(){}};e([i()],l.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],l.prototype,"view",void 0),e([i({constructOnly:!0})],l.prototype,"object",void 0),e([i()],l.prototype,"enableZShape",void 0),e([i()],l.prototype,"enableZVertex",void 0),e([i()],l.prototype,"enableMoveObject",void 0),e([i()],l.prototype,"enableDeleteVertices",void 0),e([i()],l.prototype,"autoHideManipulators",void 0),e([i()],l.prototype,"enableMidpoints",void 0),e([i()],l.prototype,"enableEdgeOffset",void 0),e([i()],l.prototype,"type",void 0),e([i({type:s})],l.prototype,"toolOptions",void 0),e([i()],l.prototype,"snappingManager",void 0),e([i({value:!1})],l.prototype,"snapToScene",null),e([i()],l.prototype,"updating",null),e([i()],l.prototype,"activeTooltipInfo",null),e([i()],l.prototype,"tooltip",null),e([i()],l.prototype,"automaticManipulatorSelection",void 0),l=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],l);export{l as ReshapeTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{debounce as e}from"../../../../../core/promiseUtils.js";import{scale as o,zeroMeters as n}from"../../../../../core/quantity.js";import{watch as i,syncAndInitial as a,sync as s}from"../../../../../core/reactiveUtils.js";import{ensureType as r}from"../../../../../core/accessorSupport/ensureType.js";import c from"../../../../../geometry/Point.js";import{manipulatedObjectGeometry as l}from"../manipulatedObjectUtils.js";import{updateXYZFromTooltipInfo as p,updateTooltipInfoFromManipulatedObject as f,updateElevationFromPoint as m}from"../tooltipUtils3D.js";import{axisConstrainedDragSign as u}from"../manipulations/moveUtils.js";import{connectPasteEvent as y,getXYZDeltasFromTooltipInfo as d}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as v}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{ReshapeEdgeOffsetTooltipInfo as h}from"../../../../interactive/tooltip/infos/ReshapeEdgeOffsetTooltipInfo.js";import{SelectedVertexTooltipInfo as k}from"../../../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as w}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as T}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as g}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as j}from"../../../../support/euclideanLengthMeasurementUtils.js";function I(t,e){const o=e?.type;return{edgeOffset:new h({sketchOptions:t,viewType:o}),movePoint:new v({sketchOptions:t,viewType:o}),selectedVertex:new k({sketchOptions:t,viewType:o}),translate:new w({sketchOptions:t,viewType:o}),translateXY:new T({sketchOptions:t,viewType:o}),translateZ:new g({sketchOptions:t,viewType:o})}}function O(o,n,r,c){function p(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let f=!1;function m(t){f||(f=!0,t(),f=!1)}const u=e(t=>U(n,t)),d=t=>{m(()=>{x(n,t),o.info=t.activeTooltipInfo,c.consumePromise(u(t))})};return t([i(p,t=>d(t),a),i(()=>{const t=p(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,activeTooltipInfo:e,key:e.key,geometry:l(n)}},(t,e)=>{t&&e&&e.key!==t.key&&m(()=>b(n,t.context))},s),n.on("committed",()=>d(p())),y(o,{onBeforePaste:()=>{f=!0},onAfterPaste:()=>{b(n,p()),f=!1}})])}function b(t,{activeTooltipInfo:e,selectedVertexManipulatorInfo:o,callbacks:n}){if(!e)return;n.onBeforeReshape();const i=l(t);switch(i?.type){case"mesh":"move-point"===e.type&&p(e,i.origin,t,n);break;case"point":"move-point"===e.type&&p(e,i,t,n);break;case"multipoint":case"polyline":case"polygon":"selected-vertex"===e.type&&P(e,o,t,n)}}function P(t,e,o,n){if(!e)return;const{dx:i,dy:a,dz:s}=d(t,e.manipulator.location);0===i&&0===a&&0===s||(n.onReshapeStart(),o.operations?.moveVertices([e.handle],i,a,s,0),n.onReshape(),n.onReshapeStop())}function x(t,e){const{activeTooltipInfo:o,selectedVertexManipulatorInfo:n,sketchOptions:i}=e;if(o)switch(o.sketchOptions=i,o?.type){case"move-point":f(o,t);break;case"selected-vertex":D(o,n,t);break;case"reshape-edge-offset":L(o,t)}}function D(t,e,o){if(!t||"selected-vertex"!==t.type)return;const n=e?.manipulator.location;t.setLocationFromPoint(n),m(t,n,o);const i=o.operations?.data.geometry,a=i?.type;"polygon"!==a&&"polyline"!==a||(t.geometryType=a),t.totalLength.visible="polyline"===a,t.area.visible="polygon"===a}function L(t,e){const o=e.operations?.data.geometry,n=o?.type;t.totalLength.visible="polyline"===n,t.totalLength.visible||(t.totalLength.actual=null),t.area.visible="polygon"===n,t.area.visible||(t.area.actual=null)}async function U(t,e){const{activeTooltipInfo:o}=e;if(o)switch(o?.type){case"selected-vertex":case"reshape-edge-offset":return await M(o,t,e)}}async function M(t,e,{measurementWorker:o}){const n=e.operations?.data.geometry;switch(n?.type){case"polygon":t.area.actual=(await o.autoArea2D(n)).area;break;case"polyline":t.totalLength.actual=await o.autoLength2D(n)}}const S=r(c);function B(t,e,o,n){let i=null;const{tooltipInfos:a,sketchOptions:s}=o;switch(t){case 0:i=a.translate;break;case 1:i=a.translateXY;break;case 2:i=a.translateZ}return i.sketchOptions=s,n.consumePromise(E(i,e,o)),i}const E=e(R);async function R(t,e,n){switch(t.type){case"translate":return V(t,e,(t,e)=>n.measurementWorker.autoDistance2DBetweenPoints(S(t),S(e)));case"translate-xy":return V(t,e,async(t,i)=>{const a=await n.measurementWorker.autoDistance2DBetweenPoints(S(t),S(i));return o(a,u(e))});case"translate-z":return V(t,e,j)}}async function V(t,e,o){if(null!=e&&"end"!==e.action){const{mapStart:i,mapEnd:a}=e,s=await o(i,a);t.distance=s??n}else t.distance=n}function A(t,e,o,n){const{sketchOptions:i,tooltipInfos:a}=o,s=a.edgeOffset;return s.sketchOptions=i,n.consumePromise(W(s,t,e,o)),s}const W=e(X);async function X(t,e,i,{measurementWorker:a}){const s=e.operations,r=i?.signedDistance;if(null!=i&&null!=r&&"end"!==i.action&&null!=s){const e=s.data.coordinateHelper,{start:n,end:c}=i.operation.clampedStartAndEnd(i.mapEnd),l=await a.autoDistance2DBetweenPoints(e.arrayToPoint(n),e.arrayToPoint(c)),p=Math.sign(r*i.operation.selectedArrow);t.distance.committed=null,t.distance.actual=null!=l?o(l,p):null}else t.distance.committed=null,t.distance.actual=n}export{O as connectTooltipToManipulatedObject,I as createTooltipInfos,A as getUpdatedEdgeOffsetTooltipInfo,B as getUpdatedTranslateObjectTooltipInfo};
2
+ import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{debounce as e}from"../../../../../core/promiseUtils.js";import{scale as o,zeroMeters as n}from"../../../../../core/quantity.js";import{watch as i,syncAndInitial as a,sync as s}from"../../../../../core/reactiveUtils.js";import{ensureType as r}from"../../../../../core/accessorSupport/ensureType.js";import l from"../../../../../geometry/Point.js";import{manipulatedObjectGeometry as c}from"../manipulatedObjectUtils.js";import{updateXYZFromTooltipInfo as p,updateTooltipInfoFromManipulatedObject as f,updateElevationFromPoint as m}from"../tooltipUtils3D.js";import{axisConstrainedDragSign as u}from"../manipulations/moveUtils.js";import{connectPasteEvent as y,getXYZDeltasFromTooltipInfo as d}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as v}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{ReshapeEdgeOffsetTooltipInfo as w}from"../../../../interactive/tooltip/infos/ReshapeEdgeOffsetTooltipInfo.js";import{SelectedVertexTooltipInfo as T}from"../../../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as g}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as h}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as j}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as I}from"../../../../support/euclideanLengthMeasurementUtils.js";function O(t,e){const o=e?.type;return{edgeOffset:new w({toolOptions:t,viewType:o}),movePoint:new v({toolOptions:t,viewType:o}),selectedVertex:new T({toolOptions:t,viewType:o}),translate:new g({toolOptions:t,viewType:o}),translateXY:new h({toolOptions:t,viewType:o}),translateZ:new j({toolOptions:t,viewType:o})}}function b(o,n,r,l){function p(){const t=r(),e=t.toolOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let f=!1;function m(t){f||(f=!0,t(),f=!1)}const u=e(t=>U(n,t)),d=t=>{m(()=>{x(n,t),o.info=t.activeTooltipInfo,l.consumePromise(u(t))})};return t([i(p,t=>d(t),a),i(()=>{const t=p(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,activeTooltipInfo:e,key:e.key,geometry:c(n)}},(t,e)=>{t&&e&&e.key!==t.key&&m(()=>k(n,t.context))},s),n.on("committed",()=>d(p())),y(o,{onBeforePaste:()=>{f=!0},onAfterPaste:()=>{k(n,p()),f=!1}})])}function k(t,{activeTooltipInfo:e,selectedVertexManipulatorInfo:o,callbacks:n}){if(!e)return;n.onBeforeReshape();const i=c(t);switch(i?.type){case"mesh":"move-point"===e.type&&p(e,i.origin,t,n);break;case"point":"move-point"===e.type&&p(e,i,t,n);break;case"multipoint":case"polyline":case"polygon":"selected-vertex"===e.type&&P(e,o,t,n)}}function P(t,e,o,n){if(!e)return;const{dx:i,dy:a,dz:s}=d(t,e.manipulator.location);0===i&&0===a&&0===s||(n.onReshapeStart(),o.operations?.moveVertices([e.handle],i,a,s,0),n.onReshape(),n.onReshapeStop())}function x(t,e){const{activeTooltipInfo:o,selectedVertexManipulatorInfo:n,toolOptions:i}=e;if(o)switch(o.toolOptions=i,o?.type){case"move-point":f(o,t);break;case"selected-vertex":D(o,n,t);break;case"reshape-edge-offset":L(o,t)}}function D(t,e,o){if(!t||"selected-vertex"!==t.type)return;const n=e?.manipulator.location;t.setLocationFromPoint(n),m(t,n,o);const i=o.operations?.data.geometry,a=i?.type;"polygon"!==a&&"polyline"!==a||(t.geometryType=a),t.totalLength.visible="polyline"===a,t.area.visible="polygon"===a}function L(t,e){const o=e.operations?.data.geometry,n=o?.type;t.totalLength.visible="polyline"===n,t.totalLength.visible||(t.totalLength.actual=null),t.area.visible="polygon"===n,t.area.visible||(t.area.actual=null)}async function U(t,e){const{activeTooltipInfo:o}=e;if(o)switch(o?.type){case"selected-vertex":case"reshape-edge-offset":return await M(o,t,e)}}async function M(t,e,{measurementWorker:o}){const n=e.operations?.data.geometry;switch(n?.type){case"polygon":t.area.actual=(await o.autoArea2D(n)).area;break;case"polyline":t.totalLength.actual=await o.autoLength2D(n)}}const S=r(l);function B(t,e,o,n){let i=null;const{tooltipInfos:a,toolOptions:s}=o;switch(t){case 0:i=a.translate;break;case 1:i=a.translateXY;break;case 2:i=a.translateZ}return i.toolOptions=s,n.consumePromise(E(i,e,o)),i}const E=e(R);async function R(t,e,n){switch(t.type){case"translate":return V(t,e,(t,e)=>n.measurementWorker.autoDistance2DBetweenPoints(S(t),S(e)));case"translate-xy":return V(t,e,async(t,i)=>{const a=await n.measurementWorker.autoDistance2DBetweenPoints(S(t),S(i));return o(a,u(e))});case"translate-z":return V(t,e,I)}}async function V(t,e,o){if(null!=e&&"end"!==e.action){const{mapStart:i,mapEnd:a}=e,s=await o(i,a);t.distance=s??n}else t.distance=n}function A(t,e,o,n){const{toolOptions:i,tooltipInfos:a}=o,s=a.edgeOffset;return s.toolOptions=i,n.consumePromise(W(s,t,e,o)),s}const W=e(X);async function X(t,e,i,{measurementWorker:a}){const s=e.operations,r=i?.signedDistance;if(null!=i&&null!=r&&"end"!==i.action&&null!=s){const e=s.data.coordinateHelper,{start:n,end:l}=i.operation.clampedStartAndEnd(i.mapEnd),c=await a.autoDistance2DBetweenPoints(e.arrayToPoint(n),e.arrayToPoint(l)),p=Math.sign(r*i.operation.selectedArrow);t.distance.committed=null,t.distance.actual=null!=c?o(c,p):null}else t.distance.committed=null,t.distance.actual=n}export{b as connectTooltipToManipulatedObject,O as createTooltipInfos,A as getUpdatedEdgeOffsetTooltipInfo,B as getUpdatedTranslateObjectTooltipInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as t}from"../../../../core/handleUtils.js";import{createAngle as o,createLength as e}from"../../../../core/quantity.js";import{watch as i,syncAndInitial as n,sync as a}from"../../../../core/reactiveUtils.js";import{manipulatedObjectGeometry as r}from"./manipulatedObjectUtils.js";import{connectPasteEvent as s,updateMeshTransformFromTooltipInfo as c,getXYZDeltasFromTooltipInfo as l,updateTooltipInfoFromMeshTransform as u}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";function f(o,e,c){function l(){const t=c(),o=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:o}}let u=!1;function p(t){u||(u=!0,t(),u=!1)}function f({activeTooltipInfo:t,sketchOptions:i,scaleRotateTransform:n}){p(()=>{t&&(t.sketchOptions=i,d(t,e),y(t,n)),o.info=t})}return t([i(l,f,n),i(()=>{const t=l(),{activeTooltipInfo:o}=t;if(o)return{context:t,activeTooltipInfo:o,key:o.key,geometry:r(e)}},(t,o)=>{t&&o&&o.key!==t.key&&p(()=>m(e,t.context))},a),e.on("committed",()=>{queueMicrotask(()=>f(l()))}),s(o,{onBeforePaste:()=>{u=!0},onAfterPaste:()=>{m(e,l()),u=!1}})])}function m(t,{activeTooltipInfo:o,callbacks:e}){if(!o)return;e.onBeforeUpdate();const i=r(t);switch(i?.type){case"mesh":v(o,i.origin,t,e),"orientation"in o&&"scale"in o&&c(o,i,e);break;case"point":v(o,i,t,e)}}function v(t,o,e,i){const{dx:n,dy:a,dz:r}=l(t,o);0===n&&0===a&&0===r||(i.onMoveStart(),e.operations?.move(n,a,r,0),i.onMove(n,a,r),i.onMoveStop())}function d(t,o){const e=r(o),i=e?.type;if(!t||!e||"mesh"!==i&&"point"!==i)return;const n="mesh"===i,a=n?e.origin:e;t.setLocationFromPoint(a),h(t,a,o),"transform-mesh"===t.type&&n&&u(t,e),t.clearInputValues()}function h(t,o,e){t.elevation.actual=p(o),t.elevation.visible=!!e.operations?.data.coordinateHelper.hasZ(),t.elevation.readOnly=!1,t.elevation.showAsZ=!0}function y(t,i){if("transform-point"!==t?.type)return;if(!i)return t.orientation.actual=void 0,t.size.actual=void 0,t.orientation.visible=!1,void(t.size.visible=!1);const n=i.mode,{size:a,orientationClockwise:r}=i.adapter,{visualVariables:s}=t.sketchOptions.tooltips,c=s?.rotation,l=null!=r&&(null==n||"rotate"===n),u="geographic";t.orientation.actual=l?o(r,"radians",u):void 0,t.orientation.precision=k(c?.valueType),t.orientation.visible=l;const p=s?.size,f=null!=a&&(null==n||"scale"===n);t.size.actual=f?e(a,p?.unit??"meters"):void 0,t.size.precision=k(p?.valueType),t.size.visible=f}function k(t){switch(t){case"integer":case"long":return 0;default:return null}}export{f as connectTooltipToManipulatedObject,h as updateElevationFromPoint,d as updateTooltipInfoFromManipulatedObject,v as updateXYZFromTooltipInfo};
2
+ import{handlesGroup as o}from"../../../../core/handleUtils.js";import{createAngle as t,createLength as e}from"../../../../core/quantity.js";import{watch as i,syncAndInitial as n,sync as a}from"../../../../core/reactiveUtils.js";import{manipulatedObjectGeometry as r}from"./manipulatedObjectUtils.js";import{connectPasteEvent as s,updateMeshTransformFromTooltipInfo as l,getXYZDeltasFromTooltipInfo as c,updateTooltipInfoFromMeshTransform as u}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";function f(t,e,l){function c(){const o=l(),t=o.toolOptions.tooltips.effectiveEnabled?o.activeTooltipInfo:null;return{...o,activeTooltipInfo:t}}let u=!1;function p(o){u||(u=!0,o(),u=!1)}function f({activeTooltipInfo:o,toolOptions:i,scaleRotateTransform:n}){p(()=>{o&&(o.toolOptions=i,d(o,e),h(o,n)),t.info=o})}return o([i(c,f,n),i(()=>{const o=c(),{activeTooltipInfo:t}=o;if(t)return{context:o,activeTooltipInfo:t,key:t.key,geometry:r(e)}},(o,t)=>{o&&t&&t.key!==o.key&&p(()=>m(e,o.context))},a),e.on("committed",()=>{queueMicrotask(()=>f(c()))}),s(t,{onBeforePaste:()=>{u=!0},onAfterPaste:()=>{m(e,c()),u=!1}})])}function m(o,{activeTooltipInfo:t,callbacks:e}){if(!t)return;e.onBeforeUpdate();const i=r(o);switch(i?.type){case"mesh":v(t,i.origin,o,e),"orientation"in t&&"scale"in t&&l(t,i,e);break;case"point":v(t,i,o,e)}}function v(o,t,e,i){const{dx:n,dy:a,dz:r}=c(o,t);0===n&&0===a&&0===r||(i.onMoveStart(),e.operations?.move(n,a,r,0),i.onMove(n,a,r),i.onMoveStop())}function d(o,t){const e=r(t),i=e?.type;if(!o||!e||"mesh"!==i&&"point"!==i)return;const n="mesh"===i,a=n?e.origin:e;o.setLocationFromPoint(a),y(o,a,t),"transform-mesh"===o.type&&n&&u(o,e),o.clearInputValues()}function y(o,t,e){o.elevation.actual=p(t),o.elevation.visible=!!e.operations?.data.coordinateHelper.hasZ(),o.elevation.readOnly=!1,o.elevation.showAsZ=!0}function h(o,i){if("transform-point"!==o?.type)return;if(!i)return o.orientation.actual=void 0,o.size.actual=void 0,o.orientation.visible=!1,void(o.size.visible=!1);const n=i.mode,{size:a,orientationClockwise:r}=i.adapter,{visualVariables:s}=o.toolOptions.tooltips,l=s?.rotation,c=null!=r&&(null==n||"rotate"===n),u="geographic";o.orientation.actual=c?t(r,"radians",u):void 0,o.orientation.precision=b(l?.valueType),o.orientation.visible=c;const p=s?.size,f=null!=a&&(null==n||"scale"===n);o.size.actual=f?e(a,p?.unit??"meters"):void 0,o.size.precision=b(p?.valueType),o.size.visible=f}function b(o){switch(o){case"integer":case"long":return 0;default:return null}}export{f as connectTooltipToManipulatedObject,y as updateElevationFromPoint,d as updateTooltipInfoFromManipulatedObject,v as updateXYZFromTooltipInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{initial as o}from"../../../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as r}from"../../../../../core/support/UpdatingHandles.js";import{containsXY as l}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as p}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as h,resizeNormal as d,resizeOutlineOnly as c}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as u}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as m}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{createVisualElements as b}from"../visualElementUtils.js";import{ExtentMove as v}from"./extentTransform/ExtentMove.js";import{ExtentRotate as g}from"./extentTransform/ExtentRotate.js";import{ExtentScale as f}from"./extentTransform/ExtentScale.js";import{TransformBounds as y}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as M}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as j}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as R}from"../../../../interactive/InteractiveToolBase.js";import E from"../../../../interactive/sketch/SketchOptions.js";import{makeTooltip as S}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let O=class extends R{get updating(){return!this.destroying&&!this.destroyed&&(!!this.object.updating||this._extentMove.updating||this._extentScale.updating||this._updatingHandles.updating)}constructor(t){super(t),this.events=new i,this._updatingHandles=new r,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.sketchOptions=new E,this._preserveAspectRatio=new M,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,i=this._bounds=new y(this,()=>this._updateManipulators());this._extentMove=new v(this,i),this._extentScale=new f(this,i,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new g(this,i,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([this._updatingHandles.add(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),this._updatingHandles.add(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(t=>this._updateManipulatorAvailability(t,2))),this._updatingHandles.add(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const n=b({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()});if(null!=n){const{visualElement:t}=n;t instanceof x&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(n)}this.addHandles([e.on("committed",()=>this._onGeometryChanged()),this._updatingHandles.add(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),this._updatingHandles.add(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),o),this._updatingHandles.add(()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>i.updateDisplayBounds())]);const s=t=>{this.addHandles(t.events.on("grab-changed",()=>{this._updateAllManipulatorAvailability()}))};this._forEachManipulator(s);const r=(t,i)=>{this.addHandles(t.events.on("immediate-click",t=>{1===i&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}))};this._forEachManipulator(r),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=S(()=>({view:t,options:this.sketchOptions.tooltips}));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([this._updatingHandles.add(()=>[this.sketchOptions.tooltips.effectiveEnabled,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(T),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",t=>{null!=this._attachmentOrigin&&l(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),T)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=h(t,p.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this.grabbing=null!=this._activeManipulatorType(),this._forEachManipulator((t,e)=>this._updateManipulatorAvailability(t,e)),this._updateManipulatorDisplay()}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof u){const a=this.object.visible,o=this.enableZ&&_(this.object.operations,this.object.elevationInfo);switch(e){case 3:t.available=a&&this.enableRotation;break;case 2:t.available=a&&(this.enableScaling||this.enableRotation||o),t.interactive=!i&&this.enableScaling,t.state=!this.enableScaling||this.grabbing&&2!==this._activeManipulatorType()?c:d;break;case 0:t.available=a&&o;break;default:t.available=a}}}_activeManipulatorType(){let t=null;return this._forEachManipulator(({grabbing:e},i)=>{null==t&&e&&(t=i)}),t}_updateManipulatorDisplay(){this.removeHandles(A);if(null==this._activeManipulatorType())return;const t=[];this._forEachManipulator((e,i)=>{e.grabbing||3!==i&&0!==i||t.push(e.disableDisplay?.())}),this.addHandles(t.filter(e),A)}_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??m(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,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:E})],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 T="draped-elevation-changes",A=Symbol();export{O as ExtentTransformTool};
2
+ import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{initial as o}from"../../../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as r}from"../../../../../core/support/UpdatingHandles.js";import{containsXY as l}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as p}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as d,resizeNormal as h,resizeOutlineOnly as u}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as c}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as m}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{createVisualElements as b}from"../visualElementUtils.js";import{ExtentMove as v}from"./extentTransform/ExtentMove.js";import{ExtentRotate as g}from"./extentTransform/ExtentRotate.js";import{ExtentScale as f}from"./extentTransform/ExtentScale.js";import{TransformBounds as y}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as M}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as j}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as R}from"../../../../interactive/InteractiveToolBase.js";import E from"../../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as S}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let O=class extends R{get updating(){return!this.destroying&&!this.destroyed&&(!!this.object.updating||this._extentMove.updating||this._extentScale.updating||this._updatingHandles.updating)}constructor(t){super(t),this.events=new i,this._updatingHandles=new r,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.toolOptions=new E,this._preserveAspectRatio=new M,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,i=this._bounds=new y(this,()=>this._updateManipulators());this._extentMove=new v(this,i),this._extentScale=new f(this,i,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new g(this,i,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([this._updatingHandles.add(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),this._updatingHandles.add(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(t=>this._updateManipulatorAvailability(t,2))),this._updatingHandles.add(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const n=b({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()});if(null!=n){const{visualElement:t}=n;t instanceof x&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(n)}this.addHandles([e.on("committed",()=>this._onGeometryChanged()),this._updatingHandles.add(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),this._updatingHandles.add(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),o),this._updatingHandles.add(()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>i.updateDisplayBounds())]);const s=t=>{this.addHandles(t.events.on("grab-changed",()=>{this._updateAllManipulatorAvailability()}))};this._forEachManipulator(s);const r=(t,i)=>{this.addHandles(t.events.on("immediate-click",t=>{1===i&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}))};this._forEachManipulator(r),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=S(()=>({view:t,options:this.toolOptions.tooltips}));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([this._updatingHandles.add(()=>[this.toolOptions.tooltips.effectiveEnabled,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.toolOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(T),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",t=>{null!=this._attachmentOrigin&&l(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),T)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=d(t,p.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this.grabbing=null!=this._activeManipulatorType(),this._forEachManipulator((t,e)=>this._updateManipulatorAvailability(t,e)),this._updateManipulatorDisplay()}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof c){const a=this.object.visible,o=this.enableZ&&_(this.object.operations,this.object.elevationInfo);switch(e){case 3:t.available=a&&this.enableRotation;break;case 2:t.available=a&&(this.enableScaling||this.enableRotation||o),t.interactive=!i&&this.enableScaling,t.state=!this.enableScaling||this.grabbing&&2!==this._activeManipulatorType()?u:h;break;case 0:t.available=a&&o;break;default:t.available=a}}}_activeManipulatorType(){let t=null;return this._forEachManipulator(({grabbing:e},i)=>{null==t&&e&&(t=i)}),t}_updateManipulatorDisplay(){this.removeHandles(A);if(null==this._activeManipulatorType())return;const t=[];this._forEachManipulator((e,i)=>{e.grabbing||3!==i&&0!==i||t.push(e.disableDisplay?.())}),this.addHandles(t.filter(e),A)}_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??m(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,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:E})],O.prototype,"toolOptions",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 T="draped-elevation-changes",A=Symbol();export{O as ExtentTransformTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as i}from"../../../../../core/Cyclical.js";import{EventEmitter as o}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{fromRotation as g,fromScaling as m,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as v,subtract as S,length as b,squaredDistance as y,cross as j,add as R}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as w,clone as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as I,create as F,getNormal as k}from"../../../../../geometry/support/plane.js";import{wrap as E,distance2 as O}from"../../../../../geometry/support/ray.js";import{sm4d as P,sv3d as T}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as x}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as C}from"../dragEventPipeline3D.js";import{ringIndicatorDelayMs as H,rotateIndicatorArrowPlacementPercentage as z,ringThickness as G,ringRadius as q,innerIndicatorRadius as B,outerIndicatorRadius as J,rotateIndicatorArrowTipRadius as K,rotateIndicatorArrowTipLength as N,scaleIndicatorOffset1 as Q,scaleIndicatorOffset2 as V,indicatorThickness as W,geometrySegments as X,rotateIndicatorArcLength as Y,scaleIndicatorArcLength as Z,rotateIndicatorDirectionBuffer as $,scaleIndicatorDirectionBuffer as tt,ringHeight as et,dragThresholdPx as at,ringResetAnimationSpeedFactor as it}from"../manipulations/config.js";import{createExtrudedTriangle as ot,transformInPlace as rt,createPathExtrusionGeometry as st}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as nt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as lt}from"../../../../interactive/dragEventPipeline.js";const ct={ScaleIn:32,ScaleOut:64,RotateLeft:128,RotateRight:256,Unlocked:1024,DelayedFocused:2048};let dt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new o,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l(()=>{const{adapter:t}=this;return[t.angle,t.scale]},()=>this._updateManipulatorTransform())])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,4)}disableDisplay(){return this._ringManipulator.disableDisplay()}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=lt(t,(t,a,o)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:A(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=T.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(C(this.tool.view,I(t.renderLocation,c,F()))).next(t=>{const a=k(t.plane),o=U(t.renderStart,t.renderEnd,l.origin,a),c=i.shortestSignedDiff(l.angle,o);l.angleDir=r(l.angleDir+c,-.3,$),l.angle=o;const d=ht(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-.2,tt),this._onScaleChanged(),"none"===l.mode){const a=this.mode||ut(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+o;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(gt(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t}),o.next(()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(gt(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}})});this.addHandles([a,t.events.on("focus-changed",t=>{"focus"===t.action?this.startAnimation(mt(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),t.events.on("immediate-click",t=>{t.stopPropagation()}),l(()=>this.tool.object.visible,t=>this._ringManipulator.available=t,c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(ct.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(ct.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(ct.ScaleIn|ct.ScaleOut,!1),this._ringManipulator.updateStateEnabled(ct.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(ct.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(ct.RotateLeft|ct.RotateRight,!1),this._ringManipulator.updateStateEnabled(ct.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(ct.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(ct.ScaleIn|ct.ScaleOut|ct.RotateLeft|ct.RotateRight,!1)}_updateManipulatorTransform(){const t=g(P.get(),this.adapter.angle,w(0,0,1));if(null==t)return;const e=this.getScale(),a=m(P.get(),v(T.get(),e,e,e));this._ringManipulator.modelTransform=f(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(X*(e-t)/(2*Math.PI));for(let r=0;r<o+1;r++){const s=t+r*(e-t)/o;i.push(w(a*Math.cos(s),a*Math.sin(s),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,et/2],[-t/2,et/2]],i=this._createMaterial(1),o=(t,e,o=i)=>st(o,a(e),t,[],[],!1),r=e(q),s=o(r,G),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-Y,r=e+a,s=e+Math.PI/2-a,c=t(r,s,B),d=o(c,W);l.push(c),l.push(t(r,s,J-G/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=M();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(z*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-z)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=ot(i,N,0,K,et);rt(o,a),(e?n.left:n.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-Z,i=e+a,r=e+Math.PI/2-a,s=t(i,r,J);c.push(o(s,W))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(q+Q),g=e(q+V),m=o(p,W,d),f=o(g,W,u),v=e(q-Q),S=e(q-V),b=o(v,W,d),y=o(S,W,u);let j=[new L(s,ct.DelayedFocused),new L(s.instantiate({material:h}),0)];this.mode&&"scale"!==this.mode||(j=j.concat([...c.map(t=>new L(t,ct.DelayedFocused|ct.Unlocked)),new L(m,ct.DelayedFocused|ct.ScaleIn),new L(f,ct.DelayedFocused|ct.ScaleIn),new L(b,ct.DelayedFocused|ct.ScaleOut),new L(y,ct.DelayedFocused|ct.ScaleOut)])),this.mode&&"rotate"!==this.mode||(j=j.concat([...n.right.map(t=>new L(t.instantiate(),ct.DelayedFocused|ct.Unlocked)),...n.left.map(t=>new L(t,ct.DelayedFocused|ct.RotateLeft)),...n.right.map(t=>new L(t,ct.DelayedFocused|ct.RotateRight))]));const R=[r,...l];return new x({view:this.tool.view,renderObjects:j,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:w(0,0,1)}})}_createMaterial(t){const e=new nt({cullFace:2,renderOccluded:2,isDecoration:!0});return this.addHandles(l(()=>a(this.tool.view.effectiveTheme.accentColor,t),t=>e.setParameters({color:t}),c)),e}get test(){}};function ht(t,e){const a=S(T.get(),e.renderStart,t.origin),i=S(T.get(),e.renderEnd,t.origin),o=b(a),r=b(i);return 0===o?0:r/o}function ut(t,e,a,i){const{renderStart:o,renderEnd:r}=t,s=pt(o,i,T.get()),n=pt(r,i,T.get());if(y(s,n)<at*at)return null;const l=S(T.get(),o,a),c=j(T.get(),l,k(e)),d=o,h=R(T.get(),d,c),u=pt(a,i,T.get()),p=s,g=pt(h,i,T.get()),m=S(T.get(),g,p),f=S(T.get(),s,u),_=E(p,m),D=E(u,f);return O(_,n)<O(D,n)?"rotate":"scale"}function pt(t,e,a){return e.projectToScreen(t,ft),v(a,ft[0],ft[1],0)}function gt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*it,1),e(),Math.abs(i-1)<.01?1:0),destroy:()=>{a&&(t.getScale=a),e()}}}function mt(t,e,a){let i=0,o=null;const r=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=r,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?1:0),destroy:()=>{o&&(t.getFocused=o),e()}}}t([u({constructOnly:!0})],dt.prototype,"tool",void 0),t([u({constructOnly:!0})],dt.prototype,"adapter",void 0),t([u({constructOnly:!0})],dt.prototype,"sketchOptions",void 0),t([u()],dt.prototype,"mode",void 0),t([u()],dt.prototype,"_activeAnimation",void 0),t([u()],dt.prototype,"updating",null),dt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],dt);const ft=h();export{dt as ScaleRotateTransform};
2
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as i}from"../../../../../core/Cyclical.js";import{EventEmitter as o}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{fromRotation as g,fromScaling as m,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as v,subtract as S,length as b,squaredDistance as y,cross as j,add as R}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as w,clone as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as I,create as F,getNormal as k}from"../../../../../geometry/support/plane.js";import{wrap as E,distance2 as O}from"../../../../../geometry/support/ray.js";import{sm4d as P,sv3d as T}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as x}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as C}from"../dragEventPipeline3D.js";import{ringIndicatorDelayMs as H,rotateIndicatorArrowPlacementPercentage as z,ringThickness as G,ringRadius as q,innerIndicatorRadius as B,outerIndicatorRadius as J,rotateIndicatorArrowTipRadius as K,rotateIndicatorArrowTipLength as N,scaleIndicatorOffset1 as Q,scaleIndicatorOffset2 as V,indicatorThickness as W,geometrySegments as X,rotateIndicatorArcLength as Y,scaleIndicatorArcLength as Z,rotateIndicatorDirectionBuffer as $,scaleIndicatorDirectionBuffer as tt,ringHeight as et,dragThresholdPx as at,ringResetAnimationSpeedFactor as it}from"../manipulations/config.js";import{createExtrudedTriangle as ot,transformInPlace as rt,createPathExtrusionGeometry as st}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as nt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as lt}from"../../../../interactive/dragEventPipeline.js";const ct={ScaleIn:32,ScaleOut:64,RotateLeft:128,RotateRight:256,Unlocked:1024,DelayedFocused:2048};let dt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new o,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l(()=>{const{adapter:t}=this;return[t.angle,t.scale]},()=>this._updateManipulatorTransform())])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,4)}disableDisplay(){return this._ringManipulator.disableDisplay()}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=lt(t,(t,a,o)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:A(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=T.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(C(this.tool.view,I(t.renderLocation,c,F()))).next(t=>{const a=k(t.plane),o=U(t.renderStart,t.renderEnd,l.origin,a),c=i.shortestSignedDiff(l.angle,o);l.angleDir=r(l.angleDir+c,-.3,$),l.angle=o;const d=ht(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-.2,tt),this._onScaleChanged(),"none"===l.mode){const a=this.mode||ut(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+o;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(gt(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t}),o.next(()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(gt(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}})});this.addHandles([a,t.events.on("focus-changed",t=>{"focus"===t.action?this.startAnimation(mt(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),t.events.on("immediate-click",t=>{t.stopPropagation()}),l(()=>this.tool.object.visible,t=>this._ringManipulator.available=t,c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(ct.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(ct.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(ct.ScaleIn|ct.ScaleOut,!1),this._ringManipulator.updateStateEnabled(ct.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(ct.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(ct.RotateLeft|ct.RotateRight,!1),this._ringManipulator.updateStateEnabled(ct.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(ct.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(ct.ScaleIn|ct.ScaleOut|ct.RotateLeft|ct.RotateRight,!1)}_updateManipulatorTransform(){const t=g(P.get(),this.adapter.angle,w(0,0,1));if(null==t)return;const e=this.getScale(),a=m(P.get(),v(T.get(),e,e,e));this._ringManipulator.modelTransform=f(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(X*(e-t)/(2*Math.PI));for(let r=0;r<o+1;r++){const s=t+r*(e-t)/o;i.push(w(a*Math.cos(s),a*Math.sin(s),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,et/2],[-t/2,et/2]],i=this._createMaterial(1),o=(t,e,o=i)=>st(o,a(e),t,[],[],!1),r=e(q),s=o(r,G),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-Y,r=e+a,s=e+Math.PI/2-a,c=t(r,s,B),d=o(c,W);l.push(c),l.push(t(r,s,J-G/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=M();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(z*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-z)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=ot(i,N,0,K,et);rt(o,a),(e?n.left:n.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-Z,i=e+a,r=e+Math.PI/2-a,s=t(i,r,J);c.push(o(s,W))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(q+Q),g=e(q+V),m=o(p,W,d),f=o(g,W,u),v=e(q-Q),S=e(q-V),b=o(v,W,d),y=o(S,W,u);let j=[new L(s,ct.DelayedFocused),new L(s.instantiate({material:h}),0)];this.mode&&"scale"!==this.mode||(j=j.concat([...c.map(t=>new L(t,ct.DelayedFocused|ct.Unlocked)),new L(m,ct.DelayedFocused|ct.ScaleIn),new L(f,ct.DelayedFocused|ct.ScaleIn),new L(b,ct.DelayedFocused|ct.ScaleOut),new L(y,ct.DelayedFocused|ct.ScaleOut)])),this.mode&&"rotate"!==this.mode||(j=j.concat([...n.right.map(t=>new L(t.instantiate(),ct.DelayedFocused|ct.Unlocked)),...n.left.map(t=>new L(t,ct.DelayedFocused|ct.RotateLeft)),...n.right.map(t=>new L(t,ct.DelayedFocused|ct.RotateRight))]));const R=[r,...l];return new x({view:this.tool.view,renderObjects:j,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:w(0,0,1)}})}_createMaterial(t){const e=new nt({cullFace:2,renderOccluded:2,isDecoration:!0});return this.addHandles(l(()=>a(this.tool.view.effectiveTheme.accentColor,t),t=>e.setParameters({color:t}),c)),e}get test(){}};function ht(t,e){const a=S(T.get(),e.renderStart,t.origin),i=S(T.get(),e.renderEnd,t.origin),o=b(a),r=b(i);return 0===o?0:r/o}function ut(t,e,a,i){const{renderStart:o,renderEnd:r}=t,s=pt(o,i,T.get()),n=pt(r,i,T.get());if(y(s,n)<at*at)return null;const l=S(T.get(),o,a),c=j(T.get(),l,k(e)),d=o,h=R(T.get(),d,c),u=pt(a,i,T.get()),p=s,g=pt(h,i,T.get()),m=S(T.get(),g,p),f=S(T.get(),s,u),_=E(p,m),D=E(u,f);return O(_,n)<O(D,n)?"rotate":"scale"}function pt(t,e,a){return e.projectToScreen(t,ft),v(a,ft[0],ft[1],0)}function gt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*it,1),e(),Math.abs(i-1)<.01?1:0),destroy:()=>{a&&(t.getScale=a),e()}}}function mt(t,e,a){let i=0,o=null;const r=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=r,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?1:0),destroy:()=>{o&&(t.getFocused=o),e()}}}t([u({constructOnly:!0})],dt.prototype,"tool",void 0),t([u({constructOnly:!0})],dt.prototype,"adapter",void 0),t([u({constructOnly:!0})],dt.prototype,"toolOptions",void 0),t([u()],dt.prototype,"mode",void 0),t([u()],dt.prototype,"_activeAnimation",void 0),t([u()],dt.prototype,"updating",null),dt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],dt);const ft=h();export{dt as ScaleRotateTransform};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{property as n,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import r from"../../../../../geometry/Point.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{placeAtObject as c}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as h}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as d}from"../manipulatedObjectUtils.js";import{canMoveZOperations as m}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as u}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as v}from"../tooltipUtils3D.js";import{createVisualElements as g}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as _}from"../manipulations/config.js";import{MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as f}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as y}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as S}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import w from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as O}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as x}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as I}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let k=class extends M{constructor(t){super(t),this.events=new i,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new w,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:i,view:a}=this;this.tooltip=A(()=>({view:a,options:this.sketchOptions.tooltips})),this._moveManipulation=new b({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&m(i.operations,i.elevationInfo),radius:b.radiusForSymbol(i.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles(e.events.on("immediate-click",e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})));const n=i.elevationInfo;if(this._moveManipulation.elevationInfo=n,this.addHandles(u(i)),this._moveManipulation.createManipulatedObjectDragPipeline((t,e,o,s,l)=>{if(0===t){const{snappingStep:t,cancelSnapping:e}=T({snappingContext:new O({elevationInfo:n,pointer:l,editGeometryOperations:R.fromGeometry(new r({spatialReference:i.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new h,excludeFeature:i.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});s=s.next(e),o=o.next(S(this.view,n)).next(...t)}return{steps:o,cancel:s}},i,e=>{const{action:i,object:o,dxScreen:a,dyScreen:n}=e,s={object:o,dxScreen:a,dyScreen:n};switch(i){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}}),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(this._updatingHandles.add(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new y({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([g({view:this.view,object:i,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>o()}),i.on("committed",()=>this._onGeometryChanged()),this._hideManipulatorsForObjectState(),this._updatingHandles.add(()=>a.scale,()=>this._updateMoveAngle())].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(t=>{t instanceof p&&this.addHandles(t.events.on("grab-changed",()=>this._updateManipulatorsForGrabState()))});const s=a?.type,{sketchOptions:l}=this;this._meshTooltipInfo=new H({viewType:s,sketchOptions:l}),this._pointTooltipInfo=new I({viewType:s,sketchOptions:l});const c={object:i,dxScreen:0,dyScreen:0},d={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:i,angle:e})},onRotate:e=>t.emit("rotate",{object:i,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:i,angle:e}),onScaleStart:(e,o)=>{this._emitRecordUndo(),t.emit("scale-start",{object:i,xScale:e,yScale:o})},onScale:(e,o)=>t.emit("scale",{object:i,xScale:e,yScale:o}),onScaleStop:(e,o)=>t.emit("scale-stop",{object:i,xScale:e,yScale:o})};this.addHandles(v(this.tooltip,this.object,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:d,scaleRotateTransform:this._scaleRotate}))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!x(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsForGrabState(){if(null==this._scaleRotate)return;this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing;let t=null;this._moveManipulation.grabbing?t=this._scaleRotate.disableDisplay():this._scaleRotate.grabbing&&(t=this._moveManipulation.hideManipulators()),this.removeHandles(U),t&&this.addHandles(t,U)}_createScaleRotateAdapter(){const t=d(this.object);return"mesh"===t?.type?new f({object:this.object,viewingMode:this.view.state.viewingMode}):new j({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find(t=>t.layer===this.object.graphic?.layer),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return this._updatingHandles.add(()=>this.object.visible,t=>{this._forEachManipulator(e=>e.available=t),this._moveManipulation.zManipulation.available=t&&this.enableZ&&m(this.object.operations,this.object.elevationInfo)})}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating||!!this.snappingManager?.updating}get activeTooltipInfo(){return"mesh"===d(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onActivate(){this.tooltip.hidden=!this.internallyEditable}onEditableChange(){this.internallyEditable||(this.tooltip.hidden=!0,this.tooltip.exitInputMode({focusOnView:!1}))}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=2===t.state.viewingMode||t.scale<_;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){c(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"view",void 0),t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"object",void 0),t([n({constructOnly:!0,nonNullable:!0})],k.prototype,"enableZ",void 0),t([n()],k.prototype,"enableRotation",void 0),t([n()],k.prototype,"enableScaling",void 0),t([n({constructOnly:!0,type:w})],k.prototype,"sketchOptions",void 0),t([n({value:!1})],k.prototype,"snapToScene",null),t([n({constructOnly:!0})],k.prototype,"snappingManager",void 0),t([n({readOnly:!0})],k.prototype,"type",void 0),t([n({readOnly:!0})],k.prototype,"updating",null),t([n()],k.prototype,"activeTooltipInfo",null),k=t([s("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],k);const U=Symbol();export{k as TransformTool3D};
2
+ import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as o}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{property as n,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import r from"../../../../../geometry/Point.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{placeAtObject as c}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as h}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as d}from"../manipulatedObjectUtils.js";import{canMoveZOperations as m}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as u}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as v}from"../tooltipUtils3D.js";import{createVisualElements as g}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as _}from"../manipulations/config.js";import{MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as f}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as y}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as S}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import w from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as T}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as O}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as x}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as I}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let U=class extends M{constructor(t){super(t),this.events=new o,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.toolOptions=new w,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:o,view:a}=this;this.tooltip=A(()=>({view:a,options:this.toolOptions.tooltips})),this._moveManipulation=new b({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&m(o.operations,o.elevationInfo),radius:b.radiusForSymbol(o.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles(e.events.on("immediate-click",e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})));const n=o.elevationInfo;if(this._moveManipulation.elevationInfo=n,this.addHandles(u(o)),this._moveManipulation.createManipulatedObjectDragPipeline((t,e,i,s,l)=>{if(0===t){const{snappingStep:t,cancelSnapping:e}=O({snappingContext:new T({elevationInfo:n,pointer:l,editGeometryOperations:R.fromGeometry(new r({spatialReference:o.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new h,excludeFeature:o.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});s=s.next(e),i=i.next(S(this.view,n)).next(...t)}return{steps:i,cancel:s}},o,e=>{const{action:o,object:i,dxScreen:a,dyScreen:n}=e,s={object:i,dxScreen:a,dyScreen:n};switch(o){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}}),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(this._updatingHandles.add(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new y({tool:this,mode:t,adapter:this._scaleRotateAdapter,toolOptions:this.toolOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([g({view:this.view,object:o,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()}),o.on("committed",()=>this._onGeometryChanged()),this._hideManipulatorsForObjectState(),this._updatingHandles.add(()=>a.scale,()=>this._updateMoveAngle())].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(t=>{t instanceof p&&this.addHandles(t.events.on("grab-changed",()=>this._updateManipulatorsForGrabState()))});const s=a?.type,{toolOptions:l}=this;this._meshTooltipInfo=new I({viewType:s,toolOptions:l}),this._pointTooltipInfo=new H({viewType:s,toolOptions:l});const c={object:o,dxScreen:0,dyScreen:0},d={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:o,angle:e})},onRotate:e=>t.emit("rotate",{object:o,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:o,angle:e}),onScaleStart:(e,i)=>{this._emitRecordUndo(),t.emit("scale-start",{object:o,xScale:e,yScale:i})},onScale:(e,i)=>t.emit("scale",{object:o,xScale:e,yScale:i}),onScaleStop:(e,i)=>t.emit("scale-stop",{object:o,xScale:e,yScale:i})};this.addHandles(v(this.tooltip,this.object,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:d,scaleRotateTransform:this._scaleRotate}))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!x(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsForGrabState(){if(null==this._scaleRotate)return;this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing;let t=null;this._moveManipulation.grabbing?t=this._scaleRotate.disableDisplay():this._scaleRotate.grabbing&&(t=this._moveManipulation.hideManipulators()),this.removeHandles(E),t&&this.addHandles(t,E)}_createScaleRotateAdapter(){const t=d(this.object);return"mesh"===t?.type?new f({object:this.object,viewingMode:this.view.state.viewingMode}):new j({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find(t=>t.layer===this.object.graphic?.layer),sizeAxis:this.toolOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return this._updatingHandles.add(()=>this.object.visible,t=>{this._forEachManipulator(e=>e.available=t),this._moveManipulation.zManipulation.available=t&&this.enableZ&&m(this.object.operations,this.object.elevationInfo)})}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating||!!this.snappingManager?.updating}get activeTooltipInfo(){return"mesh"===d(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onActivate(){this.tooltip.hidden=!this.internallyEditable}onEditableChange(){this.internallyEditable||(this.tooltip.hidden=!0,this.tooltip.exitInputMode({focusOnView:!1}))}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=2===t.state.viewingMode||t.scale<_;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){c(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([n({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),t([n({constructOnly:!0,nonNullable:!0})],U.prototype,"object",void 0),t([n({constructOnly:!0,nonNullable:!0})],U.prototype,"enableZ",void 0),t([n()],U.prototype,"enableRotation",void 0),t([n()],U.prototype,"enableScaling",void 0),t([n({constructOnly:!0,type:w})],U.prototype,"toolOptions",void 0),t([n({value:!1})],U.prototype,"snapToScene",null),t([n({constructOnly:!0})],U.prototype,"snappingManager",void 0),t([n({readOnly:!0})],U.prototype,"type",void 0),t([n({readOnly:!0})],U.prototype,"updating",null),t([n()],U.prototype,"activeTooltipInfo",null),U=t([s("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],U);const E=Symbol();export{U as TransformTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{zeroMeters as e}from"../../../../../../core/quantity.js";import{rotateZ as o}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as i}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as a}from"../../../../../../core/support/UpdatingHandles.js";import r from"../../../../../../geometry/Point.js";import{sm4d as s,sv3d as p}from"../../../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as l}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToZConstrained as m}from"../../dragEventPipeline3D.js";import{MoveXYObjectManipulation as c}from"../../manipulations/MoveXYObjectManipulation.js";import{ShiftManipulator as u}from"../../../manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as d,addMapDelta as h,addScreenDelta as v}from"../../../../../interactive/dragEventPipeline.js";import{TranslateTooltipInfo as f}from"../../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateZTooltipInfo as _}from"../../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistance as g}from"../../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as M}from"../../../../../support/GeometryWorkerHandle.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}constructor(t,e){this._tool=t,this._bounds=e,this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._measurementWorker=new M({preloadGeodetic:!0}),this._updatingHandles=new a;const o=this._tool,i=o.view;this.moveXYObjectManipulation=new c({view:i,tool:o,object:this._object}),o.addHandles(this._createMoveXYObjectDragPipeline()),this.moveZManipulator=new u(i,0),this.moveZManipulator.state|=l,o.manipulators.add(this.moveZManipulator),o.addHandles(this._createMoveZDragPipeline()),o.addHandles(o.events.on("translate-stop",()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null}))}destroy(){this.moveXYObjectManipulation.destroy(),this._tool.manipulators.remove(this.moveZManipulator),this.moveZManipulator.destroy(),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(t){this.moveXYObjectManipulation.forEachManipulator(t),t(this.moveZManipulator,0)}updateManipulators(t,e){const n=this.moveZManipulator,a=o(s.get(),t,Math.PI);a[12]=0,a[13]=0,a[14]=0,n.modelTransform=a,n.renderLocation=i(p.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.moveXYObjectManipulation.grabbing||this.moveXYObjectManipulation.dragging?this._computeMoveXYTooltipInfo():this.moveZManipulator.focused?this._computeMoveZTooltipInfo():null}_computeMoveXYTooltipInfo(){const t=this._tool,o=this._moveXYTooltipInfo??=new f({sketchOptions:t.sketchOptions});if(this.moveXYObjectManipulation.dragging){const t=this._bounds,e=t.mapBoundsStart.origin,i=t.mapBounds.origin,n=t.spatialReference,a=new r({x:e[0],y:e[1],spatialReference:n}),s=new r({x:i[0],y:i[1],spatialReference:n});this._updatingHandles.consumePromise(this._measurementWorker.autoDistance2DBetweenPoints(a,s).then(t=>o.distance=t))}else o.distance=e;return o}_computeMoveZTooltipInfo(){const t=this._tool,o=this._moveZTooltipInfo??=new _({sketchOptions:t.sketchOptions});if(this.moveZManipulator.dragging){const e=this._bounds,i=e.mapBoundsStart.origin,n=e.mapBounds.origin,{renderSpatialReference:a}=t.view;if(!a)return null;const r=g(i,n,a);if(null==r)return null;o.distance=r}else o.distance=e;return o}_createMoveXYObjectDragPipeline(){return this.moveXYObjectManipulation.createDragPipeline((t,e,o)=>this._buildMoveDragPipeline(e,o))}_createMoveZDragPipeline(){if(!this._operations)return t();const e=this._operations.data.spatialReference;return d(this.moveZManipulator,(t,o,i)=>{const a=n(t.renderLocation),r=o.next(m(this._tool.view,a,e)).next(v());this._buildMoveDragPipeline(r,i)})}_buildMoveDragPipeline(t,e){const{_tool:o,_object:i}=this;t.next(t=>("start"===t.action&&(o.inputState={type:"move"},this._bounds.backupMapBounds(),o.events.emit("translate-start",{object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY})),t)).next(h()).next(this._updateGeometry()).next(t=>{const e={object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY};switch(t.action){case"start":case"update":(t.mapEnd.x-t.mapStart.x||t.mapEnd.y-t.mapStart.y||(t.mapEnd.z??0)-(t.mapStart.z??0))&&o.events.emit("translate",e);break;case"end":o.inputState=null,o.events.emit("translate-stop",e)}return t}),e.next(()=>{null!=o.inputState&&o.events.emit("translate-stop",{object:i,dxScreen:0,dyScreen:0}),o.cancelDrag()})}_updateGeometry(){const t=this._tool;return e=>{if(null==t.inputState||"move"!==t.inputState.type)return e;const o="start"===e.action?0:1;if(this._operations){const t=this._operations.move(e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,o);this._bounds.updateMapBoundsFromOperation(t)}return e}}}export{j as ExtentMove};
2
+ import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{zeroMeters as e}from"../../../../../../core/quantity.js";import{rotateZ as o}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as i}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as a}from"../../../../../../core/support/UpdatingHandles.js";import r from"../../../../../../geometry/Point.js";import{sm4d as s,sv3d as l}from"../../../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as p}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToZConstrained as m}from"../../dragEventPipeline3D.js";import{MoveXYObjectManipulation as u}from"../../manipulations/MoveXYObjectManipulation.js";import{ShiftManipulator as c}from"../../../manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as d,addMapDelta as h,addScreenDelta as v}from"../../../../../interactive/dragEventPipeline.js";import{TranslateTooltipInfo as f}from"../../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateZTooltipInfo as _}from"../../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistance as g}from"../../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as M}from"../../../../../support/GeometryWorkerHandle.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}constructor(t,e){this._tool=t,this._bounds=e,this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._measurementWorker=new M({preloadGeodetic:!0}),this._updatingHandles=new a;const o=this._tool,i=o.view;this.moveXYObjectManipulation=new u({view:i,tool:o,object:this._object}),o.addHandles(this._createMoveXYObjectDragPipeline()),this.moveZManipulator=new c(i,0),this.moveZManipulator.state|=p,o.manipulators.add(this.moveZManipulator),o.addHandles(this._createMoveZDragPipeline()),o.addHandles(o.events.on("translate-stop",()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null}))}destroy(){this.moveXYObjectManipulation.destroy(),this._tool.manipulators.remove(this.moveZManipulator),this.moveZManipulator.destroy(),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(t){this.moveXYObjectManipulation.forEachManipulator(t),t(this.moveZManipulator,0)}updateManipulators(t,e){const n=this.moveZManipulator,a=o(s.get(),t,Math.PI);a[12]=0,a[13]=0,a[14]=0,n.modelTransform=a,n.renderLocation=i(l.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.moveXYObjectManipulation.grabbing||this.moveXYObjectManipulation.dragging?this._computeMoveXYTooltipInfo():this.moveZManipulator.focused?this._computeMoveZTooltipInfo():null}_computeMoveXYTooltipInfo(){const t=this._tool,o=this._moveXYTooltipInfo??=new f({toolOptions:t.toolOptions});if(this.moveXYObjectManipulation.dragging){const t=this._bounds,e=t.mapBoundsStart.origin,i=t.mapBounds.origin,n=t.spatialReference,a=new r({x:e[0],y:e[1],spatialReference:n}),s=new r({x:i[0],y:i[1],spatialReference:n});this._updatingHandles.consumePromise(this._measurementWorker.autoDistance2DBetweenPoints(a,s).then(t=>o.distance=t))}else o.distance=e;return o}_computeMoveZTooltipInfo(){const t=this._tool,o=this._moveZTooltipInfo??=new _({toolOptions:t.toolOptions});if(this.moveZManipulator.dragging){const e=this._bounds,i=e.mapBoundsStart.origin,n=e.mapBounds.origin,{renderSpatialReference:a}=t.view;if(!a)return null;const r=g(i,n,a);if(null==r)return null;o.distance=r}else o.distance=e;return o}_createMoveXYObjectDragPipeline(){return this.moveXYObjectManipulation.createDragPipeline((t,e,o)=>this._buildMoveDragPipeline(e,o))}_createMoveZDragPipeline(){if(!this._operations)return t();const e=this._operations.data.spatialReference;return d(this.moveZManipulator,(t,o,i)=>{const a=n(t.renderLocation),r=o.next(m(this._tool.view,a,e)).next(v());this._buildMoveDragPipeline(r,i)})}_buildMoveDragPipeline(t,e){const{_tool:o,_object:i}=this;t.next(t=>("start"===t.action&&(o.inputState={type:"move"},this._bounds.backupMapBounds(),o.events.emit("translate-start",{object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY})),t)).next(h()).next(this._updateGeometry()).next(t=>{const e={object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY};switch(t.action){case"start":case"update":(t.mapEnd.x-t.mapStart.x||t.mapEnd.y-t.mapStart.y||(t.mapEnd.z??0)-(t.mapStart.z??0))&&o.events.emit("translate",e);break;case"end":o.inputState=null,o.events.emit("translate-stop",e)}return t}),e.next(()=>{null!=o.inputState&&o.events.emit("translate-stop",{object:i,dxScreen:0,dyScreen:0}),o.cancelDrag()})}_updateGeometry(){const t=this._tool;return e=>{if(null==t.inputState||"move"!==t.inputState.type)return e;const o="start"===e.action?0:1;if(this._operations){const t=this._operations.move(e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,o);this._bounds.updateMapBoundsFromOperation(t)}return e}}}export{j as ExtentMove};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{rad2deg as t}from"../../../../../../core/mathUtils.js";import{rotateX as e}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as o,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as n}from"../../../../../../chunks/boundedPlane.js";import{create as s,intersectRay as i,getNormal as l}from"../../../../../../geometry/support/plane.js";import{sm4d as p,sv3d as u}from"../../../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as c}from"../../../../analysis/images/Factory.js";import{createRotatePlane as m}from"../../../../analysis/Slice/sliceToolUtils.js";import{calculateInputRotationTransform as d}from"../../../manipulatorUtils.js";import{screenToRenderPlane as h}from"../../dragEventPipeline3D.js";import{RotateManipulator as g}from"../../../manipulators/RotateManipulator.js";import{fromScreenNormalized as _}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as f}from"../../../../../interactive/dragEventPipeline.js";import{ExtentRotateTooltipInfo as b}from"../../../../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}constructor(t,e,o){this._tool=t,this._bounds=e,this._snapRotation=o,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;const r=this._tool,a=r.view,n=!a.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this.rotateManipulator=new g(a,(t,e)=>c(a.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:n})),r.addHandles([this.rotateManipulator.events.on("grab-changed",t=>this._onGrabChanged(t)),this._createRotateDragPipeline(this.rotateManipulator)]),r.manipulators.add(this.rotateManipulator),r.addHandles([r.events.on("rotate-start",t=>this._startAngle=t.angle),r.events.on("rotate",t=>this._endAngle=t.angle),r.events.on("rotate-stop",()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(t){t(this.rotateManipulator,3)}updateManipulators(t,r){const a=this._bounds.mapBounds.plane[2]<0?Math.PI:0,n=e(p.get(),t,a);n[12]=0,n[13]=0,n[14]=0,this.rotateManipulator.modelTransform=n,this.rotateManipulator.renderLocation=o(u.get(),r.origin,r.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){const t=this._rotateTooltipInfo??=new b({sketchOptions:this._tool.sketchOptions});return t.angle=this._startAngle-this._endAngle,t}_onGrabChanged({action:t,screenPoint:e}){const o=this._tool,r=this._bounds;if("start"!==t||!e)return;const a=m(r.displayBounds,o.view.renderCoordsHelper,1,s()),n=_(o.view.state.camera,e);i(a,n,u.get())&&(r.backupMapBounds(),o.inputState={type:"rotate",rotatePlane:a})}_createRotateDragPipeline(e){const{_tool:o,_object:r}=this;return f(e,(e,a,n)=>{const s=o.inputState;null!=s&&(a.next(t=>("start"===t.action&&o.events.emit("rotate-start",{object:r,angle:0}),t)).next(h(o.view,s.rotatePlane)).next(this._renderPlaneToAngle()).next(...this._snapRotation()).next(this._updateGeometry()).next(e=>{const a={object:r,angle:t(e.rotateAngle)};switch(e.action){case"start":case"update":o.events.emit("rotate",a);break;case"end":o.inputState=null,o.events.emit("rotate-stop",a)}return e}),n.next(()=>{null!=o.inputState&&o.events.emit("rotate-stop",{object:r,angle:0}),o.cancelDrag()}))})}_renderPlaneToAngle(){return t=>{const e=d(t.renderStart,t.renderEnd,this._bounds.displayBounds.origin,l(t.plane));return{...t,rotateAngle:e}}}_updateGeometry(){const t=this._bounds;return e=>{const o=r(a(),t.mapBoundsStart.origin),s="start"===e.action?0:1;if(this._operations){const r=this._operations.rotate(o,e.rotateAngle,s,1);n(t.mapBoundsStart,t.mapBounds),t.updateMapBoundsFromOperation(r)}return e}}}export{j as ExtentRotate};
2
+ import{rad2deg as t}from"../../../../../../core/mathUtils.js";import{rotateX as e}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as o,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as n}from"../../../../../../chunks/boundedPlane.js";import{create as s,intersectRay as i,getNormal as l}from"../../../../../../geometry/support/plane.js";import{sm4d as p,sv3d as u}from"../../../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as m}from"../../../../analysis/images/Factory.js";import{createRotatePlane as c}from"../../../../analysis/Slice/sliceToolUtils.js";import{calculateInputRotationTransform as d}from"../../../manipulatorUtils.js";import{screenToRenderPlane as h}from"../../dragEventPipeline3D.js";import{RotateManipulator as g}from"../../../manipulators/RotateManipulator.js";import{fromScreenNormalized as _}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as f}from"../../../../../interactive/dragEventPipeline.js";import{ExtentRotateTooltipInfo as b}from"../../../../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}constructor(t,e,o){this._tool=t,this._bounds=e,this._snapRotation=o,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;const r=this._tool,a=r.view,n=!a.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this.rotateManipulator=new g(a,(t,e)=>m(a.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:n})),r.addHandles([this.rotateManipulator.events.on("grab-changed",t=>this._onGrabChanged(t)),this._createRotateDragPipeline(this.rotateManipulator)]),r.manipulators.add(this.rotateManipulator),r.addHandles([r.events.on("rotate-start",t=>this._startAngle=t.angle),r.events.on("rotate",t=>this._endAngle=t.angle),r.events.on("rotate-stop",()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(t){t(this.rotateManipulator,3)}updateManipulators(t,r){const a=this._bounds.mapBounds.plane[2]<0?Math.PI:0,n=e(p.get(),t,a);n[12]=0,n[13]=0,n[14]=0,this.rotateManipulator.modelTransform=n,this.rotateManipulator.renderLocation=o(u.get(),r.origin,r.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){const t=this._rotateTooltipInfo??=new b({toolOptions:this._tool.toolOptions});return t.angle=this._startAngle-this._endAngle,t}_onGrabChanged({action:t,screenPoint:e}){const o=this._tool,r=this._bounds;if("start"!==t||!e)return;const a=c(r.displayBounds,o.view.renderCoordsHelper,1,s()),n=_(o.view.state.camera,e);i(a,n,u.get())&&(r.backupMapBounds(),o.inputState={type:"rotate",rotatePlane:a})}_createRotateDragPipeline(e){const{_tool:o,_object:r}=this;return f(e,(e,a,n)=>{const s=o.inputState;null!=s&&(a.next(t=>("start"===t.action&&o.events.emit("rotate-start",{object:r,angle:0}),t)).next(h(o.view,s.rotatePlane)).next(this._renderPlaneToAngle()).next(...this._snapRotation()).next(this._updateGeometry()).next(e=>{const a={object:r,angle:t(e.rotateAngle)};switch(e.action){case"start":case"update":o.events.emit("rotate",a);break;case"end":o.inputState=null,o.events.emit("rotate-stop",a)}return e}),n.next(()=>{null!=o.inputState&&o.events.emit("rotate-stop",{object:r,angle:0}),o.cancelDrag()}))})}_renderPlaneToAngle(){return t=>{const e=d(t.renderStart,t.renderEnd,this._bounds.displayBounds.origin,l(t.plane));return{...t,rotateAngle:e}}}_updateGeometry(){const t=this._bounds;return e=>{const o=r(a(),t.mapBoundsStart.origin),s="start"===e.action?0:1;if(this._operations){const r=this._operations.rotate(o,e.rotateAngle,s,1);n(t.mapBoundsStart,t.mapBounds),t.updateMapBoundsFromOperation(r)}return e}}}export{j as ExtentRotate};