@arcgis/core 4.28.0-next.20230621 → 4.28.0-next.20230623

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 (249) hide show
  1. package/Basemap.js +1 -1
  2. package/arcade/ArcadeModuleResolver.js +1 -1
  3. package/arcade/Feature.js +1 -1
  4. package/arcade/arcadeCompiler.js +1 -1
  5. package/arcade/arcadeTimeUtils.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/support/sqlUtils.js +1 -1
  9. package/arcade/functions/date.js +1 -1
  10. package/arcade/functions/geomasync.js +1 -1
  11. package/arcade/functions/geometry.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/functions/string.js +1 -1
  14. package/arcade/languageUtils.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/0380e9f61b6f3ca85139.js +1 -0
  17. package/assets/esri/core/workers/chunks/0bd95f46a0a9005a19f9.js +1 -0
  18. package/assets/esri/core/workers/chunks/0c621046b7211cdde980.js +1 -0
  19. package/assets/esri/core/workers/chunks/0e0267739728e5413f1d.js +1 -0
  20. package/assets/esri/core/workers/chunks/{39079bcfd35ed73c4e34.js → 156e801a3262f0ac79c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/19b4f02fb2392d964582.js +1 -0
  22. package/assets/esri/core/workers/chunks/1ae75f5282e983f6d768.js +1 -0
  23. package/assets/esri/core/workers/chunks/2179b3e9e532ca8ef982.js +1 -0
  24. package/assets/esri/core/workers/chunks/21aaa7fa0e5482670010.js +1 -0
  25. package/assets/esri/core/workers/chunks/26212a08ea383547335b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{2420ec029236ab31d908.js → 2882a55a971af1f7858b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/294285f2822c101326ec.js +1 -0
  28. package/assets/esri/core/workers/chunks/29f9a380610e4fd98a7c.js +1 -0
  29. package/assets/esri/core/workers/chunks/303238fc2fcdbb277981.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3db8ae98799c752afe60.js → 34958516e604d487c625.js} +1 -1
  31. package/assets/esri/core/workers/chunks/3bee743f4c9370045a5d.js +1 -0
  32. package/assets/esri/core/workers/chunks/{8e08968505483dc58e00.js → 40ee4e0a5000a08c3abd.js} +1 -1
  33. package/assets/esri/core/workers/chunks/4128e45e17c9e5280e11.js +1 -0
  34. package/assets/esri/core/workers/chunks/4f88c4d1d2103843aca8.js +1 -0
  35. package/assets/esri/core/workers/chunks/505792ce8cbbddd2e815.js +1 -0
  36. package/assets/esri/core/workers/chunks/{3d42fa4ab5f8632d690a.js → 5237b3938be0d4bc6045.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{57077e608f20d3a931e8.js → 570e94f4fbefc856d303.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{4b235d1b6a72773cd4f4.js → 57bb8516fa998a0fba78.js} +1 -1
  39. package/assets/esri/core/workers/chunks/57bf3ff01d738cedc292.js +1 -0
  40. package/assets/esri/core/workers/chunks/{1e9e68312cd865358260.js → 60486acc5dacf73f851a.js} +1 -1
  41. package/assets/esri/core/workers/chunks/6208f2dfa9dfd3bca000.js +1 -0
  42. package/assets/esri/core/workers/chunks/64008bde5d3ffd9f2499.js +1 -0
  43. package/assets/esri/core/workers/chunks/69f51a7768bf51c9e346.js +1 -0
  44. package/assets/esri/core/workers/chunks/719f741a0e45c3e694ba.js +1 -0
  45. package/assets/esri/core/workers/chunks/{cfe379a78a983373b3ac.js → 7304f45f5622a68253e4.js} +1 -1
  46. package/assets/esri/core/workers/chunks/733b70d6e5c466a67e9c.js +1 -0
  47. package/assets/esri/core/workers/chunks/7694521b44681d52b713.js +1 -0
  48. package/assets/esri/core/workers/chunks/840fd05ceaa038c476d6.js +1 -0
  49. package/assets/esri/core/workers/chunks/89f7fd2ab92aa14fe0c0.js +1 -0
  50. package/assets/esri/core/workers/chunks/8a6f29f2ebd59783bb1b.js +1 -0
  51. package/assets/esri/core/workers/chunks/9d487b7817ccf5bceff6.js +1 -0
  52. package/assets/esri/core/workers/chunks/{42b6315e21c4c1345ba5.js → 9f5337a80963e0b3c009.js} +1 -1
  53. package/assets/esri/core/workers/chunks/a0face18b3ea567999ef.js +1 -0
  54. package/assets/esri/core/workers/chunks/b773c8854e98384ac8ac.js +1 -0
  55. package/assets/esri/core/workers/chunks/{fb44d872b9dbadcf8ccf.js → b9ef05c22bc3e395bcb3.js} +1 -1
  56. package/assets/esri/core/workers/chunks/bc5e34200776cfc83d5b.js +1 -0
  57. package/assets/esri/core/workers/chunks/{cfc3dcca2b69d20d5375.js → c0b9cc091efd5db827de.js} +1 -1
  58. package/assets/esri/core/workers/chunks/c9f5e949830196ad9458.js +1 -0
  59. package/assets/esri/core/workers/chunks/{036301f545aba2b8e485.js → cc15e28a99694120556d.js} +1 -1
  60. package/assets/esri/core/workers/chunks/ce7f575a6c2053c7ca17.js +1 -0
  61. package/assets/esri/core/workers/chunks/ce9c99cee3d1a3963e7c.js +1 -0
  62. package/assets/esri/core/workers/chunks/cf9a87b53ea74bae6a37.js +1 -0
  63. package/assets/esri/core/workers/chunks/d16850b98a53ade0de10.js +1 -0
  64. package/assets/esri/core/workers/chunks/d24f7ef6eca8c91b90b4.js +1 -0
  65. package/assets/esri/core/workers/chunks/dbd86e4b7983873cbe7c.js +1 -0
  66. package/assets/esri/core/workers/chunks/{3c3f65913006b84b2289.js → de20572d334abd4a7d82.js} +1 -1
  67. package/assets/esri/core/workers/chunks/e009e7f074a572894f48.js +1 -0
  68. package/assets/esri/core/workers/chunks/{cb004c492e22c50f9bfa.js → f3eb89cff63e00f036c6.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{b2a423d9ce8bb784267c.js → f53f20c7100092823487.js} +1 -1
  70. package/assets/esri/core/workers/chunks/f6040205c50e2795a1a0.js +1 -0
  71. package/assets/esri/core/workers/chunks/{915734255a79bff3ef0f.js → fcd54e9e64c2864f183c.js} +1 -1
  72. package/assets/esri/t9n/common.json +1 -1
  73. package/assets/esri/t9n/common_en.json +1 -1
  74. package/assets/esri/themes/base/_core.scss +6 -2
  75. package/assets/esri/themes/base/_mixins.scss +0 -147
  76. package/assets/esri/themes/base/widgets/_AreaMeasurement2D.scss +0 -8
  77. package/assets/esri/themes/base/widgets/_AreaMeasurement3D.scss +0 -8
  78. package/assets/esri/themes/base/widgets/_DirectLineMeasurement3D.scss +0 -1
  79. package/assets/esri/themes/base/widgets/_DistanceMeasurement2D.scss +0 -1
  80. package/assets/esri/themes/base/widgets/_MeasurementWidgetContent.scss +67 -0
  81. package/assets/esri/themes/base/widgets/_Slice.scss +17 -54
  82. package/assets/esri/themes/base/widgets/_UnitSelect.scss +14 -0
  83. package/assets/esri/themes/dark/main.css +1 -1
  84. package/assets/esri/themes/light/main.css +1 -1
  85. package/assets/esri/themes/light/view.css +1 -1
  86. package/assets/esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D.json +1 -1
  87. package/assets/esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D_en.json +1 -1
  88. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D.json +1 -1
  89. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_en.json +1 -1
  90. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D.json +1 -1
  91. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_en.json +1 -1
  92. package/assets/esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D.json +1 -1
  93. package/assets/esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D_en.json +1 -1
  94. package/chunks/HUDMaterial.glsl.js +39 -39
  95. package/chunks/HighlightBlur.glsl.js +2 -2
  96. package/chunks/ShadowHighlight.glsl.js +1 -1
  97. package/chunks/arcade.js +1 -1
  98. package/chunks/languageUtils.js +1 -1
  99. package/core/HandleOwner.js +1 -1
  100. package/core/promiseUtils.js +1 -1
  101. package/core/support/{WatchUpdatingTracking.js → UpdatingHandles.js} +1 -1
  102. package/core/workers/workerFactory.js +1 -1
  103. package/geometry/projection.js +1 -1
  104. package/interfaces.d.ts +270 -5
  105. package/kernel.js +1 -1
  106. package/layers/Layer.js +1 -1
  107. package/layers/LinkChartLayer.d.ts +4 -0
  108. package/layers/LinkChartLayer.js +1 -1
  109. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  110. package/layers/mixins/PortalLayer.js +1 -1
  111. package/layers/support/TileInfoTilemapCache.js +1 -1
  112. package/package.json +1 -1
  113. package/support/revision.js +1 -1
  114. package/symbols/cim/cimAnalyzer.js +1 -1
  115. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  116. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  117. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  118. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  119. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  120. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  121. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  122. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  123. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  124. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  125. package/views/3d/environment/CloudsGenerator.js +1 -1
  126. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  127. package/views/3d/environment/Precipitation.js +1 -1
  128. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  129. package/views/3d/environment/Stars.js +1 -1
  130. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  131. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  132. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  133. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  134. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  135. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  136. package/views/3d/layers/I3SMeshView3D.js +1 -1
  137. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  138. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  139. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  140. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  141. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  144. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  145. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  146. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  149. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  151. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  152. package/views/3d/layers/graphics/Labeler.js +1 -1
  153. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  154. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  155. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  156. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  157. package/views/3d/state/ViewState.js +1 -1
  158. package/views/3d/state/ViewStateManager.js +1 -1
  159. package/views/3d/support/DisplayQualityProfile.js +1 -1
  160. package/views/3d/support/MemoryController.js +1 -1
  161. package/views/3d/support/SceneViewPerformanceInfo.js +1 -1
  162. package/views/3d/support/cameraUtils.js +1 -1
  163. package/views/3d/support/viewpointUtils.js +1 -1
  164. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  165. package/views/3d/terrain/OverlayManager.js +1 -1
  166. package/views/3d/terrain/OverlayRenderer.js +1 -1
  167. package/views/3d/terrain/TerrainSurface.js +1 -1
  168. package/views/3d/webgl-engine/Stage.js +1 -1
  169. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  170. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -7
  171. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  172. package/views/3d/webgl-engine/lib/Highlight.js +1 -1
  173. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  174. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  175. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  176. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  177. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  178. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  179. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  180. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  181. package/views/LayerViewManager.js +1 -1
  182. package/views/ToolViewManager.js +1 -1
  183. package/views/draw/DrawOperation.js +1 -1
  184. package/views/draw/PointDrawAction.js +1 -1
  185. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  186. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  187. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  188. package/views/interactive/snapping/featureSources/I3SSnappingSource.js +1 -1
  189. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  190. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  191. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  192. package/views/layers/LayerView.js +1 -1
  193. package/views/overlay/ViewOverlay.js +1 -1
  194. package/views/webgl/Texture.js +1 -1
  195. package/widgets/AreaMeasurement2D.js +1 -1
  196. package/widgets/AreaMeasurement3D.js +1 -1
  197. package/widgets/DirectLineMeasurement3D.js +1 -1
  198. package/widgets/DistanceMeasurement2D.js +1 -1
  199. package/widgets/Editor/EditorViewModel.js +1 -1
  200. package/widgets/Editor/Workflow.js +1 -1
  201. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  202. package/widgets/FeatureForm/FieldInput.js +1 -1
  203. package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +1 -1
  204. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  205. package/widgets/OrientedImageryViewer.js +1 -1
  206. package/widgets/Slice.js +1 -1
  207. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  208. package/widgets/support/MeasurementWidgetContent.js +5 -0
  209. package/widgets/support/UnitSelect.js +5 -0
  210. package/assets/esri/core/workers/chunks/0254165377538522c830.js +0 -1
  211. package/assets/esri/core/workers/chunks/07f16ea775b39a1a4a7b.js +0 -1
  212. package/assets/esri/core/workers/chunks/170c72126d10b1fdb2b0.js +0 -1
  213. package/assets/esri/core/workers/chunks/1bbc868d2430103951eb.js +0 -1
  214. package/assets/esri/core/workers/chunks/1d2ef88a8d028adef102.js +0 -1
  215. package/assets/esri/core/workers/chunks/2ef70c9b2484a11b7435.js +0 -1
  216. package/assets/esri/core/workers/chunks/39ae4b9b766f674bc6f2.js +0 -1
  217. package/assets/esri/core/workers/chunks/3b3d676b609c47a77164.js +0 -1
  218. package/assets/esri/core/workers/chunks/3d9a8cb638cf9b8ca4b3.js +0 -1
  219. package/assets/esri/core/workers/chunks/42f3421740a5479559dc.js +0 -1
  220. package/assets/esri/core/workers/chunks/45629ff775e77234b227.js +0 -1
  221. package/assets/esri/core/workers/chunks/52315f93a6f0ad59bd90.js +0 -1
  222. package/assets/esri/core/workers/chunks/5bb96e602d7cecbecf54.js +0 -1
  223. package/assets/esri/core/workers/chunks/63322229183f1d4eaa70.js +0 -1
  224. package/assets/esri/core/workers/chunks/642510b0371311ff8e16.js +0 -1
  225. package/assets/esri/core/workers/chunks/6995ace1d25d67c98d0e.js +0 -1
  226. package/assets/esri/core/workers/chunks/7e4013f8c31c9a9438c6.js +0 -1
  227. package/assets/esri/core/workers/chunks/82939ead43848a13f765.js +0 -1
  228. package/assets/esri/core/workers/chunks/8b6b963230df56850580.js +0 -1
  229. package/assets/esri/core/workers/chunks/95ff92d7caa34664d58f.js +0 -1
  230. package/assets/esri/core/workers/chunks/9e570cd4a48c30c83ae6.js +0 -1
  231. package/assets/esri/core/workers/chunks/a9e9297267614c4c4f3b.js +0 -1
  232. package/assets/esri/core/workers/chunks/b052463ffb7cb32306dc.js +0 -1
  233. package/assets/esri/core/workers/chunks/b31974524932e638df8c.js +0 -1
  234. package/assets/esri/core/workers/chunks/b75b4b132dbd9cb9d372.js +0 -1
  235. package/assets/esri/core/workers/chunks/c1dfbda75abc748a6ca4.js +0 -1
  236. package/assets/esri/core/workers/chunks/c8702e53a8ad6cf6ab85.js +0 -1
  237. package/assets/esri/core/workers/chunks/c90416e7bf29eb1d4536.js +0 -1
  238. package/assets/esri/core/workers/chunks/cad7a2092ea7f51dbd8b.js +0 -1
  239. package/assets/esri/core/workers/chunks/d0e2b42dca51711f2c6f.js +0 -1
  240. package/assets/esri/core/workers/chunks/d2a127f7bb0e2ba14a13.js +0 -1
  241. package/assets/esri/core/workers/chunks/df96824a6f76bad1370c.js +0 -1
  242. package/assets/esri/core/workers/chunks/e097f41bbfac00250477.js +0 -1
  243. package/assets/esri/core/workers/chunks/e3243d120a23a9b48392.js +0 -1
  244. package/assets/esri/core/workers/chunks/e55f80b774e090a0aa04.js +0 -1
  245. package/assets/esri/core/workers/chunks/e668c7e2e61aae6ca6e0.js +0 -1
  246. package/assets/esri/core/workers/chunks/ef900614353505afb210.js +0 -1
  247. package/assets/esri/core/workers/chunks/f0299d93a95f40ea7cf7.js +0 -1
  248. package/assets/esri/core/workers/chunks/f23b95d7e51a144ad065.js +0 -1
  249. package/assets/esri/core/workers/chunks/f263e73a25fae4beffae.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import r from"../../../core/Accessor.js";import{createTask as s}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import a from"../../../core/Logger.js";import{abortMaybe as o,releaseMaybe as n,disposeMaybe as c}from"../../../core/maybe.js";import{isAbortError as f}from"../../../core/promiseUtils.js";import{initial as u}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{c as p,o as l,m}from"../../../chunks/mat4.js";import{f as g}from"../../../chunks/mat4f64.js";import{WatchUpdatingTracking as _}from"../../../core/support/WatchUpdatingTracking.js";import{StarPassParameters as b,StarsTechnique as y}from"./StarsTechnique.js";import{glLayout as v}from"../support/buffer/glUtil.js";import{newLayout as j}from"../support/buffer/InterleavedLayout.js";import{Default3D as w}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as T}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as k}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as D}from"../../webgl/BufferObject.js";import{PrimitiveType as P,Usage as A}from"../../webgl/enums.js";let x=class extends r{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return null!=this._loadDataTask&&!this._loadDataTask.finished}constructor(t){super(t),this._loadDataTask=null,this._numPoints=0,this._renderParameter=new b,this._updatingTracking=new _}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=o(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=n(this._technique),this._vao=c(this._vao),L=null}render(t){const{rctx:e}=t;if(this._ensureResources(e),null==this._technique||null==this._vao)return;if(!this._technique.compiled)return void this.requestRender();const r=e.bindTechnique(this._technique,this._renderParameter,t.bindParameters);e.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),e.drawArrays(P.POINTS,0,this._numPoints)}_ensureResources(t){if(null!=this._technique||null==L)return;this._technique=new y({rctx:t,viewingMode:this.view.state.viewingMode}),this._numPoints=L.byteLength/I;const e=new Float32Array(L,0,2*this._numPoints),r=new Uint8Array(L,2*this._numPoints*4,this._numPoints);this._vao=this._createVertexArrayObject(t,e,r,this._numPoints),this._updatingTracking.add((()=>"virtual"!==this.view.environment.lighting.type?this.view.environment.lighting.date:null),(t=>this._update(t)),u)}_computeDayDuration(t){const e=t,r=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+r)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+r)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,r=2*this._computeDayDuration(t),s=p(this._renderParameter.modelMatrix,S);l(s,s,-r*Math.PI),m(s,O,s),l(s,s,-e*Math.PI),this.requestRender()}_hexToRGB(t){return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}_unpackUint8Attributes(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}_createVertexArrayObject(t,e,r,s){const i=M.createBuffer(s),a=i.position,o=i.color,n=i.size;for(let c=0;c<s;c++){const t=e[2*c],s=e[2*c+1];a.set(c,0,-Math.cos(t)*Math.sin(s)),a.set(c,1,-Math.sin(t)*Math.sin(s)),a.set(c,2,-Math.cos(s));const i=this._unpackUint8Attributes(r[c]),f=this._hexToRGB(q[i[1]]);o.set(c,0,255*f[0]),o.set(c,1,255*f[1]),o.set(c,2,255*f[2]),o.set(c,3,255),n.set(c,i[0])}return new T(t,w,{geometry:v(M)},{geometry:D.createVertex(t,A.STATIC_DRAW,i.buffer)})}_createLoadDataTask(){if(null!=L)return null;const t=s((async t=>{const{data:r}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});this._verifyStarData(r),L=r}));return t.promise.catch((t=>{f(t)||a.getLogger(this).error(t)})).then((()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))})),t}_verifyStarData(t){if(!t)throw new i("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/I;if(e%1!=0||e>5e4||e<5e3)throw new i("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}};t([h({constructOnly:!0})],x.prototype,"view",void 0),t([h({constructOnly:!0})],x.prototype,"requestRender",void 0),t([h({readOnly:!0})],x.prototype,"updating",null),t([h()],x.prototype,"_loadDataTask",void 0),t([h()],x.prototype,"_updatingTracking",void 0),x=t([d("esri.views.3d.environment.Stars")],x);const q=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],O=g(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),S=g(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),I=9,M=j().vec3f(k.POSITION).vec4u8(k.COLOR).f32(k.SIZE);let L=null;export{x as Stars};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import r from"../../../core/Accessor.js";import{createTask as s}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import a from"../../../core/Logger.js";import{abortMaybe as o,releaseMaybe as n,disposeMaybe as c}from"../../../core/maybe.js";import{isAbortError as f}from"../../../core/promiseUtils.js";import{initial as u}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{c as l,o as p,m}from"../../../chunks/mat4.js";import{f as g}from"../../../chunks/mat4f64.js";import{UpdatingHandles as _}from"../../../core/support/UpdatingHandles.js";import{StarPassParameters as b,StarsTechnique as y}from"./StarsTechnique.js";import{glLayout as v}from"../support/buffer/glUtil.js";import{newLayout as j}from"../support/buffer/InterleavedLayout.js";import{Default3D as w}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as T}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as k}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as D}from"../../webgl/BufferObject.js";import{PrimitiveType as P,Usage as A}from"../../webgl/enums.js";let x=class extends r{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return null!=this._loadDataTask&&!this._loadDataTask.finished}constructor(t){super(t),this._loadDataTask=null,this._numPoints=0,this._renderParameter=new b,this._updatingTracking=new _}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=o(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=n(this._technique),this._vao=c(this._vao),L=null}render(t){const{rctx:e}=t;if(this._ensureResources(e),null==this._technique||null==this._vao)return;if(!this._technique.compiled)return void this.requestRender();const r=e.bindTechnique(this._technique,this._renderParameter,t.bindParameters);e.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),e.drawArrays(P.POINTS,0,this._numPoints)}_ensureResources(t){if(null!=this._technique||null==L)return;this._technique=new y({rctx:t,viewingMode:this.view.state.viewingMode}),this._numPoints=L.byteLength/I;const e=new Float32Array(L,0,2*this._numPoints),r=new Uint8Array(L,2*this._numPoints*4,this._numPoints);this._vao=this._createVertexArrayObject(t,e,r,this._numPoints),this._updatingTracking.add((()=>"virtual"!==this.view.environment.lighting.type?this.view.environment.lighting.date:null),(t=>this._update(t)),u)}_computeDayDuration(t){const e=t,r=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+r)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+r)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,r=2*this._computeDayDuration(t),s=l(this._renderParameter.modelMatrix,S);p(s,s,-r*Math.PI),m(s,O,s),p(s,s,-e*Math.PI),this.requestRender()}_hexToRGB(t){return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}_unpackUint8Attributes(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}_createVertexArrayObject(t,e,r,s){const i=M.createBuffer(s),a=i.position,o=i.color,n=i.size;for(let c=0;c<s;c++){const t=e[2*c],s=e[2*c+1];a.set(c,0,-Math.cos(t)*Math.sin(s)),a.set(c,1,-Math.sin(t)*Math.sin(s)),a.set(c,2,-Math.cos(s));const i=this._unpackUint8Attributes(r[c]),f=this._hexToRGB(q[i[1]]);o.set(c,0,255*f[0]),o.set(c,1,255*f[1]),o.set(c,2,255*f[2]),o.set(c,3,255),n.set(c,i[0])}return new T(t,w,{geometry:v(M)},{geometry:D.createVertex(t,A.STATIC_DRAW,i.buffer)})}_createLoadDataTask(){if(null!=L)return null;const t=s((async t=>{const{data:r}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});this._verifyStarData(r),L=r}));return t.promise.catch((t=>{f(t)||a.getLogger(this).error(t)})).then((()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))})),t}_verifyStarData(t){if(!t)throw new i("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/I;if(e%1!=0||e>5e4||e<5e3)throw new i("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}};t([h({constructOnly:!0})],x.prototype,"view",void 0),t([h({constructOnly:!0})],x.prototype,"requestRender",void 0),t([h({readOnly:!0})],x.prototype,"updating",null),t([h()],x.prototype,"_loadDataTask",void 0),t([h()],x.prototype,"_updatingTracking",void 0),x=t([d("esri.views.3d.environment.Stars")],x);const q=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],O=g(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),S=g(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),I=9,M=j().vec3f(k.POSITION).vec4u8(k.COLOR).f32(k.SIZE);let L=null;export{x as Stars};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as c}from"../../../../../core/support/WatchUpdatingTracking.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as m,getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as f}from"../isSupportedGraphicUtils.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as _}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{DISC_RADIUS as w}from"../manipulations/config.js";import{ManipulationType as j,MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{shapeOrientation as x,axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as E}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as T}from"./isSupportedGraphic.js";import{OutlineVisualElement as H}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as U,resetGraphicMany as D}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as X}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as G}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import A from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as z}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as P}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as k,TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as R}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";class C{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class V{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class L{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const N="manipulators";let q=class extends(e.EventedMixin(X)){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new A,this.type="move-3d",this._updatingHandles=new c,this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),r((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new P({view:t}):a(this._tooltip)}),p)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=a(this._tooltip),this._moveManipulation=a(this._moveManipulation),this.removeAllHandles(),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(T(e)!==f.SUPPORTED)continue;const t=new B(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(_(t.state),i)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new E({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new k({tooltipOptions:i}):e.clear())}))],N))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,j.XY,i,e,o,a))),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new b({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?b.radiusForSymbol(t[0].graphic.symbol):w});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),N)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),N)};this._moveManipulation.xyManipulation.forEachManipulator(e(j.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(j.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(j.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),r((()=>n.state.displaying),o)],N);const a=t[t.length-1];this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),N),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),m(a.graphic),a.graphic.geometry.spatialReference,a.graphic),N),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,a=y({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>o()});null!=a&&(i.geometryRepresentation=a.visualElement,i.geometryRepresentation instanceof H&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),r((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],N),this.addHandles(a,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=x(t.graphic.geometry))}_updateMoveManipulation(t){const i=u(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&M(t)&&(o=!0);const n=a.geometryRepresentation instanceof H&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:g(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const h=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===j.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,m(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new L(r)),this.destroyed||h(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=U(r,this.view.state.viewingMode),l=D(r),this.emit("graphic-move-start",new C(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new V(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new L(r)),this.destroyed)return null;h()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const s=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case j.XY:a.info=new k({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>F(t,i,s)));break;case j.XY_AXIS:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=F(t,i,s);return n(o,S(e))}));break;case j.Z:a.info=new I({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:s}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new Y({elevationInfo:i,pointer:a,editGeometryOperations:G.fromGeometry(s,this.view.state.viewingMode),visualizer:new v,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:h}=z({snappingContext:r,snappingManager:p,updatingHandles:this._updatingHandles});return o=o.next(h),{steps:e=e.next((i=>{s.z=d(this.view,s,m(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"view",void 0),t([l()],q.prototype,"graphics",void 0),t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"enableZ",void 0),t([l({constructOnly:!0,type:A})],q.prototype,"tooltipOptions",void 0),t([l({constructOnly:!0})],q.prototype,"snappingManager",void 0),t([l()],q.prototype,"type",void 0),t([l()],q.prototype,"updating",null),q=t([h("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],q);class B{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new O({graphic:t})}get graphic(){return this.state.graphic}}export{V as GraphicMoveEvent,C as GraphicMoveStartEvent,L as GraphicMoveStopEvent,q as GraphicMoveTool};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as m,getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as f}from"../isSupportedGraphicUtils.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as _}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{DISC_RADIUS as w}from"../manipulations/config.js";import{ManipulationType as j,MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{shapeOrientation as x,axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as E}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as T}from"./isSupportedGraphic.js";import{OutlineVisualElement as H}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as U,resetGraphicMany as D}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as X}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as G}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import A from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as z}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as P}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as k,TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as R}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";class C{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class V{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class L{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const N="manipulators";let q=class extends(e.EventedMixin(X)){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new A,this.type="move-3d",this._updatingHandles=new c,this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),r((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new P({view:t}):a(this._tooltip)}),p)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=a(this._tooltip),this._moveManipulation=a(this._moveManipulation),this.removeAllHandles(),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(T(e)!==f.SUPPORTED)continue;const t=new B(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(_(t.state),i)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new E({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new k({tooltipOptions:i}):e.clear())}))],N))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,j.XY,i,e,o,a))),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new b({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?b.radiusForSymbol(t[0].graphic.symbol):w});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),N)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),N)};this._moveManipulation.xyManipulation.forEachManipulator(e(j.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(j.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(j.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),r((()=>n.state.displaying),o)],N);const a=t[t.length-1];this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),N),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),m(a.graphic),a.graphic.geometry.spatialReference,a.graphic),N),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,a=y({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>o()});null!=a&&(i.geometryRepresentation=a.visualElement,i.geometryRepresentation instanceof H&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),r((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],N),this.addHandles(a,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=x(t.graphic.geometry))}_updateMoveManipulation(t){const i=u(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&M(t)&&(o=!0);const n=a.geometryRepresentation instanceof H&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:g(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const h=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===j.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,m(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new L(r)),this.destroyed||h(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=U(r,this.view.state.viewingMode),l=D(r),this.emit("graphic-move-start",new C(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new V(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new L(r)),this.destroyed)return null;h()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const s=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case j.XY:a.info=new k({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>F(t,i,s)));break;case j.XY_AXIS:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=F(t,i,s);return n(o,S(e))}));break;case j.Z:a.info=new I({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:s}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new Y({elevationInfo:i,pointer:a,editGeometryOperations:G.fromGeometry(s,this.view.state.viewingMode),visualizer:new v,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:h}=z({snappingContext:r,snappingManager:p,updatingHandles:this._updatingHandles});return o=o.next(h),{steps:e=e.next((i=>{s.z=d(this.view,s,m(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"view",void 0),t([l()],q.prototype,"graphics",void 0),t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"enableZ",void 0),t([l({constructOnly:!0,type:A})],q.prototype,"tooltipOptions",void 0),t([l({constructOnly:!0})],q.prototype,"snappingManager",void 0),t([l()],q.prototype,"type",void 0),t([l()],q.prototype,"updating",null),q=t([h("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],q);class B{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new O({graphic:t})}get graphic(){return this.state.graphic}}export{V as GraphicMoveEvent,C as GraphicMoveStartEvent,L as GraphicMoveStopEvent,q as GraphicMoveTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import a from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as r,destroyHandle as s}from"../../../../../core/handleUtils.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{zeroMeters as h,scale as d,createLength as u}from"../../../../../core/quantityUtils.js";import{watch as c,when as m,initial as g}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as _}from"../../../../../core/unitUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as M}from"../../../../../chunks/mat4f64.js";import{l as y,b as x,h as O,s as b,a as E,g as G}from"../../../../../chunks/vec3.js";import{f as S,c as w}from"../../../../../chunks/vec3f64.js";import{WatchUpdatingTracking as I}from"../../../../../core/support/WatchUpdatingTracking.js";import V from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as H}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as A}from"../../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as j}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as N,placeAtGraphic as C}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as R}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as F}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as z,convertToMapCoordinates as X,screenToMapXYAtLocation as Z,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{ManipulatorType as q}from"../ManipulatorType.js";import{canMoveZ as W}from"../manipulatorUtils.js";import{getSettings as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as ne,edgeOffsetRotationMatrix as oe,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as fe,ManipulatorStateCustomFlags as ve}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as Me}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as ye}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as xe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as be}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Ee}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ge,TranslateGraphicXYTooltipInfo as Se,TranslateGraphicTooltipInfo as we,TranslateVertexZTooltipInfo as Ie,TranslateVertexXYTooltipInfo as Ve,TranslateVertexTooltipInfo as He}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as Ae}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Te,autoLengthByElevationMode as De}from"../../../../support/automaticLengthMeasurementUtils.js";import{unitRGBAFromColor as Le}from"../../../../support/colorUtils.js";import{verticalSignedDistanceBetweenPoints as je,elevationOfPoint as Pe}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ue}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ne from"../../../../../geometry/SpatialReference.js";let Ce=class extends(a.EventedMixin(t)){constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Ye.NONE,this._updatingHandles=new I,this._recreatingManipulators=!1,this.outputGeometry=null,this._vertexLaserLineVisualElement=null;const t=K(e.tool.view).manipulators,i=t.vertex;this._vertexManipulatorMaterial=U(Le(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=N(Le(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=N(Le(i.hoverOutlineColor),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=U(Le(a.color),a.renderOccluded),this._edgeManipulatorOutlineMaterial=N(Le(a.outlineColor),a.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=U(Le(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(Le(o.hoverColor),o.renderOccluded,!1);const r=t.selected;this._selectedManipulatorMaterial=U(Le(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=N(Le(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=N(Le(r.hoverOutlineColor),r.renderOccluded)}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new Ee({view:t}),this.addHandles([c((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),c((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),g),m((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),g),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=l(this._segmentLabels),this._tooltip=l(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._graphicMoveManipulation=l(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._editGeometryOperations)return;const t=L(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createGraphicMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const e=this._editGeometryOperations.redo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const e=this._editGeometryOperations.undo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(e){const t={byComponentIndex:new Map};if(null!=e&&null!=this.inputGeometry&&H(e,this.inputGeometry))for(const a of this._manipulatorInfos)if("vertex"===a.type&&a.manipulator.selected){const{index:e,component:{index:i}}=a.handle,{byComponentIndex:n}=t,o=n.get(i)||new Set;o.add(e),n.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=l(this._editGeometryOperations),this._segmentLabels=l(this._segmentLabels),null==e)return void(this._recreatingManipulators=!1);const i="mesh"===e.type?e.anchor:e;this._editGeometryOperations=Me.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(t),this._segmentLabels=new R({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===qe.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Ye.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Ye.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Ye.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,ye.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Ye.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Ye.MOVING:switch(this._reshapeEventState){case Ye.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Ye.RESHAPING:switch(this._reshapeEventState){case Ye.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ie({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=this._editGeometryOperations.createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(qe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=p(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=p(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new $({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(o(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=t.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,r,s)=>{const{snappingStep:l,cancelSnapping:p}=Oe({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new xe({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(p),{steps:o=o.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===q.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ue(this.view,e,t)).next(...l).next(ce()).next((e=>this._perGraphicManipulatorDragAction(qe.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(a,e),e))),cancel:r}}),e,r,t),c((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),g),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),c((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),g)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,q.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=K(this.view).manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,r=a/n,s=r*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=pe(this._edgeOffsetManipulatorMaterial,s,r/2,r/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=pe(this._edgeOffsetManipulatorMaterial,-s,r/2,r/2,i.height,-i.offset));const l=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),fe.Unfocused),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),fe.Focused),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),fe.Unfocused),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),fe.Focused)],p=new P({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==t.mode||j(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:S(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new P({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const o of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(o);null!=e&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=o(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(me(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(me(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ge(this.view,e.elevationAlignedLocation)).next(Z(this.view,e.elevationAlignedLocation,t,o,n)).next(_e()).next(ce()).next((e=>this._perGraphicManipulatorDragAction(qe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new be({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=s&&re(n.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),r((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r((()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._editGeometryOperations.data,i=ae(this.view,e.manipulator.elevationAlignedLocation,ne(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,r=n.manipulator.renderLocation,s=null!=i?oe(i,o,r):M;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const l=y(x(ze,o,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ge(this.view,i.elevationAlignedLocation)).next(o).next(z(this.view)).next(X(this.view,this._editGeometryOperations.data.spatialReference)).next(ce()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),n.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const{view:i}=this,a=this._editGeometryOperations,n=ne(a.data.coordinateHelper,e.handle,t),r=a.createUndoGroup(),l=ae(i,e.manipulator.elevationAlignedLocation,n);if(n.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(n.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}const h=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),d=K(i),u=new se({view:i,isDraped:this._graphicState.isDraped,geometry:h(),elevationInfo:e.elevationInfo,width:d.visualElements.lineGraphics.outline.width,color:Le(d.colors.accent),attached:!0,isDecoration:!0});let m;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=p(m)},_=this.on("undo",g);return m=o([s(u),c((()=>this._graphicState.isDraped),(e=>u.isDraped=e)),this._graphicState.on("changed",(()=>u.geometry=h())),r,_]),{step:e=>null==n||null==l?(g(),null):{...e,operation:n,plane:l},cleanup:g}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||null==t.operation)return t;this._updateEventState(Ye.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,n=this._tooltip,o=this._tooltipOptions;if(!o.enabled||null==i)return n.clear(),e;let r=n.info;null!=r&&"reshape-edge-offset"===r.type||(r=n.info=new be({tooltipOptions:o}));const{coordinateHelper:s}=this._editGeometryOperations.data;return r.distance="end"===e.action?h:Re(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,s),this._updateTooltipAreaOrTotalLength(r),e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,r=[];if(t&&o.distance(t.pos,i.pos)<Xe){const e=this._getManipulatorInfoFromHandle(i);null!=e&&r.push(e)}if(o.distance(i.pos,n.pos)<Xe||a&&o.distance(a.pos,n.pos)<Xe){const e=this._getManipulatorInfoFromHandle(n);null!=e&&r.push(e)}r.length&&this._removeVertices(r)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=L(this.graphic),i=!1){const{view:a}=this,n=K(a);if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=he(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=he(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=he(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=he(this._edgeManipulatorOutlineMaterial,t,16,16)}const{geometry:r}=this.graphic,s=r?.type,l="point"===s||"mesh"===s?[]:[new k(this._vertexManipulatorGeometry.instantiate(),Ze.Vertex|fe.Unselected),new k(this._vertexManipulatorOutlineGeometry.instantiate(),Ze.Vertex|fe.Unfocused|fe.Unselected),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ze.Vertex|fe.Focused|fe.Unselected),new k(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),fe.Selected),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),fe.Selected|fe.Unfocused),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),fe.Selected|fe.Focused)];this.enableMidpoints&&l.push(new k(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Ze.Edge|fe.Focused|fe.Unselected),new k(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ze.Edge|fe.Focused|fe.Unselected),new k(this._edgeManipulatorGeometry.instantiate(),Ze.Edge|fe.Unfocused|fe.Unselected),new k(this._edgeManipulatorOutlineGeometry.instantiate(),Ze.Edge|fe.Unfocused|fe.Unselected));const h=new P({view:a,renderObjects:l,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const d="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(h),this._updateManipulatorPosition(d),"edge"===d.type){const e=[];for(const t of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=o(e),this._manipulatorHandles.add(d.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const u=me(h,((e,i,a,n)=>{let o=null;const{snappingStep:r,cancelSnapping:s}=Oe({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new xe({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>o=p(o))),t))).next(s),i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const t=this._splitEdgeManipulator(d);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:d,snapOrigin:d.handle.pos}})).next(ge(this.view,e.elevationAlignedLocation)).next(Y(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(ue(this.view,t,this.graphic)).next(...r).next(ce()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(o=p(o)),this._updateTranslateVertexTooltip(e,Q.XY,t)}))}));return this._manipulatorHandles.add([u,h.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,d))),h.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),h.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==d.type?this._updateTranslateVertexTooltip(h,Q.XY):this._tooltip.clear()}))],h),this.emit("manipulators-changed"),d}_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.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Ye.NONE:break;case Ye.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(Ye.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const{graphic:a,view:n}=this,o=K(n);switch(t.type){case"vertex":{e.state=Ze.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=o.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const{geometry:r}=a,s=r?.type;e.interactive=null!=s&&"point"!==s&&"mesh"!==s;break}case"edge":{e.state=Ze.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=o.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||j(a.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Ye.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,{geometry:i}=this.graphic,a=i?.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.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.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(null==e)return;const t=this._editGeometryOperations;if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Fe),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(null!=e.manipulator.elevationInfo&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=n.location,a=o.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else O(ze,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=ze}}_splitEdgeManipulator(e,t=.5){const i=this._editGeometryOperations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=L(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Ye.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:a.index}],added:s}),r&&this._updateEventState(Ye.NONE),o}_updateMoveManipulationPosition(){const e=b(ze,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(t++,E(e,e,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===t){const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&W(this.graphic),this._moveManipulation.angle=ee(this.graphic.geometry),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol)}else{const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=ke(t,e):o&&(i=ke(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=J}0!==t&&i?(G(e,e,1/t),Fe.spatialReference=this._editGeometryOperations.data.spatialReference,Fe.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Fe),this._moveManipulation.elevationAlignedLocation=Fe):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._editGeometryOperations;for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=i.removeVertices([a.handle]),n=e.removedVertices?.[0].createdEdge;n&&this._createVertexOrEdgeManipulator(n)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Ye.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(Ye.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?ye.NEW_STEP:ye.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(null==t.operation||null==t.signedDistance)return;const i=this._editGeometryOperations,a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,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,e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case Q.XY:this._tooltip.info=new we({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Te(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const n=Te(e,i,a);return d(n,te(t))}));break;case Q.Z:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,je)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let n;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:n=new He({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>Te(e,t,o))),this._updateTooltipAreaOrTotalLength(n);break;case Q.XY_AXIS:n=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>{const a=Te(e,t,o);return d(a,te(i))})),this._updateTooltipAreaOrTotalLength(n);break;case Q.Z:n=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,je)}const r=Pe(e.elevationAlignedLocation);null!=r&&(n.elevation={mode:"absolute-height",...r}),this._tooltip.info=n}_updateTranslateTooltipDistance(e,t,i){if(null!=t&&"end"!==t.action){const{mapStart:a,mapEnd:n}=t,o=i(a,n);e.distance=null!=o?o:h}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(null==t)return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?Ae(t,i):null,e.totalLength="polyline"===t.type?De(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function ke(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Re(e,t,i,a,n){if(e){const e=n.toXYZ(n.pointToVector(i)),o=A(a,e,T.get()),r=Ue(o,e,n.spatialReference);if(null!=r)return u(r.value*Math.sign(t),r.unit)}return u(t*_(i.spatialReference),"meters")}e([f()],Ce.prototype,"_editGeometryOperations",void 0),e([f()],Ce.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],Ce.prototype,"tool",void 0),e([f()],Ce.prototype,"_tooltip",void 0),e([f()],Ce.prototype,"inputGeometry",null),e([f()],Ce.prototype,"outputGeometry",void 0),e([f({readOnly:!0})],Ce.prototype,"updating",null),e([f()],Ce.prototype,"manipulators",null),e([f()],Ce.prototype,"view",null),e([f()],Ce.prototype,"graphic",null),e([f()],Ce.prototype,"enableZShape",null),e([f()],Ce.prototype,"enableZVertex",null),e([f()],Ce.prototype,"enableMoveGraphic",null),e([f()],Ce.prototype,"enableMidpoints",null),e([f()],Ce.prototype,"enableEdgeOffset",null),e([f()],Ce.prototype,"_labelOptions",null),e([f()],Ce.prototype,"_tooltipOptions",null),Ce=e([v("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Ce);const Fe=D(0,0,void 0,Ne.WGS84),ze=w(),Xe=1e-6;var Ze,Ye,qe;!function(e){e.Vertex=ve.Custom1,e.Edge=ve.Custom2}(Ze||(Ze={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Ye||(Ye={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(qe||(qe={}));export{Ce as ReshapeOperation};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import a from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as r,destroyHandle as s}from"../../../../../core/handleUtils.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{zeroMeters as h,scale as d,createLength as u}from"../../../../../core/quantityUtils.js";import{watch as c,when as m,initial as g}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as _}from"../../../../../core/unitUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as M}from"../../../../../chunks/mat4f64.js";import{l as y,b as x,h as O,s as b,a as E,g as G}from"../../../../../chunks/vec3.js";import{f as S,c as w}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as I}from"../../../../../core/support/UpdatingHandles.js";import V from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as H}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as A}from"../../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as j}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as N,placeAtGraphic as C}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as R}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as F}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as z,convertToMapCoordinates as X,screenToMapXYAtLocation as Z,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{ManipulatorType as q}from"../ManipulatorType.js";import{canMoveZ as W}from"../manipulatorUtils.js";import{getSettings as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as ne,edgeOffsetRotationMatrix as oe,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as fe,ManipulatorStateCustomFlags as ve}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as Me}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as ye}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as xe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as be}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Ee}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ge,TranslateGraphicXYTooltipInfo as Se,TranslateGraphicTooltipInfo as we,TranslateVertexZTooltipInfo as Ie,TranslateVertexXYTooltipInfo as Ve,TranslateVertexTooltipInfo as He}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as Ae}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Te,autoLengthByElevationMode as De}from"../../../../support/automaticLengthMeasurementUtils.js";import{unitRGBAFromColor as Le}from"../../../../support/colorUtils.js";import{verticalSignedDistanceBetweenPoints as je,elevationOfPoint as Pe}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ue}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ne from"../../../../../geometry/SpatialReference.js";let Ce=class extends(a.EventedMixin(t)){constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Ye.NONE,this._updatingHandles=new I,this._recreatingManipulators=!1,this.outputGeometry=null,this._vertexLaserLineVisualElement=null;const t=K(e.tool.view).manipulators,i=t.vertex;this._vertexManipulatorMaterial=U(Le(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=N(Le(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=N(Le(i.hoverOutlineColor),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=U(Le(a.color),a.renderOccluded),this._edgeManipulatorOutlineMaterial=N(Le(a.outlineColor),a.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=U(Le(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(Le(o.hoverColor),o.renderOccluded,!1);const r=t.selected;this._selectedManipulatorMaterial=U(Le(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=N(Le(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=N(Le(r.hoverOutlineColor),r.renderOccluded)}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new Ee({view:t}),this.addHandles([c((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),c((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),g),m((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),g),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=l(this._segmentLabels),this._tooltip=l(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._graphicMoveManipulation=l(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._editGeometryOperations)return;const t=L(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createGraphicMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const e=this._editGeometryOperations.redo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const e=this._editGeometryOperations.undo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(e){const t={byComponentIndex:new Map};if(null!=e&&null!=this.inputGeometry&&H(e,this.inputGeometry))for(const a of this._manipulatorInfos)if("vertex"===a.type&&a.manipulator.selected){const{index:e,component:{index:i}}=a.handle,{byComponentIndex:n}=t,o=n.get(i)||new Set;o.add(e),n.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=l(this._editGeometryOperations),this._segmentLabels=l(this._segmentLabels),null==e)return void(this._recreatingManipulators=!1);const i="mesh"===e.type?e.anchor:e;this._editGeometryOperations=Me.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(t),this._segmentLabels=new R({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===qe.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Ye.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Ye.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Ye.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,ye.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Ye.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Ye.MOVING:switch(this._reshapeEventState){case Ye.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Ye.RESHAPING:switch(this._reshapeEventState){case Ye.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ie({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=this._editGeometryOperations.createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(qe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=p(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=p(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new $({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(o(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=t.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,r,s)=>{const{snappingStep:l,cancelSnapping:p}=Oe({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new xe({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(p),{steps:o=o.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===q.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ue(this.view,e,t)).next(...l).next(ce()).next((e=>this._perGraphicManipulatorDragAction(qe.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(a,e),e))),cancel:r}}),e,r,t),c((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),g),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),c((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),g)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,q.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=K(this.view).manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,r=a/n,s=r*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=pe(this._edgeOffsetManipulatorMaterial,s,r/2,r/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=pe(this._edgeOffsetManipulatorMaterial,-s,r/2,r/2,i.height,-i.offset));const l=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),fe.Unfocused),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),fe.Focused),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),fe.Unfocused),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),fe.Focused)],p=new P({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==t.mode||j(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:S(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new P({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const o of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(o);null!=e&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=o(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(me(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(me(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ge(this.view,e.elevationAlignedLocation)).next(Z(this.view,e.elevationAlignedLocation,t,o,n)).next(_e()).next(ce()).next((e=>this._perGraphicManipulatorDragAction(qe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new be({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=s&&re(n.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),r((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r((()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._editGeometryOperations.data,i=ae(this.view,e.manipulator.elevationAlignedLocation,ne(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,r=n.manipulator.renderLocation,s=null!=i?oe(i,o,r):M;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const l=y(x(ze,o,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ge(this.view,i.elevationAlignedLocation)).next(o).next(z(this.view)).next(X(this.view,this._editGeometryOperations.data.spatialReference)).next(ce()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),n.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const{view:i}=this,a=this._editGeometryOperations,n=ne(a.data.coordinateHelper,e.handle,t),r=a.createUndoGroup(),l=ae(i,e.manipulator.elevationAlignedLocation,n);if(n.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(n.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}const h=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),d=K(i),u=new se({view:i,isDraped:this._graphicState.isDraped,geometry:h(),elevationInfo:e.elevationInfo,width:d.visualElements.lineGraphics.outline.width,color:Le(d.colors.accent),attached:!0,isDecoration:!0});let m;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=p(m)},_=this.on("undo",g);return m=o([s(u),c((()=>this._graphicState.isDraped),(e=>u.isDraped=e)),this._graphicState.on("changed",(()=>u.geometry=h())),r,_]),{step:e=>null==n||null==l?(g(),null):{...e,operation:n,plane:l},cleanup:g}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||null==t.operation)return t;this._updateEventState(Ye.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,n=this._tooltip,o=this._tooltipOptions;if(!o.enabled||null==i)return n.clear(),e;let r=n.info;null!=r&&"reshape-edge-offset"===r.type||(r=n.info=new be({tooltipOptions:o}));const{coordinateHelper:s}=this._editGeometryOperations.data;return r.distance="end"===e.action?h:Re(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,s),this._updateTooltipAreaOrTotalLength(r),e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,r=[];if(t&&o.distance(t.pos,i.pos)<Xe){const e=this._getManipulatorInfoFromHandle(i);null!=e&&r.push(e)}if(o.distance(i.pos,n.pos)<Xe||a&&o.distance(a.pos,n.pos)<Xe){const e=this._getManipulatorInfoFromHandle(n);null!=e&&r.push(e)}r.length&&this._removeVertices(r)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=L(this.graphic),i=!1){const{view:a}=this,n=K(a);if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=he(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=he(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=he(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=he(this._edgeManipulatorOutlineMaterial,t,16,16)}const{geometry:r}=this.graphic,s=r?.type,l="point"===s||"mesh"===s?[]:[new k(this._vertexManipulatorGeometry.instantiate(),Ze.Vertex|fe.Unselected),new k(this._vertexManipulatorOutlineGeometry.instantiate(),Ze.Vertex|fe.Unfocused|fe.Unselected),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ze.Vertex|fe.Focused|fe.Unselected),new k(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),fe.Selected),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),fe.Selected|fe.Unfocused),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),fe.Selected|fe.Focused)];this.enableMidpoints&&l.push(new k(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Ze.Edge|fe.Focused|fe.Unselected),new k(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ze.Edge|fe.Focused|fe.Unselected),new k(this._edgeManipulatorGeometry.instantiate(),Ze.Edge|fe.Unfocused|fe.Unselected),new k(this._edgeManipulatorOutlineGeometry.instantiate(),Ze.Edge|fe.Unfocused|fe.Unselected));const h=new P({view:a,renderObjects:l,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const d="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(h),this._updateManipulatorPosition(d),"edge"===d.type){const e=[];for(const t of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=o(e),this._manipulatorHandles.add(d.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const u=me(h,((e,i,a,n)=>{let o=null;const{snappingStep:r,cancelSnapping:s}=Oe({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new xe({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>o=p(o))),t))).next(s),i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const t=this._splitEdgeManipulator(d);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:d,snapOrigin:d.handle.pos}})).next(ge(this.view,e.elevationAlignedLocation)).next(Y(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(ue(this.view,t,this.graphic)).next(...r).next(ce()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(o=p(o)),this._updateTranslateVertexTooltip(e,Q.XY,t)}))}));return this._manipulatorHandles.add([u,h.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,d))),h.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),h.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==d.type?this._updateTranslateVertexTooltip(h,Q.XY):this._tooltip.clear()}))],h),this.emit("manipulators-changed"),d}_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.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Ye.NONE:break;case Ye.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Ye.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(Ye.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const{graphic:a,view:n}=this,o=K(n);switch(t.type){case"vertex":{e.state=Ze.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=o.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const{geometry:r}=a,s=r?.type;e.interactive=null!=s&&"point"!==s&&"mesh"!==s;break}case"edge":{e.state=Ze.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=o.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||j(a.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Ye.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,{geometry:i}=this.graphic,a=i?.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.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.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(null==e)return;const t=this._editGeometryOperations;if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Fe),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(null!=e.manipulator.elevationInfo&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=n.location,a=o.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else O(ze,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=ze}}_splitEdgeManipulator(e,t=.5){const i=this._editGeometryOperations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=L(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Ye.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:a.index}],added:s}),r&&this._updateEventState(Ye.NONE),o}_updateMoveManipulationPosition(){const e=b(ze,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(t++,E(e,e,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===t){const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&W(this.graphic),this._moveManipulation.angle=ee(this.graphic.geometry),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol)}else{const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=ke(t,e):o&&(i=ke(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=J}0!==t&&i?(G(e,e,1/t),Fe.spatialReference=this._editGeometryOperations.data.spatialReference,Fe.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Fe),this._moveManipulation.elevationAlignedLocation=Fe):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._editGeometryOperations;for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=i.removeVertices([a.handle]),n=e.removedVertices?.[0].createdEdge;n&&this._createVertexOrEdgeManipulator(n)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Ye.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(Ye.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?ye.NEW_STEP:ye.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(null==t.operation||null==t.signedDistance)return;const i=this._editGeometryOperations,a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,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,e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case Q.XY:this._tooltip.info=new we({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Te(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const n=Te(e,i,a);return d(n,te(t))}));break;case Q.Z:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,je)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let n;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:n=new He({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>Te(e,t,o))),this._updateTooltipAreaOrTotalLength(n);break;case Q.XY_AXIS:n=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>{const a=Te(e,t,o);return d(a,te(i))})),this._updateTooltipAreaOrTotalLength(n);break;case Q.Z:n=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,je)}const r=Pe(e.elevationAlignedLocation);null!=r&&(n.elevation={mode:"absolute-height",...r}),this._tooltip.info=n}_updateTranslateTooltipDistance(e,t,i){if(null!=t&&"end"!==t.action){const{mapStart:a,mapEnd:n}=t,o=i(a,n);e.distance=null!=o?o:h}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(null==t)return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?Ae(t,i):null,e.totalLength="polyline"===t.type?De(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function ke(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Re(e,t,i,a,n){if(e){const e=n.toXYZ(n.pointToVector(i)),o=A(a,e,T.get()),r=Ue(o,e,n.spatialReference);if(null!=r)return u(r.value*Math.sign(t),r.unit)}return u(t*_(i.spatialReference),"meters")}e([f()],Ce.prototype,"_editGeometryOperations",void 0),e([f()],Ce.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],Ce.prototype,"tool",void 0),e([f()],Ce.prototype,"_tooltip",void 0),e([f()],Ce.prototype,"inputGeometry",null),e([f()],Ce.prototype,"outputGeometry",void 0),e([f({readOnly:!0})],Ce.prototype,"updating",null),e([f()],Ce.prototype,"manipulators",null),e([f()],Ce.prototype,"view",null),e([f()],Ce.prototype,"graphic",null),e([f()],Ce.prototype,"enableZShape",null),e([f()],Ce.prototype,"enableZVertex",null),e([f()],Ce.prototype,"enableMoveGraphic",null),e([f()],Ce.prototype,"enableMidpoints",null),e([f()],Ce.prototype,"enableEdgeOffset",null),e([f()],Ce.prototype,"_labelOptions",null),e([f()],Ce.prototype,"_tooltipOptions",null),Ce=e([v("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Ce);const Fe=D(0,0,void 0,Ne.WGS84),ze=w(),Xe=1e-6;var Ze,Ye,qe;!function(e){e.Vertex=ve.Custom1,e.Edge=ve.Custom2}(Ze||(Ze={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Ye||(Ye={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(qe||(qe={}));export{Ce as ReshapeOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as h}from"../../../../../core/support/WatchUpdatingTracking.js";import u from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as g}from"../../Manipulator3D.js";import{placeAtGraphic as v}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as _}from"../../SnappingVisualizer3D.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as S}from"../manipulations/config.js";import{MoveManipulation as R,ManipulationType as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as b}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as j}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as A}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as T}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as x}from"./undoRecords.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as G}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as U}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import H from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as k}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as C,TranslateGraphicTooltipInfo as L}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Z}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as X}from"../../../../support/euclideanLengthMeasurementUtils.js";let F=class extends(i.EventedMixin(G)){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new H,this.type="transform-3d",this._updatingHandles=new h,this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:i}=this;this.graphicState=new O({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new k({view:i}):o(this._tooltip)}),l)),this._moveManipulation=new R({tool:this,view:i,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&M(t),radius:R.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const n=t=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(n(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(n(w.Z));const s=d(t);this._moveManipulation.elevationInfo=s,this.addHandles(f(this.graphicState));const{geometry:p}=t;if(this._moveManipulation.createGraphicDragPipeline(((e,a,o,n,r)=>{if(null!=p&&e===w.XY){const{snappingStep:e,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:s,pointer:r,editGeometryOperations:U.fromGeometry(new u({spatialReference:p.spatialReference}),i.state.viewingMode),visualizer:new _,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(a),o=o.next(E(this.view,s)).next(...e)}return{steps:o=o.next((t=>(this._updateMoveTooltip(e,t),t))),cancel:n}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new j({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([y({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>i.scale),(()=>this._updateMoveAngle()))].filter(e)),this.addHandles(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof g&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new A({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new T({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:this.tooltipOptions?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&M(this.graphic)}))}_createGeometryUndoRecord(){return x(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating}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(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<S?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){v(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case w.XY:a.info=new L({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>Z(t,e,o)));break;case w.XY_AXIS:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=Z(t,i,o);return n(a,b(e))}));break;case w.Z:a.info=new I({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,X)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"enableZ",void 0),t([p()],F.prototype,"enableRotation",void 0),t([p()],F.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:H})],F.prototype,"tooltipOptions",void 0),t([p()],F.prototype,"graphicState",void 0),t([p({value:!1})],F.prototype,"snapToScene",null),t([p({constructOnly:!0})],F.prototype,"snappingManager",void 0),t([p({readOnly:!0})],F.prototype,"type",void 0),t([p({readOnly:!0})],F.prototype,"updating",null),F=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],F);export{F as GraphicTransformTool};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import u from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as g}from"../../Manipulator3D.js";import{placeAtGraphic as v}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as _}from"../../SnappingVisualizer3D.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as S}from"../manipulations/config.js";import{MoveManipulation as R,ManipulationType as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as b}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as j}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as A}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as T}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as x}from"./undoRecords.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as G}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as I}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as k,TranslateGraphicXYTooltipInfo as C,TranslateGraphicTooltipInfo as L}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Z}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as X}from"../../../../support/euclideanLengthMeasurementUtils.js";let F=class extends(i.EventedMixin(G)){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new U,this.type="transform-3d",this._updatingHandles=new h,this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:i}=this;this.graphicState=new O({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new I({view:i}):o(this._tooltip)}),l)),this._moveManipulation=new R({tool:this,view:i,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&M(t),radius:R.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const n=t=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(n(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(n(w.Z));const s=d(t);this._moveManipulation.elevationInfo=s,this.addHandles(f(this.graphicState));const{geometry:p}=t;if(this._moveManipulation.createGraphicDragPipeline(((e,a,o,n,r)=>{if(null!=p&&e===w.XY){const{snappingStep:e,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:s,pointer:r,editGeometryOperations:H.fromGeometry(new u({spatialReference:p.spatialReference}),i.state.viewingMode),visualizer:new _,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(a),o=o.next(E(this.view,s)).next(...e)}return{steps:o=o.next((t=>(this._updateMoveTooltip(e,t),t))),cancel:n}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new j({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([y({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>i.scale),(()=>this._updateMoveAngle()))].filter(e)),this.addHandles(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof g&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new A({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new T({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:this.tooltipOptions?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&M(this.graphic)}))}_createGeometryUndoRecord(){return x(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating}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(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<S?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){v(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case w.XY:a.info=new L({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>Z(t,e,o)));break;case w.XY_AXIS:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=Z(t,i,o);return n(a,b(e))}));break;case w.Z:a.info=new k({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,X)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],F.prototype,"enableZ",void 0),t([p()],F.prototype,"enableRotation",void 0),t([p()],F.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:U})],F.prototype,"tooltipOptions",void 0),t([p()],F.prototype,"graphicState",void 0),t([p({value:!1})],F.prototype,"snapToScene",null),t([p({constructOnly:!0})],F.prototype,"snappingManager",void 0),t([p({readOnly:!0})],F.prototype,"type",void 0),t([p({readOnly:!0})],F.prototype,"updating",null),F=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],F);export{F as GraphicTransformTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{ignoreAbortErrors as n}from"../../../../../core/promiseUtils.js";import{syncAndInitial as a,watch as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as p}from"../../../../../core/support/WatchUpdatingTracking.js";import l from"../../../../../geometry/Point.js";import{clonePoint as g}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as m}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as h}from"../../SnappingVisualizer3D.js";import{screenToMap3D as d,hideManipulatorWhileDragging as u}from"../../editingTools/dragEventPipeline3D.js";import c from"./AreaMeasurement3DView.js";import{PickRequest as y}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as w}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as v}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorCollection as f}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as P}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as V}from"../../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as j}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as M}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as x}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let b=class extends _{constructor(t){super(t),this._updatingHandles=new p,this.polygonState="initial",this.manipulators=new f,this._getSnappingContext=i((t=>new j({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new P(new S("point",w(!0,!1,this.view.spatialReference))),visualizer:new h})))}initialize(){const{view:t,analysisViewData:e,manipulators:i,visible:o}=this;this.measurementView=new c({view:t,analysisViewData:e,toolState:this,manipulators:i,visible:o});const r=V(t);this._snappingManagerResult=r,this.addHandles(r),this._snappingOperation=new D({view:t}),this._updatingHandles.add((()=>this.stagedPoint),(t=>{this.analysisViewData.cursorPoint=null!=t?g(t,new l):null}),a),x(this,(()=>{const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(n(this._snappingOperation.resnap(this._snappingManager,e)))})),this._setupManipulators(),this.addHandles(s((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),a))}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._updatingHandles=e(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){return 0===this.analysisViewData.path.numVertices?"ready":this.analysisViewData.validMeasurement&&"editing"!==this.polygonState?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.polygonState?"crosshair":null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(t){this._snappingOperation.stagedPoint=t}get snappingOptions(){return this._snappingManager.options}finishMeasurement(){const{path:t}=this.analysisViewData;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this._resetSnappingState()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=t=>t.events.on("grab-changed",(()=>{if(this.analysisViewData.validMeasurement){const t=this.manipulators.some((t=>t.manipulator.grabbing));this.polygonState=t?"editing":"measured"}})),e=e=>{this.addHandles([v(e,((t,e,i,n)=>{const a=u(t),s=t.metadata,o=this._snappingManager,r=this._getSnappingContext(n),p=this._updatingHandles,{snappingStep:l,cancelSnapping:m}=M({snappingManager:o,snappingContext:r,updatingHandles:p});i=i.next(a).next((e=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(s,h),t.location=h,e))).next(m),e.next(a).next(d(this.view)).next(...l).next((e=>{t.location=e.mapEnd,this.analysisViewData.lastDraggedVertex="end"===e.action?null:s,this.analysisViewData.path.setVertexPosition(s,g(e.mapEnd))}));const h=g(this.analysisViewData.path.getVertexPositionAsPoint(s))})),t(e)],e)};this.manipulators.forEach((({manipulator:t})=>{e(t)})),this.addHandles([this.manipulators.on("after-add",(({item:{manipulator:t}})=>{e(t)})),this.manipulators.on("after-remove",(({item:{manipulator:t}})=>this.removeHandles(t)))])}_handleImmediateDoubleClick(t){m(t)&&("drawing"===this.polygonState&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){"editing"===this.polygonState&&t.stopPropagation()}_handleImmediateClick(t){if(!m(t))return;const e=k(t),{pointerType:i}=t;if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e,i))return this.stagedPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const n=this.measurementView.vertexHandleAt(e,i);if(null==n){if(this._addVertexAt(e,i))return this.stagedPoint=null,void t.stopPropagation()}else 0===n.index&&(this.finishMeasurement(),t.stopPropagation());break}}"mouse"===t.pointerType&&this._hoverAt(e)}_handlePointerMove(t){if("mouse"===t.pointerType){const e=k(t);this._hoverAt(e)}}_handleKeyDown(t){"Enter"===t.key&&"drawing"===this.polygonState&&(this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){const{polygonState:e}=this;if(this.active&&("initial"===e||"drawing"===e)){const e=this._pick(t);if(null!=e&&null!=e.mapPoint){const t=this._getSnappingContext("mouse");this._updatingHandles.addPromise(n(this._snappingOperation.snap({point:e.mapPoint},this._snappingManager,t)))}}else this.stagedPoint=null}_addVertexAt(t,e){const i=this._pick(t);if(null!=i&&null!=i.mapPoint){const{mapPoint:t}=i,n=this._getSnappingContext(e),a=this._snappingOperation.update({point:t},this._snappingManager,n),s=g(a,new l);return this.analysisViewData.path.add(s),!0}return!1}_pick(t){const e=new y(t);return this.measurementView.pick(e)}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){return{snappingManager:this._snappingManager}}};t([o({readOnly:!0})],b.prototype,"state",null),t([o()],b.prototype,"polygonState",void 0),t([o({readOnly:!0})],b.prototype,"cursor",null),t([o()],b.prototype,"measurementView",void 0),t([o({constructOnly:!0})],b.prototype,"view",void 0),t([o({constructOnly:!0})],b.prototype,"analysis",void 0),t([o({constructOnly:!0})],b.prototype,"analysisViewData",void 0),t([o({readOnly:!0})],b.prototype,"manipulators",void 0),t([o()],b.prototype,"updating",null),t([o()],b.prototype,"stagedPoint",null),t([o()],b.prototype,"snappingOptions",null),b=t([r("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],b);const O=b;export{O as default};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{ignoreAbortErrors as n}from"../../../../../core/promiseUtils.js";import{syncAndInitial as a,watch as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as g}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as m}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{screenToMap3D as h,hideManipulatorWhileDragging as u}from"../../editingTools/dragEventPipeline3D.js";import c from"./AreaMeasurement3DView.js";import{PickRequest as y}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as w}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as v}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorCollection as f}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as P}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as V}from"../../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as j}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as M}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as x}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let b=class extends _{constructor(t){super(t),this._updatingHandles=new p,this.polygonState="initial",this.manipulators=new f,this._getSnappingContext=i((t=>new j({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new P(new S("point",w(!0,!1,this.view.spatialReference))),visualizer:new d})))}initialize(){const{view:t,analysisViewData:e,manipulators:i,visible:o}=this;this.measurementView=new c({view:t,analysisViewData:e,toolState:this,manipulators:i,visible:o});const r=V(t);this._snappingManagerResult=r,this.addHandles(r),this._snappingOperation=new D({view:t}),this._updatingHandles.add((()=>this.stagedPoint),(t=>{this.analysisViewData.cursorPoint=null!=t?g(t,new l):null}),a),x(this,(()=>{const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(n(this._snappingOperation.resnap(this._snappingManager,e)))})),this._setupManipulators(),this.addHandles(s((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),a))}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._updatingHandles=e(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){return 0===this.analysisViewData.path.numVertices?"ready":this.analysisViewData.validMeasurement&&"editing"!==this.polygonState?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.polygonState?"crosshair":null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(t){this._snappingOperation.stagedPoint=t}get snappingOptions(){return this._snappingManager.options}finishMeasurement(){const{path:t}=this.analysisViewData;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this._resetSnappingState()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=t=>t.events.on("grab-changed",(()=>{if(this.analysisViewData.validMeasurement){const t=this.manipulators.some((t=>t.manipulator.grabbing));this.polygonState=t?"editing":"measured"}})),e=e=>{this.addHandles([v(e,((t,e,i,n)=>{const a=u(t),s=t.metadata,o=this._snappingManager,r=this._getSnappingContext(n),p=this._updatingHandles,{snappingStep:l,cancelSnapping:m}=M({snappingManager:o,snappingContext:r,updatingHandles:p});i=i.next(a).next((e=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(s,d),t.location=d,e))).next(m),e.next(a).next(h(this.view)).next(...l).next((e=>{t.location=e.mapEnd,this.analysisViewData.lastDraggedVertex="end"===e.action?null:s,this.analysisViewData.path.setVertexPosition(s,g(e.mapEnd))}));const d=g(this.analysisViewData.path.getVertexPositionAsPoint(s))})),t(e)],e)};this.manipulators.forEach((({manipulator:t})=>{e(t)})),this.addHandles([this.manipulators.on("after-add",(({item:{manipulator:t}})=>{e(t)})),this.manipulators.on("after-remove",(({item:{manipulator:t}})=>this.removeHandles(t)))])}_handleImmediateDoubleClick(t){m(t)&&("drawing"===this.polygonState&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){"editing"===this.polygonState&&t.stopPropagation()}_handleImmediateClick(t){if(!m(t))return;const e=k(t),{pointerType:i}=t;if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e,i))return this.stagedPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const n=this.measurementView.vertexHandleAt(e,i);if(null==n){if(this._addVertexAt(e,i))return this.stagedPoint=null,void t.stopPropagation()}else 0===n.index&&(this.finishMeasurement(),t.stopPropagation());break}}"mouse"===t.pointerType&&this._hoverAt(e)}_handlePointerMove(t){if("mouse"===t.pointerType){const e=k(t);this._hoverAt(e)}}_handleKeyDown(t){"Enter"===t.key&&"drawing"===this.polygonState&&(this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){const{polygonState:e}=this;if(this.active&&("initial"===e||"drawing"===e)){const e=this._pick(t);if(null!=e&&null!=e.mapPoint){const t=this._getSnappingContext("mouse");this._updatingHandles.addPromise(n(this._snappingOperation.snap({point:e.mapPoint},this._snappingManager,t)))}}else this.stagedPoint=null}_addVertexAt(t,e){const i=this._pick(t);if(null!=i&&null!=i.mapPoint){const{mapPoint:t}=i,n=this._getSnappingContext(e),a=this._snappingOperation.update({point:t},this._snappingManager,n),s=g(a,new l);return this.analysisViewData.path.add(s),!0}return!1}_pick(t){const e=new y(t);return this.measurementView.pick(e)}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){return{snappingManager:this._snappingManager}}};t([o({readOnly:!0})],b.prototype,"state",null),t([o()],b.prototype,"polygonState",void 0),t([o({readOnly:!0})],b.prototype,"cursor",null),t([o()],b.prototype,"measurementView",void 0),t([o({constructOnly:!0})],b.prototype,"view",void 0),t([o({constructOnly:!0})],b.prototype,"analysis",void 0),t([o({constructOnly:!0})],b.prototype,"analysisViewData",void 0),t([o({readOnly:!0})],b.prototype,"manipulators",void 0),t([o()],b.prototype,"updating",null),t([o()],b.prototype,"stagedPoint",null),t([o()],b.prototype,"snappingOptions",null),b=t([r("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],b);const O=b;export{O as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{watch as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as o}from"../../../../../core/support/WatchUpdatingTracking.js";import{clonePoint as l}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as u}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as p}from"../../SnappingVisualizer3D.js";import{SurfaceType as c,screenToMap3D as d,hideManipulatorWhileDragging as h}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as m}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as g}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as v}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as y}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,resetProperties as f}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as w}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as S}from"../../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as M}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as j}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{setupSnappingToggleHandles as D}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as b}from"../../../../support/screenUtils.js";import L from"../../../../../geometry/Point.js";let x=class extends v{constructor(t){super(t),this._updatingHandles=new o,this._emulatedDrag=null,this.lineState="initial",this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=i((t=>new M({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new w(new _("point",y(!0,!1,this.view.spatialReference))),visualizer:new p})))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:r}=this;this.measurementView=new m({toolState:this,view:t,analysis:e,analysisViewData:i,visible:r});const s=S(t);this._snappingManagerResult=s,this.addHandles(s);const{start:o,end:u,cursor:p}=this.measurementView.createManipulators(),c=(t,e,i)=>P(t,((t,n,a,r)=>{const s=h(t),o=this._snappingManager,u=this._getSnappingContext(r),p=this._updatingHandles,{lineState:c}=this;a=a.next(s).next(f(this,[i,e])).next((i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i}));const m=d(this.view),g=t=>{const n=m(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let v=n.next(s).next(g);if("touch"!==r||"editing"===c){const{snappingStep:t,cancelSnapping:e}=j({snappingManager:o,snappingContext:u,updatingHandles:p});a=a.next(e),v=v.next(...t)}v.next((t=>"start"!==t.action?t:null)).next((n=>{const a=l(n.mapEnd,new L);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)}))})),g=t=>t.events.on("grab-changed",(()=>{const t=o.grabbing||u.grabbing;this.lineState=t?"editing":"measured"}));this.addHandles([c(o,"startPoint","startPointSurfaceLocation"),c(u,"endPoint","endPointSurfaceLocation"),c(p,"cursorPoint","cursorPointSurfaceLocation"),g(o),g(u)]),this.manipulators.add(o),this.manipulators.add(u),this.manipulators.add(p),this.startManipulator=o,this.endManipulator=u,this.cursorManipulator=p,this.addHandles(n((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),a)),D(this)}destroy(){this._updatingHandles=e(this._updatingHandles),this.measurementView=e(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(null==t.startPoint&&null==t.endPoint)return"ready";const{lineState:e}=this;return this.validMeasurement&&"editing"!==e&&"drawing"!==e?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.lineState?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return null!=this.analysis.startPoint&&null!=this.analysis.endPoint}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}onShow(){this.measurementView.show(),this._updateManipulatorAvailability()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}this._updateManipulatorAvailability()}_handlePointerMove(t){if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if("mouse"!==e)return;const i=b(t),{lineState:n,cursorManipulator:a,endManipulator:r}=this;let s=!1;null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(a,e,i),s=!0),"initial"===n&&(this._emulatedDrag?.update(i),s=!0),"drawing"===n&&(r.events.emit("drag",{action:"update",start:i,screenPoint:i}),s=!0),s&&t.stopPropagation()}_handleImmediateClick(t){if(!this.active)return;if(!u(t))return;const e=b(t),{pointerType:i}=t,{cursorManipulator:n,startManipulator:a,endManipulator:r,lineState:s}=this;let o=!1;switch(null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(n,i,e)),s){case"initial":if(this._emulatedDrag?.update(e),null!=this.cursorPoint){this._emulatedDrag?.end(e),this._emulatedDrag=null;const{cursorPoint:t}=this;this.startPoint=t,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,a.location=t,a.interactive=!1,r.interactive=!1,this.lineState="drawing",this._emulatedDrag=V(r,i,e),o=!0}break;case"drawing":this._emulatedDrag?.update(e),null!=this.endPoint&&(this._emulatedDrag?.end(e),this._emulatedDrag=null,a.interactive=!0,r.interactive=!0,this.lineState="measured",o=!0)}o&&t.stopPropagation()}_surfaceLocation(t,e){return e===c.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_updateManipulatorAvailability(){this.startManipulator.available=null!=this.analysis.startPoint,this.endManipulator.available=null!=this.analysis.endPoint}_getElevation(t){return this.view.basemapTerrain.ready?g(this.view.elevationProvider,t)??0:0}get test(){return{snappingManager:this._snappingManager}}};function V(t,e,i){return t.events.emit("drag",{action:"start",pointerType:e,start:i,screenPoint:i}),{update:e=>t.events.emit("drag",{action:"update",start:e,screenPoint:e}),end:e=>t.events.emit("drag",{action:"end",start:e,screenPoint:e}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}t([r({readOnly:!0})],x.prototype,"state",null),t([r()],x.prototype,"lineState",void 0),t([r({readOnly:!0})],x.prototype,"cursor",null),t([r()],x.prototype,"startPoint",null),t([r()],x.prototype,"endPoint",null),t([r()],x.prototype,"cursorPoint",null),t([r({constructOnly:!0})],x.prototype,"analysis",void 0),t([r({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([r()],x.prototype,"measurementView",void 0),t([r({constructOnly:!0})],x.prototype,"view",void 0),t([r({readOnly:!0})],x.prototype,"validMeasurement",null),t([r({value:null})],x.prototype,"startPointSurfaceLocation",void 0),t([r({value:null})],x.prototype,"endPointSurfaceLocation",void 0),t([r({value:null})],x.prototype,"cursorPointSurfaceLocation",void 0),t([r()],x.prototype,"updating",null),x=t([s("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],x);const T=x;export{T as default};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{watch as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as o}from"../../../../../core/support/UpdatingHandles.js";import{clonePoint as l}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as u}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as p}from"../../SnappingVisualizer3D.js";import{SurfaceType as c,screenToMap3D as d,hideManipulatorWhileDragging as h}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as m}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as g}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as v}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as y}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,resetProperties as f}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as w}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as S}from"../../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as M}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as j}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{setupSnappingToggleHandles as D}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as b}from"../../../../support/screenUtils.js";import L from"../../../../../geometry/Point.js";let x=class extends v{constructor(t){super(t),this._updatingHandles=new o,this._emulatedDrag=null,this.lineState="initial",this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=i((t=>new M({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new w(new _("point",y(!0,!1,this.view.spatialReference))),visualizer:new p})))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:s}=this;this.measurementView=new m({toolState:this,view:t,analysis:e,analysisViewData:i,visible:s});const r=S(t);this._snappingManagerResult=r,this.addHandles(r);const{start:o,end:u,cursor:p}=this.measurementView.createManipulators(),c=(t,e,i)=>P(t,((t,n,a,s)=>{const r=h(t),o=this._snappingManager,u=this._getSnappingContext(s),p=this._updatingHandles,{lineState:c}=this;a=a.next(r).next(f(this,[i,e])).next((i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i}));const m=d(this.view),g=t=>{const n=m(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let v=n.next(r).next(g);if("touch"!==s||"editing"===c){const{snappingStep:t,cancelSnapping:e}=j({snappingManager:o,snappingContext:u,updatingHandles:p});a=a.next(e),v=v.next(...t)}v.next((t=>"start"!==t.action?t:null)).next((n=>{const a=l(n.mapEnd,new L);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)}))})),g=t=>t.events.on("grab-changed",(()=>{const t=o.grabbing||u.grabbing;this.lineState=t?"editing":"measured"}));this.addHandles([c(o,"startPoint","startPointSurfaceLocation"),c(u,"endPoint","endPointSurfaceLocation"),c(p,"cursorPoint","cursorPointSurfaceLocation"),g(o),g(u)]),this.manipulators.add(o),this.manipulators.add(u),this.manipulators.add(p),this.startManipulator=o,this.endManipulator=u,this.cursorManipulator=p,this.addHandles(n((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),a)),D(this)}destroy(){this._updatingHandles=e(this._updatingHandles),this.measurementView=e(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(null==t.startPoint&&null==t.endPoint)return"ready";const{lineState:e}=this;return this.validMeasurement&&"editing"!==e&&"drawing"!==e?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.lineState?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return null!=this.analysis.startPoint&&null!=this.analysis.endPoint}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}onShow(){this.measurementView.show(),this._updateManipulatorAvailability()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}this._updateManipulatorAvailability()}_handlePointerMove(t){if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if("mouse"!==e)return;const i=b(t),{lineState:n,cursorManipulator:a,endManipulator:s}=this;let r=!1;null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(a,e,i),r=!0),"initial"===n&&(this._emulatedDrag?.update(i),r=!0),"drawing"===n&&(s.events.emit("drag",{action:"update",start:i,screenPoint:i}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){if(!this.active)return;if(!u(t))return;const e=b(t),{pointerType:i}=t,{cursorManipulator:n,startManipulator:a,endManipulator:s,lineState:r}=this;let o=!1;switch(null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(n,i,e)),r){case"initial":if(this._emulatedDrag?.update(e),null!=this.cursorPoint){this._emulatedDrag?.end(e),this._emulatedDrag=null;const{cursorPoint:t}=this;this.startPoint=t,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,a.location=t,a.interactive=!1,s.interactive=!1,this.lineState="drawing",this._emulatedDrag=V(s,i,e),o=!0}break;case"drawing":this._emulatedDrag?.update(e),null!=this.endPoint&&(this._emulatedDrag?.end(e),this._emulatedDrag=null,a.interactive=!0,s.interactive=!0,this.lineState="measured",o=!0)}o&&t.stopPropagation()}_surfaceLocation(t,e){return e===c.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_updateManipulatorAvailability(){this.startManipulator.available=null!=this.analysis.startPoint,this.endManipulator.available=null!=this.analysis.endPoint}_getElevation(t){return this.view.basemapTerrain.ready?g(this.view.elevationProvider,t)??0:0}get test(){return{snappingManager:this._snappingManager}}};function V(t,e,i){return t.events.emit("drag",{action:"start",pointerType:e,start:i,screenPoint:i}),{update:e=>t.events.emit("drag",{action:"update",start:e,screenPoint:e}),end:e=>t.events.emit("drag",{action:"end",start:e,screenPoint:e}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}t([s({readOnly:!0})],x.prototype,"state",null),t([s()],x.prototype,"lineState",void 0),t([s({readOnly:!0})],x.prototype,"cursor",null),t([s()],x.prototype,"startPoint",null),t([s()],x.prototype,"endPoint",null),t([s()],x.prototype,"cursorPoint",null),t([s({constructOnly:!0})],x.prototype,"analysis",void 0),t([s({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([s()],x.prototype,"measurementView",void 0),t([s({constructOnly:!0})],x.prototype,"view",void 0),t([s({readOnly:!0})],x.prototype,"validMeasurement",null),t([s({value:null})],x.prototype,"startPointSurfaceLocation",void 0),t([s({value:null})],x.prototype,"endPointSurfaceLocation",void 0),t([s({value:null})],x.prototype,"cursorPointSurfaceLocation",void 0),t([s()],x.prototype,"updating",null),x=t([r("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],x);const H=x;export{H as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e,nextHighestPowerOfTwo as t}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{g as s,c as o}from"../../../../chunks/vec4.js";import{f as n}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as l}from"../../../../geometry/projection.js";import{expandWithBuffer as a}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as u}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as h}from"./Object3DVisualElement.js";import{evaluateElevationAlignmentAtPoint as m}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as p}from"../../layers/graphics/ElevationContext.js";import{createTexture as _,DEFAULT_SYMBOL_SIZE_RATIO as c}from"../../support/engineContent/sdfPrimitives.js";import{createPointGeometry as g}from"../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as f}from"../../webgl-engine/materials/HUDMaterial.js";class x extends h{constructor(e){super(e),this._material=null,this._texture=null,this._geometry=null,this._size=3,this._color=n(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=n(1,1,1,1),this._elevationInfo=null,this.applyProperties(e)}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this._preferredTextureSize;this._size=e,t<this._preferredTextureSize?this.recreate():this._updateSizeAttribute()}}get color(){return this._color}set color(e){s(e,this._color)||(o(this._color,e),this._updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this._updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,this.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){s(e,this._outlineColor)||(o(this._outlineColor,e),this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}_updateMaterial(){this._material&&this._material.setParameters(this._materialParameters)}_updateSizeAttribute(){const e=this.object;if(null==e)return;const t=e.geometries[0];if(null==t)return;const i=t.getMutableAttribute(d.SIZE).data,r=this._geometrySize;i[0]=r,i[1]=r,e.geometryVertexAttrsUpdated(e.geometries[0])}get _materialParameters(){return{color:this._color,textureIsSignedDistanceField:!0,distanceFieldBoundingBox:v,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:this._texture?.id,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled,isDecoration:this.isDecoration}}get _geometrySize(){return this._size/S}createExternalResources(){this._texture=_(this._primitive,this._preferredTextureSize),this._material=new f(this._materialParameters);const e=this.view._stage;e.add(this._texture),e.loadImmediate(this._texture)}destroyExternalResources(){if(this._texture){this.view._stage.remove(this._texture),this._texture.dispose(),this._texture=null}this._material?.dispose(),this._material=null}createGeometries(e){const t=this._createRenderGeometry();null!=t&&e.addGeometry(t)}forEachExternalMaterial(e){this._material&&e(this._material)}get _preferredTextureSize(){return e(t(2*this._geometrySize),16,128)}calculateMapBounds(e){const t=this.object?.geometries[0];if(!t)return!1;const i=t.vertexAttributes.get(d.POSITION);return l(i.data,this.view.renderCoordsHelper.spatialReference,y,this.view.spatialReference),a(e,y),!0}_createRenderGeometry(){const{geometry:e,_material:t}=this;if(null==e||null==t)return null;const{renderCoordsHelper:r,elevationProvider:s}=this.view,o=m(e,s,p.fromElevationInfo(this.elevationInfo),r),n=i(u.get(),e.x,e.y,o),a=u.get();l(n,e.spatialReference,a,r.spatialReference);const h=this._geometrySize;return g(t,null,a,null,[h,h],[0,0,0,1])}}const S=c,v=[S/2,S/2,1-S/2,1-S/2],y=r();export{x as PointVisualElement};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{s as t}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{g as r,c as s}from"../../../../chunks/vec4.js";import{f as o}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as n}from"../../../../geometry/projection.js";import{expandWithBuffer as l}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as u}from"./Object3DVisualElement.js";import{evaluateElevationAlignmentAtPoint as h}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as m}from"../../layers/graphics/ElevationContext.js";import{createTexture as p,DEFAULT_SYMBOL_SIZE_RATIO as _}from"../../support/engineContent/sdfPrimitives.js";import{createPointGeometry as c}from"../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as g}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as d}from"../../webgl-engine/materials/HUDMaterial.js";class f extends u{constructor(e){super(e),this._material=null,this._texture=null,this._geometry=null,this._size=3,this._color=o(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=o(1,1,1,1),this._elevationInfo=null,this.applyProperties(e)}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this._preferredTextureSize;this._size=e,t<this._preferredTextureSize?this.recreate():this._updateSizeAttribute()}}get color(){return this._color}set color(e){r(e,this._color)||(s(this._color,e),this._updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this._updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,this.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){r(e,this._outlineColor)||(s(this._outlineColor,e),this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}_updateMaterial(){this._material&&this._material.setParameters(this._materialParameters)}_updateSizeAttribute(){const e=this.object;if(null==e)return;const t=e.geometries[0];if(null==t)return;const i=t.getMutableAttribute(g.SIZE).data,r=this._geometrySize;i[0]=r,i[1]=r,e.geometryVertexAttrsUpdated(e.geometries[0])}get _materialParameters(){return{color:this._color,textureIsSignedDistanceField:!0,distanceFieldBoundingBox:S,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:this._texture?.id,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled,isDecoration:this.isDecoration}}get _geometrySize(){return this._size/x}createExternalResources(){this._texture=p(this._primitive,this._preferredTextureSize),this._material=new d(this._materialParameters);const e=this.view._stage;e.add(this._texture),e.loadImmediate(this._texture)}destroyExternalResources(){if(this._texture){this.view._stage.remove(this._texture),this._texture.dispose(),this._texture=null}this._material?.dispose(),this._material=null}createGeometries(e){const t=this._createRenderGeometry();null!=t&&e.addGeometry(t)}forEachExternalMaterial(e){this._material&&e(this._material)}get _preferredTextureSize(){return e(2*this._geometrySize,16,128)}calculateMapBounds(e){const t=this.object?.geometries[0];if(!t)return!1;const i=t.vertexAttributes.get(g.POSITION);return n(i.data,this.view.renderCoordsHelper.spatialReference,v,this.view.spatialReference),l(e,v),!0}_createRenderGeometry(){const{geometry:e,_material:i}=this;if(null==e||null==i)return null;const{renderCoordsHelper:r,elevationProvider:s}=this.view,o=h(e,s,m.fromElevationInfo(this.elevationInfo),r),l=t(a.get(),e.x,e.y,o),u=a.get();n(l,e.spatialReference,u,r.spatialReference);const p=this._geometrySize;return c(i,null,u,null,[p,p],[0,0,0,1])}}const x=_,S=[x/2,x/2,1-x/2,1-x/2],v=i();export{f as PointVisualElement};