@arcgis/core 6.0.0-next.14 → 6.0.0-next.16

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 (398) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  11. package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
  12. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  13. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  17. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  18. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  20. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  21. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  22. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  26. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  27. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  28. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  30. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  31. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  32. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  33. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  34. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  35. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  36. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  37. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  38. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  39. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  40. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  41. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  42. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  44. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  45. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  46. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  50. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  51. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  58. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  59. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  61. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  62. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  64. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  65. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  66. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  72. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  73. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  78. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  79. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  81. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  82. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  83. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  84. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  85. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  86. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  88. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  89. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  90. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  91. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  92. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  93. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  94. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  95. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  96. package/assets/esri/core/workers/chunks/{aadfe34a99c9ec7a0e11.js → f9c5aa0bbf23e780fecc.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  98. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  100. package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
  101. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  102. package/chunks/Envelope.js +1 -1
  103. package/chunks/MultiPathImpl.js +1 -1
  104. package/chunks/OperatorGeodeticArea.js +1 -1
  105. package/chunks/OperatorShapePreservingLength.js +1 -1
  106. package/chunks/OperatorShapePreservingProject.js +1 -1
  107. package/chunks/UnitFactory.js +1 -1
  108. package/chunks/basis_encoder.js +1 -1
  109. package/chunks/basis_transcoder.js +1 -1
  110. package/chunks/index.js +1 -1
  111. package/chunks/lclayout.js +1 -1
  112. package/config.d.ts +2 -0
  113. package/config.js +1 -1
  114. package/core/ObjectPool.js +1 -1
  115. package/core/PooledArray.js +1 -1
  116. package/core/accessorSupport/DefaultsStore.js +1 -1
  117. package/core/accessorSupport/MultiOriginStore.js +1 -1
  118. package/core/accessorSupport/Store.js +1 -1
  119. package/core/accessorSupport/decorators/reader.js +1 -1
  120. package/core/accessorSupport/decorators/writer.js +1 -1
  121. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  122. package/core/workers/WorkerOwner.js +1 -1
  123. package/core/workers/workerFactory.js +1 -1
  124. package/core/workers/workers.js +2 -2
  125. package/core/workers.d.ts +9 -0
  126. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  127. package/geometry/Mesh.js +1 -1
  128. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  129. package/geometry/operators/gx/operatorOffset.js +1 -1
  130. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  131. package/geometry/operators/support/jsonConverter.js +1 -1
  132. package/geometry/support/buffer/BufferPool.js +1 -1
  133. package/geometry/support/coordsUtils.js +1 -1
  134. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  135. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  136. package/geometry/support/meshUtils/merge.js +1 -1
  137. package/geometry/support/meshUtils/rotate.js +1 -1
  138. package/geometry/support/meshUtils.d.ts +5 -6
  139. package/geometry/support/polygonExtentClipping.js +1 -1
  140. package/identity/Credential.js +1 -1
  141. package/interfaces.d.ts +18 -9
  142. package/kernel.js +1 -1
  143. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  144. package/layers/AnnotationFeatureLayer.js +1 -1
  145. package/layers/CatalogLayer.d.ts +2 -2
  146. package/layers/CatalogLayer.js +1 -1
  147. package/layers/DimensionFeatureLayer.d.ts +2 -2
  148. package/layers/DimensionFeatureLayer.js +1 -1
  149. package/layers/FeatureLayer.d.ts +4 -4
  150. package/layers/FeatureLayer.js +1 -1
  151. package/layers/GeospatialPDFLayer.d.ts +154 -4
  152. package/layers/ImageryTileLayer.js +1 -1
  153. package/layers/Layer.d.ts +2 -0
  154. package/layers/LineOfSightLayer.d.ts +10 -8
  155. package/layers/SceneLayer.js +1 -1
  156. package/layers/SubtypeGroupLayer.d.ts +2 -2
  157. package/layers/SubtypeGroupLayer.js +1 -1
  158. package/layers/ViewshedLayer.d.ts +1 -1
  159. package/layers/VoxelLayer.js +1 -1
  160. package/layers/WMSLayer.js +1 -1
  161. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  162. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  163. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  164. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  165. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  166. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  167. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  168. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  169. package/layers/graphics/data/QueryEngineResult.js +1 -1
  170. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  171. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  172. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  173. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  174. package/layers/mixins/ReloadableLayer.js +2 -0
  175. package/layers/raster/datasets/BaseRaster.js +1 -1
  176. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  177. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  178. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  179. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  180. package/layers/raster/datasets/MRFRaster.js +1 -1
  181. package/layers/raster/datasets/TIFFRaster.js +1 -1
  182. package/layers/raster/datasets/WCSRaster.js +1 -1
  183. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  184. package/layers/raster/formats/RasterCodec.js +1 -1
  185. package/layers/raster/formats/TiffDecoder.js +1 -1
  186. package/layers/raster/formats/Zlib.js +1 -1
  187. package/layers/raster/functions/stretchUtils.js +1 -1
  188. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  189. package/layers/support/FieldsIndex.js +1 -1
  190. package/layers/support/LabelClass.d.ts +3 -2
  191. package/layers/support/PortalItemData.d.ts +31 -8
  192. package/layers/support/RasterWorker.js +1 -1
  193. package/layers/support/featureReductionProperties.js +1 -1
  194. package/layers/support/kmlUtils.js +1 -1
  195. package/layers/support/types.d.ts +4 -1
  196. package/layers/video/VideoController.js +10 -10
  197. package/libs/maquette/projection.js +1 -1
  198. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  199. package/package.json +5 -5
  200. package/popup/FeatureModel.js +1 -1
  201. package/popup/FeaturesModel.js +1 -1
  202. package/portal/Portal.js +1 -1
  203. package/request/process.js +1 -1
  204. package/request/types.d.ts +7 -0
  205. package/rest/knowledgeGraph/ObjectValue.js +1 -1
  206. package/rest/knowledgeGraphService.js +1 -1
  207. package/rest/networks/trace.js +1 -1
  208. package/rest/query/executeQuery.js +1 -1
  209. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  210. package/smartMapping/renderers/univariateColorSize.js +1 -1
  211. package/smartMapping/statistics/support/statsWorker.js +1 -1
  212. package/smartMapping/statistics/support/utils.js +1 -1
  213. package/smartMapping/support/clusterUtils.js +1 -1
  214. package/statistics/utils.js +1 -1
  215. package/symbols/cim/CIMCursor.js +1 -1
  216. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  217. package/symbols/cim/cimAnalyzer.js +1 -1
  218. package/symbols/support/ElevationInfo.d.ts +4 -3
  219. package/undoredo/support/Services.js +1 -1
  220. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  221. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  222. package/views/2d/grid/GridView2D.js +1 -1
  223. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  224. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  225. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  226. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  227. package/views/2d/viewpointUtils.js +1 -1
  228. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  229. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  230. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  231. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  232. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  233. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  234. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  235. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  236. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  237. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  238. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  239. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  240. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  241. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  242. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  243. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  244. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  245. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  246. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  247. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  248. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  249. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  250. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  251. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  252. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  253. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  254. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  255. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  256. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  257. package/views/3d/layers/i3s/I3SNode.js +1 -1
  258. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  259. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  260. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  263. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  264. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  265. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  266. package/views/3d/support/MemoryController.js +1 -1
  267. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  268. package/views/3d/support/elevationUpdateUtils.js +1 -1
  269. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  270. package/views/3d/support/sphereExtentUtils.js +2 -0
  271. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  272. package/views/3d/terrain/OverlayRenderer.js +1 -1
  273. package/views/3d/terrain/PatchRenderData.js +1 -1
  274. package/views/3d/terrain/TerrainData.js +1 -1
  275. package/views/3d/terrain/terrainUtils.js +1 -1
  276. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  277. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  278. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  279. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  280. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  281. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  282. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  283. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  284. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  285. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  286. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  287. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  288. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  289. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  290. package/views/SceneView.js +1 -1
  291. package/views/ToolViewManager.js +1 -1
  292. package/views/draw/DrawOperation.js +1 -1
  293. package/views/draw/support/InteractiveHandle.js +1 -1
  294. package/views/draw/support/Reshape.js +1 -1
  295. package/views/draw/support/createUtils.js +1 -1
  296. package/views/draw/support/editingSessionUtils.js +1 -1
  297. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  298. package/views/interactive/SegmentLabels.js +1 -1
  299. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  300. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  301. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  302. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  303. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  304. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  305. package/views/interactive/sketch/constraintUtils.js +1 -1
  306. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  307. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  308. package/views/layers/LayerView.js +1 -1
  309. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  310. package/views/layers/SketchLayerView.d.ts +1 -0
  311. package/views/layers/ViewshedLayerView.d.ts +36 -12
  312. package/views/webgl/Program.js +1 -1
  313. package/views/webgl/Texture.js +1 -1
  314. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  315. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  316. package/widgets/BatchAttributeForm.js +1 -1
  317. package/widgets/Directions.js +1 -1
  318. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  319. package/widgets/Editor/EditorViewModel.d.ts +10 -1
  320. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  321. package/widgets/Editor.d.ts +10 -1
  322. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  323. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  324. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  325. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  326. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  327. package/widgets/HistogramRangeSlider.d.ts +2 -2
  328. package/widgets/HistogramRangeSlider.js +1 -1
  329. package/widgets/Legend.d.ts +1 -0
  330. package/widgets/Print.js +1 -1
  331. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  332. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  333. package/widgets/ScaleRangeSlider.js +1 -1
  334. package/widgets/Slice.js +1 -1
  335. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  336. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  337. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  338. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  339. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  340. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  341. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  342. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  343. package/widgets/ValuePicker/types.d.ts +2 -0
  344. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  345. package/widgets/support/SelectionList.js +1 -1
  346. package/widgets/support/componentsUtils.js +1 -1
  347. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  348. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  349. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  350. package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
  351. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  352. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  353. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  354. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  355. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  356. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  357. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  358. package/assets/esri/core/workers/chunks/22e8c0aad2fe75943865.js +0 -1
  359. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  360. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  361. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  362. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  363. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  364. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  365. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  366. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  367. package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
  368. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  369. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  370. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  371. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  372. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  373. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  374. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  375. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  376. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  377. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  378. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  379. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  380. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  381. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  382. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  383. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  384. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  385. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  386. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  387. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  388. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  389. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  390. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  391. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  392. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  393. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  394. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  395. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  396. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  397. package/layers/mixins/FeatureLayerReload.js +0 -2
  398. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -12,10 +12,7 @@ import type { ViewshedPlacementOptions, ViewshedPlacementResult } from "./Viewsh
12
12
  *
13
13
  * It allows to create new viewsheds interactively using the [place()](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#place) method,
14
14
  * or to make existing viewsheds selectable and editable by enabling the [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) property.
15
- * To select a viewshed, hover and click on its field-of-view manipulators.
16
- *
17
- * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
18
- * [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
15
+ * To select a viewshed, hover and click on its observer.
19
16
  *
20
17
  * The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView)
21
18
  * similar to how layer views are retrieved for layers using [SceneView.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenLayerView).
@@ -29,11 +26,22 @@ import type { ViewshedPlacementOptions, ViewshedPlacementResult } from "./Viewsh
29
26
  * const analysisView = await view.whenAnalysisView(analysis);
30
27
  * ```
31
28
  *
29
+ * > [!WARNING]
30
+ * >
31
+ * > **Things to consider:**
32
+ * > * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
33
+ * [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
34
+ * > * Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key.
35
+ * > * Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries),
36
+ * > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
37
+ * > [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/).
38
+ *
32
39
  * @since 4.30
33
40
  * @see [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/)
34
41
  * @see [Viewshed](https://developers.arcgis.com/javascript/latest/references/core/analysis/Viewshed/)
35
42
  * @see [ViewshedLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/)
36
43
  * @see [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/)
44
+ * @see [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/)
37
45
  * @see [Sample - Interactive viewshed analysis](https://developers.arcgis.com/javascript/latest/sample-code/analysis-viewshed/)
38
46
  * @see [Sample - Analysis objects](https://developers.arcgis.com/javascript/latest/sample-code/analysis-objects/)
39
47
  * @see [3D viewshed overview](https://developers.arcgis.com/documentation/spatial-analysis-services/3d-visual/3d-viewshed/)
@@ -43,17 +51,21 @@ export default abstract class ViewshedAnalysisView3D extends AnalysisView3D {
43
51
  /** The viewshed analysis object associated with the analysis view. */
44
52
  get analysis(): ViewshedAnalysis;
45
53
  /**
46
- * Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis). When set to `true` and the analysis includes any
47
- * valid [ViewshedAnalysis.viewsheds](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/#viewsheds), they become selectable and editable.
54
+ * Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis).
55
+ * When set to `true` and the analysis includes any valid [ViewshedAnalysis.viewsheds](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/#viewsheds),
56
+ * they become selectable and editable.
57
+ *
58
+ * Viewsheds can be removed with the `Delete` key.
48
59
  *
49
60
  * @default false
50
61
  */
51
62
  accessor interactive: boolean;
52
63
  /**
53
- * The selected viewshed. If [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) is `true`, any viewshed in the
54
- * [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis) can be selected by clicking on it in the view. As long as [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive)
55
- * remains `true`, the properties of the selected viewshed can be edited by interacting with
56
- * manipulators in the view.
64
+ * The viewshed currently selected for interactive editing.
65
+ *
66
+ * When [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) is `true`, any viewshed in the
67
+ * [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis) can be selected
68
+ * and its properties can be edited by interacting with the manipulators in the view.
57
69
  */
58
70
  accessor selectedViewshed: Viewshed | null | undefined;
59
71
  /** The analysis view type. */
@@ -71,34 +83,46 @@ export default abstract class ViewshedAnalysisView3D extends AnalysisView3D {
71
83
  *
72
84
  * This method is similar to the [place()](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#place) method, but it allows to create multiple viewsheds in a row.
73
85
  *
86
+ * By default, the observer is created at absolute height.
87
+ * Optionally, by specifying the options of the method,
88
+ * you can change the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
89
+ *
74
90
  * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) to `true`.
75
91
  *
76
- * @param options - An object specifying additional options.
92
+ * @param options - An object specifying additional placement options, including elevation information and an abort signal.
77
93
  * @returns A promise which resolves when creation is completed successfully or rejected if it is
78
94
  * canceled.
79
95
  * @example
80
96
  * const abortController = new AbortController();
81
97
  *
82
98
  * try {
83
- * await viewshedAnalysisView.createViewsheds({ signal: abortController.signal });
99
+ * await analysisView.createViewsheds({
100
+ * signal: abortController.signal,
101
+ * // optional elevation info
102
+ * elevationInfo: { mode: "relative-to-ground", offset: 1.5 },
103
+ * });
84
104
  * } catch (error) {
85
105
  * if (error.name === "AbortError") {
86
106
  * console.log("Creation operation was cancelled.");
87
107
  * }
88
108
  * }
89
109
  *
90
- * // cancel the placement operation at some later point
110
+ * // cancel the creation operation at some later point
91
111
  * abortController.abort();
92
112
  */
93
113
  createViewsheds(options?: ViewshedPlacementOptions | null | undefined): Promise<void>;
94
114
  /**
95
115
  * Starts the interactive placement of a single viewshed, adding it to the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis).
96
116
  *
97
- * The first click in the scene places the observer point and the second sets the viewshed's orientation.
117
+ * The first click in the scene places the observer point and the second sets the viewshed's orientation and distance.
98
118
  *
99
119
  * The placement operation will finish when the user presses the escape key.
100
120
  * To stop the placing programmatically, pass an abort signal as an argument when calling the method.
101
121
  *
122
+ * By default, the observer is created at absolute height.
123
+ * Optionally, by specifying the options of the method,
124
+ * you can change the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
125
+ *
102
126
  * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) to `true`.
103
127
  *
104
128
  * @param options - An object specifying additional options.
@@ -109,7 +133,11 @@ export default abstract class ViewshedAnalysisView3D extends AnalysisView3D {
109
133
  * const abortController = new AbortController();
110
134
  *
111
135
  * try {
112
- * await analysisView.place({ signal: abortController.signal });
136
+ * await analysisView.place({
137
+ * signal: abortController.signal,
138
+ * // optional elevation info
139
+ * elevationInfo: { mode: "relative-to-ground", offset: 1.5 },
140
+ * });
113
141
  * } catch (error) {
114
142
  * if (error.name === "AbortError") {
115
143
  * console.log("Placement operation was cancelled.");
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{GamepadKeyboardController as e}from"../../state/controllers/GamepadKeyboardController.js";import{InputHandler as t}from"../../../input/InputHandler.js";import{onVisibilityChange as n}from"../../../input/VisibilityChange.js";class r extends t{constructor(e,t){super(!0),this._view=e,this._keyToDirection=new Map,this._keyToAction=new Map,this._precisionPanModifierKeys=new Set,this._coarsePanModifierKeys=new Set,this._stickyKeyTimeoutHandle=void 0,this._stickyKeyDuration=200,this._addKeysMapping(t),this.registerIncoming(`key-down`,null,e=>this._handleKeyDown(e)),this.registerIncoming(`key-up`,null,e=>this._handleKeyUp(e)),this.registerIncoming(`blur`,null,()=>this._handleStop()),this._visibilityHandle=n(e=>e?null:this._handleStop())}onUninstall(){this._visibilityHandle?.remove(),this._handleStop()}setStickyKeyDuration(e){this._stickyKeyDuration=e}_addKeysMapping(e){this._addKeyMapping(e.pan.left,0),this._addKeyMapping(e.pan.right,1),this._addKeyMapping(e.pan.forward,2),this._addKeyMapping(e.pan.backward,3),this._addKeyMapping(e.pan.up,4),this._addKeyMapping(e.pan.down,5),this._addKeyMapping(e.lookAround.headingLeft,6),this._addKeyMapping(e.lookAround.headingRight,7),this._addKeyMapping(e.lookAround.tiltUp,8),this._addKeyMapping(e.lookAround.tiltDown,9),this._addKeyMapping(e.zoom.zoomIn,10),this._addKeyMapping(e.zoom.zoomOut,11),this._addKeyAction(e.reset.heading,()=>this._resetHeading()),this._addKeyAction(e.reset.tilt,()=>this._resetTilt());for(let t of this._eachKey(e.precisionPanModifier))this._precisionPanModifierKeys.add(t);for(let t of this._eachKey(e.coarsePanModifier))this._coarsePanModifierKeys.add(t)}_addKeyMapping(e,t){for(let n of this._eachKey(e))this._keyToDirection.set(n,t)}*_eachKey(e){typeof e==`string`?yield e:yield*e}_addKeyAction(e,t){for(let n of this._eachKey(e))this._keyToAction.set(n,t)}_handleKeyDown(t){if(t.data.native.ctrlKey||t.data.native.metaKey)return;let n=this._keyToAction.get(t.data.key);if(n!=null){t.stopPropagation(),n();return}let r=this._keyToDirection.get(t.data.key);if(r==null)this._cameraControllerKeyboard?.running&&this._updatePanModifiers(t);else if((!this._cameraControllerKeyboard||!this._cameraControllerKeyboard.running)&&(this._cameraControllerKeyboard=new e({view:this._view}),this._view.state.switchCameraController(this._cameraControllerKeyboard)),this._updatePanModifiers(t),this._cameraControllerKeyboard.running){if(t.stopPropagation(),this._cameraControllerKeyboard.directionActive(r)||(this._cameraControllerKeyboard.activateDirection(r),this._cameraControllerKeyboard.countActiveDirections()>1||!this._isPanning(r)))return;this._stickyKeyDuration>0&&(this._stickyKeyTimeoutHandle=setTimeout(()=>{this._stickyKeyTimeoutHandle=void 0,this._stickyDirection!=null&&this._stickyDirection!==void 0&&(this._cameraControllerKeyboard?.deactivateDirection(this._stickyDirection),this._stickyDirection=void 0)},this._stickyKeyDuration))}}_handleStop(){this._cameraControllerKeyboard?.running&&(this._cameraControllerKeyboard.finishController(),this._cameraControllerKeyboard=null)}_handleKeyUp(e){if(e.data.native.ctrlKey||e.data.native.metaKey||!this._cameraControllerKeyboard?.running)return;this._updatePanModifiers(e);let t=this._keyToDirection.get(e.data.key);if(t==null)return;e.stopPropagation();let n=this._stickyKeyTimeoutHandle===void 0;this._stickyKeyTimeoutHandle!==void 0&&this._cameraControllerKeyboard?.countActiveDirections()===1?this._stickyDirection=t:(this._cameraControllerKeyboard?.deactivateDirection(t),n&&(this._stickyDirection=void 0))}_isPanning(e){return e<=3}_updatePanModifiers(e){this._cameraControllerKeyboard?.setPrecisionPanEnabled(this._eventMatchesKeys(e,this._precisionPanModifierKeys)),this._cameraControllerKeyboard?.setCoarsePanEnabled(this._eventMatchesKeys(e,this._coarsePanModifierKeys))}_eventMatchesKeys(e,t){return e.type===`key-down`&&t.has(e.data.key)||t.values().some(t=>e.modifiers.has(t))}_resetHeading(){this._view.goTo({heading:0}).catch(()=>{})}_resetTilt(){this._view.goTo({tilt:0}).catch(()=>{})}}export{r as KeyboardNavigation};
2
+ import{GamepadKeyboardController as e}from"../../state/controllers/GamepadKeyboardController.js";import{InputHandler as t}from"../../../input/InputHandler.js";import{onVisibilityChange as n}from"../../../input/VisibilityChange.js";class r extends t{constructor(e,t){super(!0),this._view=e,this._keyToDirection=new Map,this._keyToAction=new Map,this._precisionPanModifierKeys=new Set,this._coarsePanModifierKeys=new Set,this._stickyKeyTimeoutHandle=void 0,this._stickyKeyDuration=200,this._addKeysMapping(t),this.registerIncoming(`key-down`,null,e=>this._handleKeyDown(e)),this.registerIncoming(`key-up`,null,e=>this._handleKeyUp(e)),this.registerIncoming(`blur`,null,()=>this._handleStop()),this._visibilityHandle=n(e=>e?null:this._handleStop())}onUninstall(){this._visibilityHandle?.remove(),this._handleStop()}setStickyKeyDuration(e){this._stickyKeyDuration=e}_addKeysMapping(e){this._addKeyMapping(e.pan.left,0),this._addKeyMapping(e.pan.right,1),this._addKeyMapping(e.pan.forward,2),this._addKeyMapping(e.pan.backward,3),this._addKeyMapping(e.pan.up,4),this._addKeyMapping(e.pan.down,5),this._addKeyMapping(e.lookAround.headingLeft,6),this._addKeyMapping(e.lookAround.headingRight,7),this._addKeyMapping(e.lookAround.tiltUp,8),this._addKeyMapping(e.lookAround.tiltDown,9),this._addKeyMapping(e.zoom.zoomIn,10),this._addKeyMapping(e.zoom.zoomOut,11),this._addKeyAction(e.reset.heading,()=>this._resetHeading()),this._addKeyAction(e.reset.tilt,()=>this._resetTilt());for(let t of this._eachKey(e.precisionPanModifier))this._precisionPanModifierKeys.add(t);for(let t of this._eachKey(e.coarsePanModifier))this._coarsePanModifierKeys.add(t)}_addKeyMapping(e,t){for(let n of this._eachKey(e))this._keyToDirection.set(n,t)}*_eachKey(e){typeof e==`string`?yield e:yield*e}_addKeyAction(e,t){for(let n of this._eachKey(e))this._keyToAction.set(n,t)}_handleKeyDown(t){if(t.data.native.ctrlKey||t.data.native.metaKey)return;let n=this._keyToAction.get(t.data.key);if(n!=null){t.stopPropagation(),n();return}let r=this._keyToDirection.get(t.data.key);if(r==null)this._cameraControllerKeyboard?.running&&this._updatePanModifiers(t);else if(this._cameraControllerKeyboard&&this._cameraControllerKeyboard.running||(this._cameraControllerKeyboard=new e({view:this._view}),this._view.state.switchCameraController(this._cameraControllerKeyboard)),this._updatePanModifiers(t),this._cameraControllerKeyboard.running){if(t.stopPropagation(),this._cameraControllerKeyboard.directionActive(r)||(this._cameraControllerKeyboard.activateDirection(r),this._cameraControllerKeyboard.countActiveDirections()>1||!this._isPanning(r)))return;this._stickyKeyDuration>0&&(this._stickyKeyTimeoutHandle=setTimeout(()=>{this._stickyKeyTimeoutHandle=void 0,this._stickyDirection!=null&&this._stickyDirection!==void 0&&(this._cameraControllerKeyboard?.deactivateDirection(this._stickyDirection),this._stickyDirection=void 0)},this._stickyKeyDuration))}}_handleStop(){this._cameraControllerKeyboard?.running&&(this._cameraControllerKeyboard.finishController(),this._cameraControllerKeyboard=null)}_handleKeyUp(e){if(e.data.native.ctrlKey||e.data.native.metaKey||!this._cameraControllerKeyboard?.running)return;this._updatePanModifiers(e);let t=this._keyToDirection.get(e.data.key);if(t==null)return;e.stopPropagation();let n=this._stickyKeyTimeoutHandle===void 0;this._stickyKeyTimeoutHandle!==void 0&&this._cameraControllerKeyboard?.countActiveDirections()===1?this._stickyDirection=t:(this._cameraControllerKeyboard?.deactivateDirection(t),n&&(this._stickyDirection=void 0))}_isPanning(e){return e<=3}_updatePanModifiers(e){this._cameraControllerKeyboard?.setPrecisionPanEnabled(this._eventMatchesKeys(e,this._precisionPanModifierKeys)),this._cameraControllerKeyboard?.setCoarsePanEnabled(this._eventMatchesKeys(e,this._coarsePanModifierKeys))}_eventMatchesKeys(e,t){return e.type===`key-down`&&t.has(e.data.key)||t.values().some(t=>e.modifiers.has(t))}_resetHeading(){this._view.goTo({heading:0}).catch(()=>{})}_resetTilt(){this._view.goTo({tilt:0}).catch(()=>{})}}export{r as KeyboardNavigation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as o}from"../../../../core/support/UpdatingHandles.js";import{getGraphicEffectiveElevationInfo as s}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as c}from"../manipulatorUtils.js";import{createGraphicGeometryUndoRecord as l}from"./undoRecords.js";import{GraphicState as u}from"../../layers/graphics/GraphicState.js";import{GraphicManipulator as d}from"../../../interactive/GraphicManipulator.js";import{EditGeometryOperations as f}from"../../../interactive/editGeometry/EditGeometryOperations.js";const p=Symbol();let m=class extends t{get operations(){return this._operations}get updating(){return this._updatingHandles.updating}get elevationInfo(){return s(this.graphic)}get visible(){return this._graphicState.displaying}get isDraped(){return this._graphicState.isDraped}get origin(){return c(this.view,this.graphic)}constructor(e){super(e),this._updatingHandles=new o}destroy(){this._operations=n(this._operations),this._updatingHandles.destroy()}initialize(){this._graphicState=new u({graphic:this.graphic}),this._graphicState.on(`changed`,()=>this.emit(`committed`)),this.addHandles(this.view.trackGraphicState(this._graphicState)),this.addHandles(this._updatingHandles.add(()=>this.graphic.geometry,e=>{if(e!==this._operations?.data.geometry){if(!e||e?.type===`multipoint`||e?.type===`extent`)n(this._operations),this.removeHandles(p),this._operations=null;else if(this._operations?.trySetGeometry(e))this.emit(`modified-externally`);else{n(this._operations),this.removeHandles(p);let t=f.fromGeometry(e,this.view.state.viewingMode);this._operations=t,this.addHandles(t.data.on(`change`,()=>this.graphic.geometry=t.data.geometry),p)}}},r))}createManipulator(e){return new d({view:this.view,graphic:this.graphic,...e})}maskOccludee(){return this.view.maskOccludee(this.graphic)}endInteraction(){this.graphic.geometry?.type===`mesh`&&this.graphic.notifyMeshTransformChanged()}toMap(e){return this.view.toMap(e,{include:[this.graphic]})}createUndoRecord(){let{graphic:{geometry:e}}=this;return l(e)}};e([i({constructOnly:!0})],m.prototype,`view`,void 0),e([i({constructOnly:!0})],m.prototype,`graphic`,void 0),e([i()],m.prototype,`_operations`,void 0),e([i()],m.prototype,`operations`,null),e([i()],m.prototype,`updating`,null),m=e([a(`esri.views.3d.interactive.editingTools.ManipulatedObject3DGraphic`)],m);export{m as ManipulatedObject3DGraphic};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as o}from"../../../../core/support/UpdatingHandles.js";import{ringNeedsClosure as s,closeRings as c}from"../../../../geometry/support/coordsUtils.js";import{getGraphicEffectiveElevationInfo as l}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as u}from"../manipulatorUtils.js";import{createGraphicGeometryUndoRecord as d}from"./undoRecords.js";import{GraphicState as f}from"../../layers/graphics/GraphicState.js";import{GraphicManipulator as p}from"../../../interactive/GraphicManipulator.js";import{EditGeometryOperations as m}from"../../../interactive/editGeometry/EditGeometryOperations.js";const h=Symbol();let g=class extends t{get operations(){return this._operations}get updating(){return this._updatingHandles.updating}get elevationInfo(){return l(this.graphic)}get visible(){return this._graphicState.displaying}get isDraped(){return this._graphicState.isDraped}get origin(){return u(this.view,this.graphic)}constructor(e){super(e),this._updatingHandles=new o}destroy(){this._operations=n(this._operations),this._updatingHandles.destroy()}initialize(){this._graphicState=new f({graphic:this.graphic}),this._graphicState.on(`changed`,()=>this.emit(`committed`)),this.addHandles(this.view.trackGraphicState(this._graphicState)),this.addHandles(this._updatingHandles.add(()=>this.graphic.geometry,e=>{let t=this._operations?.data.geometry;if(e!==t){if(!e||e?.type===`multipoint`||e?.type===`extent`)n(this._operations),this.removeHandles(h),this._operations=null;else if(e.type===`polygon`&&e.rings.some(s)&&(e=e.clone(),c(e)),this._operations?.trySetGeometry(e))this.emit(`modified-externally`);else{n(this._operations),this.removeHandles(h);let t=m.fromGeometry(e,this.view.state.viewingMode);this._operations=t,this.addHandles(t.data.on(`change`,()=>this.graphic.geometry=t.data.geometry),h)}}},r))}createManipulator(e){return new p({view:this.view,graphic:this.graphic,...e})}maskOccludee(){return this.view.maskOccludee(this.graphic)}endInteraction(){this.graphic.geometry?.type===`mesh`&&this.graphic.notifyMeshTransformChanged()}toMap(e){return this.view.toMap(e,{include:[this.graphic]})}createUndoRecord(){let{graphic:{geometry:e}}=this;return d(e)}};e([i({constructOnly:!0})],g.prototype,`view`,void 0),e([i({constructOnly:!0})],g.prototype,`graphic`,void 0),e([i()],g.prototype,`_operations`,void 0),e([i()],g.prototype,`operations`,null),e([i()],g.prototype,`updating`,null),g=e([a(`esri.views.3d.interactive.editingTools.ManipulatedObject3DGraphic`)],g);export{g as ManipulatedObject3DGraphic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o,initial as s,when as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as p,getEffectiveElevationMode as m}from"../../../../../support/elevationInfoUtils.js";import h from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as g}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as _}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as v}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as b}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as S}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as C}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as w}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as E,geometryTypeToDrawOperationGeometryType as D}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as O}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as k,SceneDrawSurface as A}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as j}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as M}from"../../../../../core/accessorSupport/trackingUtils.js";let N=class extends E{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type=`draw-3d`}initialize(){let{mode:e,offset:t,unit:n,featureExpressionInfo:r}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new h({mode:e,offset:t,unit:n,featureExpressionInfo:r})}normalizeCtorArgs(e){if(!e.elevationInfo){let t=e.hasZ??!0;return{...e,elevationInfo:p(t)}}return e}initializeGraphic(e){let{view:n}=this,r=this._createGraphicState=new T({graphic:e});return t([n.maskOccludee(e),n.trackGraphicState(r),a(()=>({element:this._outlineVisualElement,isDraped:r.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},o),M(()=>{j(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(r),...v(r)])}makeDrawOperation(){let{geometryType:e}=this,t=e!==`circle`&&e!==`rectangle`;return new O({view:this.view,manipulators:this.manipulators,geometryType:D(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new A(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new k(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new _,segmentLabels:t?new g:null,labelOptions:this.toolOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,this.elevationInfo)===`on-the-ground`,cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){let{view:i}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),n();let a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=c;let l=a.visualElements.zVerticalLine,u=new b({view:i,extensionType:l.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=u;let d=t([this._updatingHandles.add(()=>a.visualElements.zVerticalLine,e=>e.apply(u),s),this._updatingHandles.add(()=>({selectedColor:a.colors.selected.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)})]);return c.attached=!0,this._updateVerticalLineVisualElement(e),d}_updateVerticalLineVisualElement(e){let t=this._verticalLineVisualElement;if(!t)return;let{renderCoordsHelper:n,elevationProvider:r}=this.view;d(F,e[0],e[1],e[2]),P.setFromElevationInfo(this.elevationInfo),F[2]=C(F,r,P,n),n.toRenderCoords(F,this.view.spatialReference,F)?(t.setStartEndFromWorldDownAtLocation(F),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,n();let i=this.internalGraphicsLayer.elevationInfo,{view:a}=this,o=this._settings,c=new x({view:a,geometry:e,elevationInfo:i,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,i)===`on-the-ground`,attached:!1,isDecoration:!0});this._outlineVisualElement=c;let l=t([this._updatingHandles.add(()=>o.visualElements.lineObjects.outline,e=>e.apply(c),s),this._updatingHandles.add(()=>o.visualElements.lineObjects.shadowStyle,e=>e.apply(c),s),n(()=>{this._outlineVisualElement=r(this._outlineVisualElement)})]);return c.attached=!0,c.laserlineEnabled=!0,l}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,n();let{view:i}=this,a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0}),l=t([this._updatingHandles.add(()=>({color:a.manipulators.vertex.color.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._verticesVisualElement=r(this._verticesVisualElement)})]);return c.attached=!0,this._verticesVisualElement=c,l}updateGraphicGeometry(e){if(this.geometryType===`mesh`&&e?.type===`point`){let t=this.geometryToPlace;t?.centerAt(e),j(this.tooltipInfos.mesh,t);let n=this._graphic;(!t||n.geometry!==t)&&(n.geometry=t)}else super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){let{drawOperation:r}=this;if(!this.geometryToPlace||e.displaying)return r.loading=!1,null;r.loading=!0;let a=n(()=>{r.loading=!1}),s,l=()=>{s&&cancelAnimationFrame(s)},u=()=>{l(),s=requestAnimationFrame(()=>a.remove())},d=null;return d=e.on(`changed`,()=>{d=i(d),u()}),t([d,c(()=>e.displaying,u,{...o,once:!0}),n(l),a])}};e([l({constructOnly:!0})],N.prototype,`elevationInfo`,void 0),e([l({constructOnly:!0})],N.prototype,`geometryType`,void 0),e([l()],N.prototype,`type`,void 0),e([l({constructOnly:!0})],N.prototype,`view`,void 0),N=e([u(`esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D`)],N);const P=new w,F=f();export{N as DrawGraphicTool3D};
2
+ import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o,initial as s,when as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as p,getEffectiveElevationMode as m}from"../../../../../support/elevationInfoUtils.js";import h from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as g}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as _}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as v}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as b}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as S}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as C}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as w}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as E,geometryTypeToDrawOperationGeometryType as D}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as O}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as k,SceneDrawSurface as A}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as j}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as M}from"../../../../../core/accessorSupport/trackingUtils.js";let N=class extends E{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type=`draw-3d`}initialize(){let{mode:e,offset:t,unit:n,featureExpressionInfo:r}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new h({mode:e,offset:t,unit:n,featureExpressionInfo:r})}normalizeCtorArgs(e){if(!e.elevationInfo){let t=e.hasZ??!0;return{...e,elevationInfo:p(t)}}return e}initializeGraphic(e){let{view:n}=this,r=this._createGraphicState=new T({graphic:e});return t([n.maskOccludee(e),n.trackGraphicState(r),a(()=>({element:this._outlineVisualElement,isDraped:r.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},o),M(()=>{j(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(r),...v(r)])}makeDrawOperation(){let{geometryType:e}=this,t=e!==`circle`&&e!==`rectangle`;return new O({view:this.view,manipulators:this.manipulators,geometryType:D(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new A(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new k(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new _,segmentLabels:t?new g:null,labelOptions:this.toolOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,this.elevationInfo)===`on-the-ground`,cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){let{view:i}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),n();let a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=c;let l=a.visualElements.zVerticalLine,u=new b({view:i,extensionType:l.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=u;let d=t([this._updatingHandles.add(()=>a.visualElements.zVerticalLine,e=>e.apply(u),s),this._updatingHandles.add(()=>({selectedColor:a.colors.selected.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)})]);return c.attached=!0,this._updateVerticalLineVisualElement(e),d}_updateVerticalLineVisualElement(e){let t=this._verticalLineVisualElement;if(!t)return;let{renderCoordsHelper:n,elevationProvider:r}=this.view;d(F,e[0],e[1],e[2]),P.setFromElevationInfo(this.elevationInfo),F[2]=C(F,r,P,n),n.toRenderCoords(F,this.view.spatialReference,F)?(t.setStartEndFromWorldDownAtLocation(F),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,n();let i=this.internalGraphicsLayer.elevationInfo,{view:a}=this,o=this._settings,c=new x({view:a,geometry:e,elevationInfo:i,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,i)===`on-the-ground`,attached:!1,isDecoration:!0});this._outlineVisualElement=c;let l=t([this._updatingHandles.add(()=>o.visualElements.lineObjects.outline,e=>e.apply(c),s),this._updatingHandles.add(()=>o.visualElements.lineObjects.shadowStyle,e=>e.apply(c),s),n(()=>{this._outlineVisualElement=r(this._outlineVisualElement)})]);return c.attached=!0,c.laserlineEnabled=!0,l}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,n();let{view:i}=this,a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0}),l=t([this._updatingHandles.add(()=>({color:a.manipulators.vertex.color.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._verticesVisualElement=r(this._verticesVisualElement)})]);return c.attached=!0,this._verticesVisualElement=c,l}updateGraphicGeometry(e){if(this.geometryType===`mesh`&&e?.type===`point`){let t=this.geometryToPlace;t?.centerAt(e),j(this.tooltipInfos.mesh,t);let n=this._graphic;t&&n.geometry===t||(n.geometry=t)}else super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){let{drawOperation:r}=this;if(!this.geometryToPlace||e.displaying)return r.loading=!1,null;r.loading=!0;let a=n(()=>{r.loading=!1}),s,l=()=>{s&&cancelAnimationFrame(s)},u=()=>{l(),s=requestAnimationFrame(()=>a.remove())},d=null;return d=e.on(`changed`,()=>{d=i(d),u()}),t([d,c(()=>e.displaying,u,{...o,once:!0}),n(l),a])}};e([l({constructOnly:!0})],N.prototype,`elevationInfo`,void 0),e([l({constructOnly:!0})],N.prototype,`geometryType`,void 0),e([l()],N.prototype,`type`,void 0),e([l({constructOnly:!0})],N.prototype,`view`,void 0),N=e([u(`esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D`)],N);const P=new w,F=f();export{N as DrawGraphicTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),(!this._operations||this._segmentLabels?.context?.editGeometryOperations!==this._operations)&&(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(!e.manipulator.grabbing&&(!i||e.manipulator.selected)&&r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>(this.destroyed||t.operation==null||!this._operations||(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)a.type===`vertex`&&(a.manipulator.selected?(t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)):n=!0);let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(e.manipulator.grabbing||i&&!e.manipulator.selected||r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>(this.destroyed||t.operation==null||!this._operations||(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)a.type===`vertex`&&(a.manipulator.selected?(t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)):n=!0);let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import{makeHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{initial as i}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as s}from"../../../../../core/support/UpdatingHandles.js";import{containsXY as c}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as l}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as u,resizeNormal as d,resizeOutlineOnly as f}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as m}from"../manipulatedObjectUtils.js";import{canMoveZOperations as h}from"../manipulatorUtils.js";import{createVisualElements as g}from"../visualElementUtils.js";import{ExtentMove as _}from"./extentTransform/ExtentMove.js";import{ExtentRotate as v}from"./extentTransform/ExtentRotate.js";import{ExtentScale as y}from"./extentTransform/ExtentScale.js";import{TransformBounds as b}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as x}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as S}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as C}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as w}from"../../../../interactive/InteractiveToolBase.js";import T from"../../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as E}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let D=class extends w{get updating(){return this.destroying||this.destroyed?!1:!!this.object.updating||this._extentMove.updating||this._extentScale.updating||this._updatingHandles.updating}constructor(e){super(e),this.events=new n,this._updatingHandles=new s,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.toolOptions=new T,this._preserveAspectRatio=new x,this._snapRotation=new S,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type=`transform-3d`,this._outlineVisualElement=null}initialize(){let{view:e,object:t}=this,n=this._bounds=new b(this,()=>this._updateManipulators());this._extentMove=new _(this,n),this._extentScale=new y(this,n,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new v(this,n,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([this._updatingHandles.add(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),this._updatingHandles.add(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(e=>this._updateManipulatorAvailability(e,2))),this._updatingHandles.add(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();let a=g({view:e,object:t,forEachManipulator:e=>this._forEachManipulator(e),onManipulatorsChanged:()=>r()});if(a!=null){let{visualElement:e}=a;e instanceof C&&(this._outlineVisualElement=e,this.addHandles(e.events.on(`attachment-origin-changed`,()=>this._bounds.updateDisplayBounds()))),this.addHandles(a)}this.addHandles([t.on(`committed`,()=>this._onGeometryChanged()),this._updatingHandles.add(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),this._updatingHandles.add(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),i),this._updatingHandles.add(()=>e.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>n.updateDisplayBounds())]),this._forEachManipulator(e=>{this.addHandles(e.events.on(`grab-changed`,()=>{this._updateAllManipulatorAvailability()}))}),this._forEachManipulator((e,n)=>{this.addHandles(e.events.on(`immediate-click`,e=>{n===1&&this.events.emit(`immediate-click`,{...e,object:t}),e.stopPropagation()}))}),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy(),this._set(`view`,null),this._set(`object`,null)}_initializeTooltip(){let{view:e}=this;this.tooltip=E(()=>({view:e,options:this.toolOptions.tooltips}));let t=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([this._updatingHandles.add(()=>[this.toolOptions.tooltips.effectiveEnabled,this.preserveAspectRatio],t)]),this._forEachManipulator(e=>{this.addHandles([e.events.on([`focus-changed`,`grab-changed`],t),e.events.on(`drag`,e=>{e.action===`cancel`?this.tooltip.clear():t()})])})}_getUpdatedTooltipInfo(){return this.toolOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(O),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on(`elevation-change`,e=>{this._attachmentOrigin!=null&&c(e.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),O)}_updateManipulators(){if(!this.visible)return;let e=this._bounds.displayBounds,t=u(e,l.get());this._extentMove.updateManipulators(t,e),this._extentScale.updateManipulators(t,e),this._extentRotate.updateManipulators(t,e)}_updateAllManipulatorAvailability(){this.grabbing=this._activeManipulatorType()!=null,this._forEachManipulator((e,t)=>this._updateManipulatorAvailability(e,t)),this._updateManipulatorDisplay()}_updateManipulatorAvailability(e,t){let n=this.grabbing&&!e.grabbing;if(e.interactive=!n,e instanceof p){let r=this.object.visible,i=this.enableZ&&h(this.object.operations,this.object.elevationInfo);switch(t){case 3:e.available=r&&this.enableRotation;break;case 2:e.available=r&&(this.enableScaling||this.enableRotation||i),e.interactive=!n&&this.enableScaling,e.state=this.enableScaling&&(!this.grabbing||this._activeManipulatorType()===2)?d:f;break;case 0:e.available=r&&i;break;default:e.available=r}}}_activeManipulatorType(){let e=null;return this._forEachManipulator(({grabbing:t},n)=>{e==null&&t&&(e=n)}),e}_updateManipulatorDisplay(){if(this.removeHandles(k),this._activeManipulatorType()==null)return;let e=[];this._forEachManipulator((t,n)=>{!t.grabbing&&(n===3||n===0)&&e.push(t.disableDisplay?.())}),this.addHandles(e.filter(t),k)}_forEachManipulator(e){this._extentMove.forEachManipulator(e),this._extentScale.forEachManipulator(e),this._extentRotate.forEachManipulator(e)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(e){this._preserveAspectRatio.enabled=e,this._set(`preserveAspectRatio`,e)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(e){this._snapRotation.enabled=e,this._set(`snapRotation`,e)}get attachmentOrigin(){let e=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=e??this.object.origin??m(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancelDrag(){if(this.canUndo){let e=this.object.operations?.undo();e&&this._bounds.updateMapBoundsFromOperationInverse(e)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(this.inputState!=null)this.view.activeTool=null;else if(this.canUndo){let e=this.object.operations?.undo();e&&this._bounds.updateMapBoundsFromOperationInverse(e)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){let e=this.object.operations?.redo();e&&this._bounds.updateMapBoundsFromOperation(e)}}get test(){}};e([a()],D.prototype,`updating`,null),e([a({constructOnly:!0,nonNullable:!0})],D.prototype,`view`,void 0),e([a({constructOnly:!0,nonNullable:!0})],D.prototype,`object`,void 0),e([a()],D.prototype,`enableZ`,void 0),e([a()],D.prototype,`enableScaling`,void 0),e([a()],D.prototype,`enableRotation`,void 0),e([a({constructOnly:!0,type:T})],D.prototype,`toolOptions`,void 0),e([a()],D.prototype,`preserveAspectRatio`,null),e([a()],D.prototype,`snapRotation`,null),e([a()],D.prototype,`grabbing`,void 0),e([a()],D.prototype,`inputState`,void 0),e([a({readOnly:!0})],D.prototype,`type`,void 0),e([a()],D.prototype,`tooltip`,void 0),D=e([o(`esri.views.3d.interactive.editingTools.transform.ExtentTransformTool`)],D);const O=`draped-elevation-changes`,k=Symbol();export{D as ExtentTransformTool};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import{makeHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{initial as i}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{projectPointToVector as l}from"../../../../../geometry/projection/projectPointToVector.js";import{sm4d as u}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as d,resizeNormal as f,resizeOutlineOnly as p}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as m}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as h}from"../manipulatedObjectUtils.js";import{canMoveZOperations as g}from"../manipulatorUtils.js";import{createVisualElements as _}from"../visualElementUtils.js";import{ExtentMove as v}from"./extentTransform/ExtentMove.js";import{ExtentRotate as y}from"./extentTransform/ExtentRotate.js";import{ExtentScale as b}from"./extentTransform/ExtentScale.js";import{TransformBounds as x}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as S}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as C}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as w}from"../../visualElements/OutlineVisualElement.js";import{containsElevationUpdatePoint as T}from"../../../support/elevationUpdateExtentUtils.js";import{InteractiveToolBase as E}from"../../../../interactive/InteractiveToolBase.js";import D from"../../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as O}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let k=class extends E{get updating(){return this.destroying||this.destroyed?!1:!!this.object.updating||this._extentMove.updating||this._extentScale.updating||this._updatingHandles.updating}constructor(e){super(e),this.events=new n,this._updatingHandles=new c,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.toolOptions=new D,this._preserveAspectRatio=new S,this._snapRotation=new C,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type=`transform-3d`,this._outlineVisualElement=null}initialize(){let{view:e,object:t}=this,n=this._bounds=new x(this,()=>this._updateManipulators());this._extentMove=new v(this,n),this._extentScale=new b(this,n,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new y(this,n,()=>this._snapRotation.createDragEventPipelineStep()),this.addHandles([this._updatingHandles.add(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,0)),this._updatingHandles.add(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(e=>this._updateManipulatorAvailability(e,2))),this._updatingHandles.add(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,3))]),this._updateManipulators(),this._updateAllManipulatorAvailability();let a=_({view:e,object:t,forEachManipulator:e=>this._forEachManipulator(e),onManipulatorsChanged:()=>r()});if(a!=null){let{visualElement:e}=a;e instanceof w&&(this._outlineVisualElement=e,this.addHandles(e.events.on(`attachment-origin-changed`,()=>this._bounds.updateDisplayBounds()))),this.addHandles(a)}this.addHandles([t.on(`committed`,()=>this._onGeometryChanged()),this._updatingHandles.add(()=>this.object.visible,()=>this._updateAllManipulatorAvailability()),this._updatingHandles.add(()=>this.object.isDraped,()=>this._graphicDrapedChanged(),i),this._updatingHandles.add(()=>e.pointsOfInterest?.centerOnSurfaceFrequent.location,()=>n.updateDisplayBounds())]),this._forEachManipulator(e=>{this.addHandles(e.events.on(`grab-changed`,()=>{this._updateAllManipulatorAvailability()}))}),this._forEachManipulator((e,n)=>{this.addHandles(e.events.on(`immediate-click`,e=>{n===1&&this.events.emit(`immediate-click`,{...e,object:t}),e.stopPropagation()}))}),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy(),this._set(`view`,null),this._set(`object`,null)}_initializeTooltip(){let{view:e}=this;this.tooltip=O(()=>({view:e,options:this.toolOptions.tooltips}));let t=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([this._updatingHandles.add(()=>[this.toolOptions.tooltips.effectiveEnabled,this.preserveAspectRatio],t)]),this._forEachManipulator(e=>{this.addHandles([e.events.on([`focus-changed`,`grab-changed`],t),e.events.on(`drag`,e=>{e.action===`cancel`?this.tooltip.clear():t()})])})}_getUpdatedTooltipInfo(){return this.toolOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(A),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on(`elevation-change`,e=>{this._attachmentOrigin!=null&&(!l(this._attachmentOrigin,M,e.spatialReference)||T(e.extent,M[0],M[1],e.spatialReference))&&this._bounds.updateDisplayBounds()}),A)}_updateManipulators(){if(!this.visible)return;let e=this._bounds.displayBounds,t=d(e,u.get());this._extentMove.updateManipulators(t,e),this._extentScale.updateManipulators(t,e),this._extentRotate.updateManipulators(t,e)}_updateAllManipulatorAvailability(){this.grabbing=this._activeManipulatorType()!=null,this._forEachManipulator((e,t)=>this._updateManipulatorAvailability(e,t)),this._updateManipulatorDisplay()}_updateManipulatorAvailability(e,t){let n=this.grabbing&&!e.grabbing;if(e.interactive=!n,e instanceof m){let r=this.object.visible,i=this.enableZ&&g(this.object.operations,this.object.elevationInfo);switch(t){case 3:e.available=r&&this.enableRotation;break;case 2:e.available=r&&(this.enableScaling||this.enableRotation||i),e.interactive=!n&&this.enableScaling,e.state=this.enableScaling&&(!this.grabbing||this._activeManipulatorType()===2)?f:p;break;case 0:e.available=r&&i;break;default:e.available=r}}}_activeManipulatorType(){let e=null;return this._forEachManipulator(({grabbing:t},n)=>{e==null&&t&&(e=n)}),e}_updateManipulatorDisplay(){if(this.removeHandles(j),this._activeManipulatorType()==null)return;let e=[];this._forEachManipulator((t,n)=>{t.grabbing||n!==3&&n!==0||e.push(t.disableDisplay?.())}),this.addHandles(e.filter(t),j)}_forEachManipulator(e){this._extentMove.forEachManipulator(e),this._extentScale.forEachManipulator(e),this._extentRotate.forEachManipulator(e)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(e){this._preserveAspectRatio.enabled=e,this._set(`preserveAspectRatio`,e)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(e){this._snapRotation.enabled=e,this._set(`snapRotation`,e)}get attachmentOrigin(){let e=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=e??this.object.origin??h(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancelDrag(){if(this.canUndo){let e=this.object.operations?.undo();e&&this._bounds.updateMapBoundsFromOperationInverse(e)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(this.inputState!=null)this.view.activeTool=null;else if(this.canUndo){let e=this.object.operations?.undo();e&&this._bounds.updateMapBoundsFromOperationInverse(e)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){let e=this.object.operations?.redo();e&&this._bounds.updateMapBoundsFromOperation(e)}}get test(){}};e([a()],k.prototype,`updating`,null),e([a({constructOnly:!0,nonNullable:!0})],k.prototype,`view`,void 0),e([a({constructOnly:!0,nonNullable:!0})],k.prototype,`object`,void 0),e([a()],k.prototype,`enableZ`,void 0),e([a()],k.prototype,`enableScaling`,void 0),e([a()],k.prototype,`enableRotation`,void 0),e([a({constructOnly:!0,type:D})],k.prototype,`toolOptions`,void 0),e([a()],k.prototype,`preserveAspectRatio`,null),e([a()],k.prototype,`snapRotation`,null),e([a()],k.prototype,`grabbing`,void 0),e([a()],k.prototype,`inputState`,void 0),e([a({readOnly:!0})],k.prototype,`type`,void 0),e([a()],k.prototype,`tooltip`,void 0),k=e([o(`esri.views.3d.interactive.editingTools.transform.ExtentTransformTool`)],k);const A=`draped-elevation-changes`,j=Symbol(),M=s();export{k as ExtentTransformTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as n}from"../../../../../core/colorUtils.js";import{cyclicalPI as r}from"../../../../../core/Cyclical.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as a,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{watch as c,initial as l}from"../../../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../../../core/scheduling.js";import{createScreenPointArray as d}from"../../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{fromRotation as m,fromScaling as h,multiply as g,scale as _,rotate as v}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as ee}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as y,subtract as b,length as x,squaredDistance as S,cross as C,add as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as T,clone as E}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as D,create as te,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as k,distance2 as A}from"../../../../../geometry/support/ray.js";import{sm4d as j,sv3d as M}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as N}from"../../Manipulator3D.js";import{calculateInputRotationTransform as P}from"../../manipulatorUtils.js";import{RenderObject as F}from"../../RenderObject.js";import{screenToRenderPlane as ne}from"../dragEventPipeline3D.js";import{ringIndicatorDelayMs as re,rotateIndicatorArrowPlacementPercentage as I,ringThickness as L,ringRadius as R,innerIndicatorRadius as ie,outerIndicatorRadius as z,rotateIndicatorArrowTipRadius as ae,rotateIndicatorArrowTipLength as oe,scaleIndicatorOffset1 as B,scaleIndicatorOffset2 as V,indicatorThickness as H,geometrySegments as U,rotateIndicatorArcLength as W,scaleIndicatorArcLength as G,rotateIndicatorDirectionBuffer as K,scaleIndicatorDirectionBuffer as se,ringHeight as q,dragThresholdPx as J,ringResetAnimationSpeedFactor as ce}from"../manipulations/config.js";import{createExtrudedTriangle as le,transformInPlace as ue,createPathExtrusionGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as fe}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as pe}from"../../../../interactive/dragEventPipeline.js";const Y={ScaleIn:32,ScaleOut:64,RotateLeft:128,RotateRight:256,Unlocked:1024,DelayedFocused:2048};let X=class extends t{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(e){this._ringManipulator.location=e}set elevationAlignedLocation(e){this._ringManipulator.elevationAlignedLocation=e}get grabbing(){return this._ringManipulator.grabbing}set interactive(e){this._ringManipulator.interactive=e}get updating(){return!!this._activeAnimation}constructor(e){super(e),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=re,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>this._scaleRotateDragData?.mode===`scale`?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([c(()=>{let{adapter:e}=this;return[e.angle,e.scale]},()=>this._updateManipulatorTransform())])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(e){this.cancelActiveAnimation(),e.start();let t=u({update:({deltaTime:t})=>{e.update(t)&&this.cancelActiveAnimation()}});this._activeAnimation={...e,frameTask:t}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=s(this._activeAnimation)}forEachManipulator(e){e(this._ringManipulator,4)}disableDisplay(){return this._ringManipulator.disableDisplay()}_createManipulator(){let e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);let t=this.tool.object,n=pe(e,(e,n,i)=>{this._scaleRotateDragData=null;let s=this.adapter.startInteraction(),c={mode:`none`,origin:E(e.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=c,this._updateDragState();let l=M.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,l),n.next(ne(this.tool.view,D(e.renderLocation,l,te()))).next(e=>{let n=O(e.plane),i=P(e.renderStart,e.renderEnd,c.origin,n),l=r.shortestSignedDiff(c.angle,i);c.angleDir=a(c.angleDir+l,-.3,K),c.angle=i;let u=me(c,e),d=u-this.adapter.scale;if(c.scaleDir=a(c.scaleDir+d,-.2,se),this._onScaleChanged(),c.mode===`none`){let n=this.mode||he(e,e.plane,c.origin,this.tool.view.state.camera);if(n!=null){switch(n){case`rotate`:this.tool.events.emit(`rotate-start`,{object:t,angle:0}),this.tool.events.emit(`record-undo`,{updates:[this.adapter.createUndoRecord()]});break;case`scale`:this.tool.events.emit(`scale-start`,{object:t,xScale:1,yScale:1}),this.tool.events.emit(`record-undo`,{updates:[this.adapter.createUndoRecord()]})}c.mode=n}}switch(c.mode){case`rotate`:s.state.angle=c.initialAngle+i;break;case`scale`:s.state.scale=u,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case`start`:case`update`:switch(c.mode){case`rotate`:this.tool.events.emit(`rotate`,{object:t,angle:o(c.angle)});break;case`scale`:this.tool.events.emit(`scale`,{object:t,xScale:u,yScale:u})}break;case`end`:switch(c.mode){case`rotate`:this.tool.events.emit(`rotate-stop`,{object:t,angle:o(c.angle)});break;case`scale`:this.tool.events.emit(`scale-stop`,{object:t,xScale:u,yScale:u})}}return e.action===`end`&&(this.startAnimation(Q(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),s.done()),e}),i.next(()=>{if(s.cancel(),this._scaleRotateDragData!=null){switch(this._scaleRotateDragData.mode){case`none`:break;case`rotate`:this.tool.events.emit(`rotate-stop`,{object:t,angle:0});break;case`scale`:this.tool.events.emit(`scale-stop`,{object:t,xScale:1,yScale:1})}this.startAnimation(Q(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}})});this.addHandles([n,e.events.on(`focus-changed`,e=>{e.action===`focus`?this.startAnimation(ge(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),e.events.on(`immediate-click`,e=>{e.stopPropagation()}),c(()=>this.tool.object.visible,e=>this._ringManipulator.available=e,l)])}_onScaleChanged(){this.events.emit(`scale-changed`),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Y.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Y.Unlocked,this._scaleRotateDragData==null||this._scaleRotateDragData?.mode===`none`),this._scaleRotateDragData!=null)switch(this._scaleRotateDragData.mode){case`rotate`:this._ringManipulator.updateStateEnabled(Y.ScaleIn|Y.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Y.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Y.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case`scale`:this._ringManipulator.updateStateEnabled(Y.RotateLeft|Y.RotateRight,!1),this._ringManipulator.updateStateEnabled(Y.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Y.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Y.ScaleIn|Y.ScaleOut|Y.RotateLeft|Y.RotateRight,!1)}_updateManipulatorTransform(){let e=m(j.get(),this.adapter.angle,T(0,0,1));if(e==null)return;let t=this.getScale(),n=h(j.get(),y(M.get(),t,t,t));this._ringManipulator.modelTransform=g(j.get(),n,e)}_createRingManipulator(){let e=(e,t,n)=>{let r=[],i=Math.ceil(U*(t-e)/(2*Math.PI));for(let a=0;a<i+1;a++){let o=e+a*(t-e)/i;r.push(T(n*Math.cos(o),n*Math.sin(o),0))}return r},t=t=>e(0,Math.PI*2,t),n=e=>[[-e/2,0],[e/2,0],[e/2,q/2],[-e/2,q/2]],r=this._createMaterial(1),i=(e,t,i=r)=>de(i,n(t),e,[],[],!1),a=t(R),o=i(a,L),s={left:[],right:[]},c=[];for(let t=0;t<2;t++){let n=t*Math.PI-Math.PI/4,a=Math.PI/2-W,o=n+a,l=n+Math.PI/2-a,u=e(o,l,ie),d=i(u,H);c.push(u),c.push(e(o,l,z-L/2)),s.left.push(d),s.right.push(d.instantiate());for(let e=0;e<2;e++){let t=e===0,n=ee();if(t){_(n,n,[1,-1,1]),v(n,n,-o,[0,0,1]);let e=Math.round(I*(u.length-1));n[12]=u[e][0],n[13]=u[e][1],n[14]=u[e][2]}else{v(n,n,l,[0,0,1]);let e=Math.round((1-I)*(u.length-1));n[12]=u[e][0],n[13]=u[e][1],n[14]=u[e][2]}let i=le(r,oe,0,ae,q);ue(i,n),(t?s.left:s.right).push(i)}}let l=[];for(let t=0;t<2;t++){let n=t*Math.PI-Math.PI/4,r=Math.PI/2-G,a=e(n+r,n+Math.PI/2-r,z);l.push(i(a,H))}let u=this._createMaterial(.66),d=this._createMaterial(.5),f=this._createMaterial(.33),p=t(R+B),m=t(R+V),h=i(p,H,u),g=i(m,H,f),y=t(R-B),b=t(R-V),x=i(y,H,u),S=i(b,H,f),C=[new F(o,Y.DelayedFocused),new F(o.instantiate({material:d}),0)];(!this.mode||this.mode===`scale`)&&(C=C.concat([...l.map(e=>new F(e,Y.DelayedFocused|Y.Unlocked)),new F(h,Y.DelayedFocused|Y.ScaleIn),new F(g,Y.DelayedFocused|Y.ScaleIn),new F(x,Y.DelayedFocused|Y.ScaleOut),new F(S,Y.DelayedFocused|Y.ScaleOut)])),(!this.mode||this.mode===`rotate`)&&(C=C.concat([...s.right.map(e=>new F(e.instantiate(),Y.DelayedFocused|Y.Unlocked)),...s.left.map(e=>new F(e,Y.DelayedFocused|Y.RotateLeft)),...s.right.map(e=>new F(e,Y.DelayedFocused|Y.RotateRight))]));let w=[a,...c];return new N({view:this.tool.view,renderObjects:C,autoScaleRenderObjects:!1,worldOriented:!0,radius:L,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:`ribbon`,paths:w,direction:T(0,0,1)}})}_createMaterial(e){let t=new fe({cullFace:2,renderOccluded:2,isDecoration:!0});return this.addHandles(c(()=>n(this.tool.view.effectiveTheme.accentColor,e),e=>t.setParameters({color:e}),l)),t}get test(){}};e([f({constructOnly:!0})],X.prototype,`tool`,void 0),e([f({constructOnly:!0})],X.prototype,`adapter`,void 0),e([f({constructOnly:!0})],X.prototype,`toolOptions`,void 0),e([f()],X.prototype,`mode`,void 0),e([f()],X.prototype,`_activeAnimation`,void 0),e([f()],X.prototype,`updating`,null),X=e([p(`esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform`)],X);function me(e,t){let n=b(M.get(),t.renderStart,e.origin),r=b(M.get(),t.renderEnd,e.origin),i=x(n),a=x(r);return i===0?0:a/i}function he(e,t,n,r){let{renderStart:i,renderEnd:a}=e,o=Z(i,r,M.get()),s=Z(a,r,M.get());if(S(o,s)<J*J)return null;let c=b(M.get(),i,n),l=C(M.get(),c,O(t)),u=i,d=w(M.get(),u,l),f=Z(n,r,M.get()),p=o,m=Z(d,r,M.get()),h=b(M.get(),m,p),g=b(M.get(),o,f),_=k(p,h),v=k(f,g);return A(_,s)<A(v,s)?`rotate`:`scale`}function Z(e,t,n){return t.projectToScreen(e,$),y(n,$[0],$[1],0)}function Q(e,t){let n=null,r=1,i=()=>r;return{start:()=>{r=e.getScale(),n=e.getScale,e.getScale=i,t()},update:e=>{let n=(r+1)/2-r;return r+=n*Math.min(e*ce,1),t(),+(Math.abs(r-1)<.01)},destroy:()=>{n&&(e.getScale=n),t()}}}function ge(e,t,n){let r=0,i=null,a=()=>!1;return{start:()=>{i=e.getFocused,e.getFocused=a,r=0,t()},update:e=>(r+=e,+(!i?.()||r>=n.delayMs)),destroy:()=>{i&&(e.getFocused=i),t()}}}const $=d();export{X as ScaleRotateTransform};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as n}from"../../../../../core/colorUtils.js";import{cyclicalPI as r}from"../../../../../core/Cyclical.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as a,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{watch as c,initial as l}from"../../../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../../../core/scheduling.js";import{createScreenPointArray as d}from"../../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{fromRotation as m,fromScaling as h,multiply as g,scale as _,rotate as v}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as ee}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as y,subtract as b,length as x,squaredDistance as S,cross as C,add as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as T,clone as E}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as D,create as te,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as k,distance2 as A}from"../../../../../geometry/support/ray.js";import{sm4d as j,sv3d as M}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as N}from"../../Manipulator3D.js";import{calculateInputRotationTransform as P}from"../../manipulatorUtils.js";import{RenderObject as F}from"../../RenderObject.js";import{screenToRenderPlane as ne}from"../dragEventPipeline3D.js";import{ringIndicatorDelayMs as re,rotateIndicatorArrowPlacementPercentage as I,ringThickness as L,ringRadius as R,innerIndicatorRadius as ie,outerIndicatorRadius as z,rotateIndicatorArrowTipRadius as ae,rotateIndicatorArrowTipLength as oe,scaleIndicatorOffset1 as B,scaleIndicatorOffset2 as V,indicatorThickness as H,geometrySegments as U,rotateIndicatorArcLength as W,scaleIndicatorArcLength as G,rotateIndicatorDirectionBuffer as K,scaleIndicatorDirectionBuffer as se,ringHeight as q,dragThresholdPx as J,ringResetAnimationSpeedFactor as ce}from"../manipulations/config.js";import{createExtrudedTriangle as le,transformInPlace as ue,createPathExtrusionGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as fe}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as pe}from"../../../../interactive/dragEventPipeline.js";const Y={ScaleIn:32,ScaleOut:64,RotateLeft:128,RotateRight:256,Unlocked:1024,DelayedFocused:2048};let X=class extends t{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(e){this._ringManipulator.location=e}set elevationAlignedLocation(e){this._ringManipulator.elevationAlignedLocation=e}get grabbing(){return this._ringManipulator.grabbing}set interactive(e){this._ringManipulator.interactive=e}get updating(){return!!this._activeAnimation}constructor(e){super(e),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=re,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>this._scaleRotateDragData?.mode===`scale`?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([c(()=>{let{adapter:e}=this;return[e.angle,e.scale]},()=>this._updateManipulatorTransform())])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(e){this.cancelActiveAnimation(),e.start();let t=u({update:({deltaTime:t})=>{e.update(t)&&this.cancelActiveAnimation()}});this._activeAnimation={...e,frameTask:t}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=s(this._activeAnimation)}forEachManipulator(e){e(this._ringManipulator,4)}disableDisplay(){return this._ringManipulator.disableDisplay()}_createManipulator(){let e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);let t=this.tool.object,n=pe(e,(e,n,i)=>{this._scaleRotateDragData=null;let s=this.adapter.startInteraction(),c={mode:`none`,origin:E(e.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=c,this._updateDragState();let l=M.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,l),n.next(ne(this.tool.view,D(e.renderLocation,l,te()))).next(e=>{let n=O(e.plane),i=P(e.renderStart,e.renderEnd,c.origin,n),l=r.shortestSignedDiff(c.angle,i);c.angleDir=a(c.angleDir+l,-.3,K),c.angle=i;let u=me(c,e),d=u-this.adapter.scale;if(c.scaleDir=a(c.scaleDir+d,-.2,se),this._onScaleChanged(),c.mode===`none`){let n=this.mode||he(e,e.plane,c.origin,this.tool.view.state.camera);if(n!=null){switch(n){case`rotate`:this.tool.events.emit(`rotate-start`,{object:t,angle:0}),this.tool.events.emit(`record-undo`,{updates:[this.adapter.createUndoRecord()]});break;case`scale`:this.tool.events.emit(`scale-start`,{object:t,xScale:1,yScale:1}),this.tool.events.emit(`record-undo`,{updates:[this.adapter.createUndoRecord()]})}c.mode=n}}switch(c.mode){case`rotate`:s.state.angle=c.initialAngle+i;break;case`scale`:s.state.scale=u,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case`start`:case`update`:switch(c.mode){case`rotate`:this.tool.events.emit(`rotate`,{object:t,angle:o(c.angle)});break;case`scale`:this.tool.events.emit(`scale`,{object:t,xScale:u,yScale:u})}break;case`end`:switch(c.mode){case`rotate`:this.tool.events.emit(`rotate-stop`,{object:t,angle:o(c.angle)});break;case`scale`:this.tool.events.emit(`scale-stop`,{object:t,xScale:u,yScale:u})}}return e.action===`end`&&(this.startAnimation(Q(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),s.done()),e}),i.next(()=>{if(s.cancel(),this._scaleRotateDragData!=null){switch(this._scaleRotateDragData.mode){case`none`:break;case`rotate`:this.tool.events.emit(`rotate-stop`,{object:t,angle:0});break;case`scale`:this.tool.events.emit(`scale-stop`,{object:t,xScale:1,yScale:1})}this.startAnimation(Q(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}})});this.addHandles([n,e.events.on(`focus-changed`,e=>{e.action===`focus`?this.startAnimation(ge(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),e.events.on(`immediate-click`,e=>{e.stopPropagation()}),c(()=>this.tool.object.visible,e=>this._ringManipulator.available=e,l)])}_onScaleChanged(){this.events.emit(`scale-changed`),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Y.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Y.Unlocked,this._scaleRotateDragData==null||this._scaleRotateDragData?.mode===`none`),this._scaleRotateDragData!=null)switch(this._scaleRotateDragData.mode){case`rotate`:this._ringManipulator.updateStateEnabled(Y.ScaleIn|Y.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Y.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Y.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case`scale`:this._ringManipulator.updateStateEnabled(Y.RotateLeft|Y.RotateRight,!1),this._ringManipulator.updateStateEnabled(Y.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Y.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Y.ScaleIn|Y.ScaleOut|Y.RotateLeft|Y.RotateRight,!1)}_updateManipulatorTransform(){let e=m(j.get(),this.adapter.angle,T(0,0,1));if(e==null)return;let t=this.getScale(),n=h(j.get(),y(M.get(),t,t,t));this._ringManipulator.modelTransform=g(j.get(),n,e)}_createRingManipulator(){let e=(e,t,n)=>{let r=[],i=Math.ceil(U*(t-e)/(2*Math.PI));for(let a=0;a<i+1;a++){let o=e+a*(t-e)/i;r.push(T(n*Math.cos(o),n*Math.sin(o),0))}return r},t=t=>e(0,Math.PI*2,t),n=e=>[[-e/2,0],[e/2,0],[e/2,q/2],[-e/2,q/2]],r=this._createMaterial(1),i=(e,t,i=r)=>de(i,n(t),e,[],[],!1),a=t(R),o=i(a,L),s={left:[],right:[]},c=[];for(let t=0;t<2;t++){let n=t*Math.PI-Math.PI/4,a=Math.PI/2-W,o=n+a,l=n+Math.PI/2-a,u=e(o,l,ie),d=i(u,H);c.push(u),c.push(e(o,l,z-L/2)),s.left.push(d),s.right.push(d.instantiate());for(let e=0;e<2;e++){let t=e===0,n=ee();if(t){_(n,n,[1,-1,1]),v(n,n,-o,[0,0,1]);let e=Math.round(I*(u.length-1));n[12]=u[e][0],n[13]=u[e][1],n[14]=u[e][2]}else{v(n,n,l,[0,0,1]);let e=Math.round((1-I)*(u.length-1));n[12]=u[e][0],n[13]=u[e][1],n[14]=u[e][2]}let i=le(r,oe,0,ae,q);ue(i,n),(t?s.left:s.right).push(i)}}let l=[];for(let t=0;t<2;t++){let n=t*Math.PI-Math.PI/4,r=Math.PI/2-G,a=e(n+r,n+Math.PI/2-r,z);l.push(i(a,H))}let u=this._createMaterial(.66),d=this._createMaterial(.5),f=this._createMaterial(.33),p=t(R+B),m=t(R+V),h=i(p,H,u),g=i(m,H,f),y=t(R-B),b=t(R-V),x=i(y,H,u),S=i(b,H,f),C=[new F(o,Y.DelayedFocused),new F(o.instantiate({material:d}),0)];this.mode&&this.mode!==`scale`||(C=C.concat([...l.map(e=>new F(e,Y.DelayedFocused|Y.Unlocked)),new F(h,Y.DelayedFocused|Y.ScaleIn),new F(g,Y.DelayedFocused|Y.ScaleIn),new F(x,Y.DelayedFocused|Y.ScaleOut),new F(S,Y.DelayedFocused|Y.ScaleOut)])),this.mode&&this.mode!==`rotate`||(C=C.concat([...s.right.map(e=>new F(e.instantiate(),Y.DelayedFocused|Y.Unlocked)),...s.left.map(e=>new F(e,Y.DelayedFocused|Y.RotateLeft)),...s.right.map(e=>new F(e,Y.DelayedFocused|Y.RotateRight))]));let w=[a,...c];return new N({view:this.tool.view,renderObjects:C,autoScaleRenderObjects:!1,worldOriented:!0,radius:L,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:`ribbon`,paths:w,direction:T(0,0,1)}})}_createMaterial(e){let t=new fe({cullFace:2,renderOccluded:2,isDecoration:!0});return this.addHandles(c(()=>n(this.tool.view.effectiveTheme.accentColor,e),e=>t.setParameters({color:e}),l)),t}get test(){}};e([f({constructOnly:!0})],X.prototype,`tool`,void 0),e([f({constructOnly:!0})],X.prototype,`adapter`,void 0),e([f({constructOnly:!0})],X.prototype,`toolOptions`,void 0),e([f()],X.prototype,`mode`,void 0),e([f()],X.prototype,`_activeAnimation`,void 0),e([f()],X.prototype,`updating`,null),X=e([p(`esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform`)],X);function me(e,t){let n=b(M.get(),t.renderStart,e.origin),r=b(M.get(),t.renderEnd,e.origin),i=x(n),a=x(r);return i===0?0:a/i}function he(e,t,n,r){let{renderStart:i,renderEnd:a}=e,o=Z(i,r,M.get()),s=Z(a,r,M.get());if(S(o,s)<J*J)return null;let c=b(M.get(),i,n),l=C(M.get(),c,O(t)),u=i,d=w(M.get(),u,l),f=Z(n,r,M.get()),p=o,m=Z(d,r,M.get()),h=b(M.get(),m,p),g=b(M.get(),o,f),_=k(p,h),v=k(f,g);return A(_,s)<A(v,s)?`rotate`:`scale`}function Z(e,t,n){return t.projectToScreen(e,$),y(n,$[0],$[1],0)}function Q(e,t){let n=null,r=1,i=()=>r;return{start:()=>{r=e.getScale(),n=e.getScale,e.getScale=i,t()},update:e=>{let n=(r+1)/2-r;return r+=n*Math.min(e*ce,1),t(),+(Math.abs(r-1)<.01)},destroy:()=>{n&&(e.getScale=n),t()}}}function ge(e,t,n){let r=0,i=null,a=()=>!1;return{start:()=>{i=e.getFocused,e.getFocused=a,r=0,t()},update:e=>(r+=e,+(!i?.()||r>=n.delayMs)),destroy:()=>{i&&(e.getFocused=i),t()}}}const $=d();export{X as ScaleRotateTransform};