@arcgis/core 5.2.0-next.73 → 5.2.0-next.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +1 -0
- package/assets/esri/core/workers/chunks/{d3be4d914fc99a1d686c.js → 075e65cc4275ac886f08.js} +1 -1
- package/assets/esri/core/workers/chunks/087bd698b80ca0cea71e.js +1 -0
- package/assets/esri/core/workers/chunks/{b6c7b7b7f87dce5de811.js → 0bf644f93c180a2bc2f8.js} +1 -1
- package/assets/esri/core/workers/chunks/0d3b2d9a19383bb63f0a.js +1 -0
- package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +1 -0
- package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +1 -0
- package/assets/esri/core/workers/chunks/{1ca04ecf010e68863014.js → 0eb35e09765fd74eb698.js} +1 -1
- package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +1 -0
- package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +1 -0
- package/assets/esri/core/workers/chunks/1c49c9472167a2e0c923.js +1 -0
- package/assets/esri/core/workers/chunks/{cf360767310fb45660a8.js → 1cf8fb704c48ac3d3b15.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e44978ee677aa23163d.js → 2435ef7d11f8dbb920b7.js} +1 -1
- package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +1 -0
- package/assets/esri/core/workers/chunks/2740f755c3a322cbd477.js +1 -0
- package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +1 -0
- package/assets/esri/core/workers/chunks/28f87daaba1ae3441364.js +1 -0
- package/assets/esri/core/workers/chunks/2b93888e61ca638490cf.js +1 -0
- package/assets/esri/core/workers/chunks/2c31648a4b95275516ee.js +1 -0
- package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +1 -0
- package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +1 -0
- package/assets/esri/core/workers/chunks/305eea9c1fc4aee3309e.js +1 -0
- package/assets/esri/core/workers/chunks/30818b5ff0ce51b25d6f.js +1 -0
- package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +1 -0
- package/assets/esri/core/workers/chunks/36ec5b84e551ab08b24a.js +1 -0
- package/assets/esri/core/workers/chunks/3c28e2040cb4fb716eaa.js +1 -0
- package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +1 -0
- package/assets/esri/core/workers/chunks/4046bd65d7d0677f4600.js +1 -0
- package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +1 -0
- package/assets/esri/core/workers/chunks/{35fd2f765d2cb3f59a22.js → 42d5ed44111bea77ec71.js} +115 -115
- package/assets/esri/core/workers/chunks/43713bc6f7eea07259d0.js +1 -0
- package/assets/esri/core/workers/chunks/{36171c72a3c04b0d13ef.js → 43a65cab888d43954564.js} +1 -1
- package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +1 -0
- package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +1 -0
- package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +1 -0
- package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +1 -0
- package/assets/esri/core/workers/chunks/4d7a3b3aaf876da0891b.js +1 -0
- package/assets/esri/core/workers/chunks/4fe2cca405180af23364.js +1 -0
- package/assets/esri/core/workers/chunks/50b08415e072a49bc572.js +1 -0
- package/assets/esri/core/workers/chunks/519af918050b47f93516.js +1 -0
- package/assets/esri/core/workers/chunks/{bd311c85437743cf7d2f.js → 53d165b4f30fd64e5d8a.js} +1 -1
- package/assets/esri/core/workers/chunks/552d6aecc7d88d16227b.js +1 -0
- package/assets/esri/core/workers/chunks/5627f562dea8bae2f346.js +1 -0
- package/assets/esri/core/workers/chunks/5ba3a30b7cbfa9e3aa62.js +1 -0
- package/assets/esri/core/workers/chunks/5e1d84e97de0e662aaa9.js +1 -0
- package/assets/esri/core/workers/chunks/64a1ffc221e5b63b43fb.js +1 -0
- package/assets/esri/core/workers/chunks/{31669511cfddf116d991.js → 66e60351aacbd162775f.js} +1 -1
- package/assets/esri/core/workers/chunks/{c203df41f9d2e4b80889.js → 6743d726e45e7b660505.js} +1 -1
- package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +1 -0
- package/assets/esri/core/workers/chunks/6b783f440c4a5d36e879.js +1 -0
- package/assets/esri/core/workers/chunks/6dddd3df31961b9fda12.js +1 -0
- package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +1 -0
- package/assets/esri/core/workers/chunks/702b2381acf4d1f90094.js +1 -0
- package/assets/esri/core/workers/chunks/762be5d3e6aeaea33f74.js +29 -0
- package/assets/esri/core/workers/chunks/792303e4090c0c70c4ff.js +1 -0
- package/assets/esri/core/workers/chunks/7a24cc0f3b4eff2bdb8e.js +1 -0
- package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +1 -0
- package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +1 -0
- package/assets/esri/core/workers/chunks/81130dbcb738d40f723b.js +1 -0
- package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +1 -0
- package/assets/esri/core/workers/chunks/841c81c280114412c95b.js +1 -0
- package/assets/esri/core/workers/chunks/{96d861265566854760cd.js → 88fd698b940dadcc6dc5.js} +1 -1
- package/assets/esri/core/workers/chunks/8a36b999cbd65dd2f16c.js +1 -0
- package/assets/esri/core/workers/chunks/8ae3a6ddc87bf8315583.js +1 -0
- package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +1 -0
- package/assets/esri/core/workers/chunks/{7f208ef75ef2ce0d7cf9.js → 910c93bbbf8113a4a51f.js} +1 -1
- package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +1 -0
- package/assets/esri/core/workers/chunks/{509cfac9e5d86a8ee449.js → 936d44c7bc3a181e64a3.js} +1 -1
- package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +1 -0
- package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +1 -0
- package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +1 -0
- package/assets/esri/core/workers/chunks/a101152066dd56259619.js +1 -0
- package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +1 -0
- package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +1 -0
- package/assets/esri/core/workers/chunks/a6a2a4a2bae0d327d7ed.js +1 -0
- package/assets/esri/core/workers/chunks/a7a7d3289d4ca95f545f.js +1 -0
- package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +1 -0
- package/assets/esri/core/workers/chunks/aca5c524bd3c955e9243.js +1 -0
- package/assets/esri/core/workers/chunks/b14961a9f1f40028f141.js +1 -0
- package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +1 -0
- package/assets/esri/core/workers/chunks/b6cd165d0e58598f28a5.js +1 -0
- package/assets/esri/core/workers/chunks/b78f509fd8e95f728178.js +1 -0
- package/assets/esri/core/workers/chunks/b9c61b20bbc91cb63036.js +1 -0
- package/assets/esri/core/workers/chunks/b9d1bb106737a05290e1.js +1 -0
- package/assets/esri/core/workers/chunks/{faa55265020591fd2224.js → bc0395777c5c1adb1ddb.js} +1 -1
- package/assets/esri/core/workers/chunks/bf3dc3ad8df8488da3f0.js +1 -0
- package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +1 -0
- package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +1 -0
- package/assets/esri/core/workers/chunks/{b9953277d0cd4a01bdc6.js → c37b28f200b704ae6002.js} +1 -1
- package/assets/esri/core/workers/chunks/c67e4a848d41038367b8.js +1 -0
- package/assets/esri/core/workers/chunks/cff6390b863361eaeeed.js +1 -0
- package/assets/esri/core/workers/chunks/d1c7c877edc6948f3801.js +1 -0
- package/assets/esri/core/workers/chunks/d2172583ee6e481a66aa.js +1 -0
- package/assets/esri/core/workers/chunks/d633e98b0dfa0490e4de.js +1 -0
- package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +1 -0
- package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +1 -0
- package/assets/esri/core/workers/chunks/de5013f89f0eae93978f.js +1 -0
- package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +1 -0
- package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +1 -0
- package/assets/esri/core/workers/chunks/e59101f1d060d0a30a65.js +1 -0
- package/assets/esri/core/workers/chunks/{bee5e738ecf8680909c4.js → eaf26c1cc938789d5336.js} +1 -1
- package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +1 -0
- package/assets/esri/core/workers/chunks/ee9eb381e675d2d01260.js +1 -0
- package/assets/esri/core/workers/chunks/{014f9fd2818e2c9d9a3b.js → f43a0edf58941e2ac78e.js} +1 -1
- package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +1 -0
- package/assets/esri/core/workers/chunks/{4abd54518e35050feb90.js → f78acff510ca615d42e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{01c92e68fb17cf2d0e08.js → f7a5c4d22a24e1ac433c.js} +1 -1
- package/assets/esri/core/workers/chunks/fb0b89bbb4f8607d5f20.js +1 -0
- package/assets/esri/core/workers/chunks/ff890167ff2baabfc4ce.js +1 -0
- package/chunks/GaussianSplat.glsl.js +8 -8
- package/chunks/GaussianSplatShadow.glsl.js +4 -5
- package/chunks/OccludedGeometryDepth.glsl.js +5 -0
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/config.js +1 -1
- package/core/importUtils.js +2 -0
- package/geometry/operators/importUtils.js +2 -0
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/normalizeUtils.d.ts +17 -15
- package/geometry/support/normalizeUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +22 -0
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/layersMapping.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/rest/identify.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryPivot.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +8 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClear.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClearTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualize.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +28 -21
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepthTechnique.js +2 -0
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/plugins/PolylinePlugin.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/drawToolUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/draw/support/reshapeTooltipUtils.js +1 -1
- package/views/draw/support/tooltipUtils.js +1 -1
- package/views/interactive/options/InteractiveToolOptions.d.ts +36 -0
- package/views/interactive/options/InteractiveToolOptions.js +2 -0
- package/views/interactive/sketch/SketchOptions.d.ts +4 -3
- package/views/interactive/sketch/SketchOptions.js +1 -1
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/selection/SelectionOperation.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +29 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/assets/esri/core/workers/chunks/00cbff0b785e24e87d97.js +0 -1
- package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +0 -29
- package/assets/esri/core/workers/chunks/06c9aac75a01d3af6d54.js +0 -1
- package/assets/esri/core/workers/chunks/089f8c60e96d920a2cb2.js +0 -1
- package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +0 -1
- package/assets/esri/core/workers/chunks/0dbf31a663b5220a3136.js +0 -1
- package/assets/esri/core/workers/chunks/0df660dfd941cff3ea1d.js +0 -1
- package/assets/esri/core/workers/chunks/1418c03c4ab87f7ab5f4.js +0 -1
- package/assets/esri/core/workers/chunks/158d2ac0333d53556e33.js +0 -1
- package/assets/esri/core/workers/chunks/160b204cbf5bda2a29e9.js +0 -1
- package/assets/esri/core/workers/chunks/16cade1c2ddf44e336ee.js +0 -1
- package/assets/esri/core/workers/chunks/1b130af7d14eaae69d96.js +0 -1
- package/assets/esri/core/workers/chunks/1cc063aa2ddf44bbd515.js +0 -1
- package/assets/esri/core/workers/chunks/1e0140556c2e3fa72545.js +0 -1
- package/assets/esri/core/workers/chunks/1e5cb72830c7f32f2961.js +0 -1
- package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +0 -1
- package/assets/esri/core/workers/chunks/2a2ed7bd44010f24c2dd.js +0 -1
- package/assets/esri/core/workers/chunks/2bdb9b5365869081c936.js +0 -1
- package/assets/esri/core/workers/chunks/2f58e1f64df2da8259a2.js +0 -1
- package/assets/esri/core/workers/chunks/383304d33b496c5d8baa.js +0 -1
- package/assets/esri/core/workers/chunks/3aacb935d632834d4154.js +0 -1
- package/assets/esri/core/workers/chunks/3c8e98cf23ad8ef12fcb.js +0 -1
- package/assets/esri/core/workers/chunks/3d6b2d5ae647e140abaf.js +0 -1
- package/assets/esri/core/workers/chunks/3dc71e03a630dd50b28e.js +0 -1
- package/assets/esri/core/workers/chunks/3fd022df127af32782ce.js +0 -1
- package/assets/esri/core/workers/chunks/4344ab1250a1c550bf8b.js +0 -1
- package/assets/esri/core/workers/chunks/43de723f765ec8f268ac.js +0 -1
- package/assets/esri/core/workers/chunks/44b50d4716a2567ab6f1.js +0 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +0 -1
- package/assets/esri/core/workers/chunks/4695cd6120f60b234d5c.js +0 -1
- package/assets/esri/core/workers/chunks/4cf2b0558a4acc141429.js +0 -1
- package/assets/esri/core/workers/chunks/4e129b9f5772a06e580c.js +0 -1
- package/assets/esri/core/workers/chunks/5441f96cdd0660229efe.js +0 -1
- package/assets/esri/core/workers/chunks/56bbde1dff96b423fbb9.js +0 -1
- package/assets/esri/core/workers/chunks/582a1d468089b9986416.js +0 -1
- package/assets/esri/core/workers/chunks/5f201c77a09ae0df29d6.js +0 -1
- package/assets/esri/core/workers/chunks/6080e46fc79127500283.js +0 -1
- package/assets/esri/core/workers/chunks/613e799377bdb767c955.js +0 -1
- package/assets/esri/core/workers/chunks/623d5518bca227f643bd.js +0 -1
- package/assets/esri/core/workers/chunks/62811bca7ad2100c023c.js +0 -1
- package/assets/esri/core/workers/chunks/64176f7ae719289a2f79.js +0 -1
- package/assets/esri/core/workers/chunks/67d3ff7fcefaa7d5d27f.js +0 -1
- package/assets/esri/core/workers/chunks/6a9002fcba11e2cf3f2e.js +0 -1
- package/assets/esri/core/workers/chunks/72dcd4bd1a28bf8605c5.js +0 -1
- package/assets/esri/core/workers/chunks/73f228d966b89c73c9e9.js +0 -1
- package/assets/esri/core/workers/chunks/73f77f5a6907cb8d9a35.js +0 -1
- package/assets/esri/core/workers/chunks/77df0bb35d2688729479.js +0 -1
- package/assets/esri/core/workers/chunks/7a143ca61c0a70306185.js +0 -1
- package/assets/esri/core/workers/chunks/7e373d9c98ce910db9d2.js +0 -1
- package/assets/esri/core/workers/chunks/869d292a60747c93dc84.js +0 -1
- package/assets/esri/core/workers/chunks/86a4057572755b403548.js +0 -1
- package/assets/esri/core/workers/chunks/8c76f31a363dd0c3354d.js +0 -1
- package/assets/esri/core/workers/chunks/98e6c1d035755a074d24.js +0 -1
- package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +0 -1
- package/assets/esri/core/workers/chunks/a27cdf4c29dd50a6dab1.js +0 -1
- package/assets/esri/core/workers/chunks/a294dd12b5c708ce04af.js +0 -1
- package/assets/esri/core/workers/chunks/a7f42ada0aa69873a938.js +0 -1
- package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +0 -1
- package/assets/esri/core/workers/chunks/aff0e7761276036e029d.js +0 -1
- package/assets/esri/core/workers/chunks/b33d870cbfa238762c5e.js +0 -1
- package/assets/esri/core/workers/chunks/b599b7dadce8b8bc88f6.js +0 -1
- package/assets/esri/core/workers/chunks/b7d8817018b3d277c454.js +0 -1
- package/assets/esri/core/workers/chunks/b984b808d383974ca3d8.js +0 -1
- package/assets/esri/core/workers/chunks/ba4f419f46be09a9a55c.js +0 -1
- package/assets/esri/core/workers/chunks/bfb6566c27c09deb0929.js +0 -1
- package/assets/esri/core/workers/chunks/c25dc9073e73d6b44d88.js +0 -1
- package/assets/esri/core/workers/chunks/c45a5bcf26659daf02a1.js +0 -1
- package/assets/esri/core/workers/chunks/c715c585c42d8c2b86f5.js +0 -1
- package/assets/esri/core/workers/chunks/c7e9513f75b8ec205562.js +0 -1
- package/assets/esri/core/workers/chunks/c838cc1c786368b78598.js +0 -1
- package/assets/esri/core/workers/chunks/c866b66ba72d96453899.js +0 -1
- package/assets/esri/core/workers/chunks/c873383e7dae35dc1a61.js +0 -1
- package/assets/esri/core/workers/chunks/cd4e5c948d1bfa9b9a2d.js +0 -1
- package/assets/esri/core/workers/chunks/cfe31b7d1c6c05fbd268.js +0 -1
- package/assets/esri/core/workers/chunks/d08f81d545930a79fb2e.js +0 -1
- package/assets/esri/core/workers/chunks/d0c1bc90e474f706211c.js +0 -1
- package/assets/esri/core/workers/chunks/d607cf154218d20e4114.js +0 -1
- package/assets/esri/core/workers/chunks/d901f8503a73277cfa58.js +0 -1
- package/assets/esri/core/workers/chunks/da484787bd9fd3b13d15.js +0 -1
- package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +0 -1
- package/assets/esri/core/workers/chunks/e21b3490bfce75405e55.js +0 -1
- package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +0 -1
- package/assets/esri/core/workers/chunks/e4a2eefffe16cd5bb20f.js +0 -1
- package/assets/esri/core/workers/chunks/e602b91d8fdc36a92530.js +0 -1
- package/assets/esri/core/workers/chunks/e702abaeccef20b64a81.js +0 -1
- package/assets/esri/core/workers/chunks/ebd619533be077059494.js +0 -1
- package/assets/esri/core/workers/chunks/f475672ff4c2ec9367c2.js +0 -1
- package/assets/esri/core/workers/chunks/f69329b85b362b349a8c.js +0 -1
- package/assets/esri/core/workers/chunks/f721756a6c1593f96409.js +0 -1
- package/assets/esri/core/workers/chunks/fb51f823b25c827c6b29.js +0 -1
- package/assets/esri/core/workers/chunks/fba8065a3a6fbd877e23.js +0 -1
- package/assets/esri/core/workers/chunks/fec07a16b72cdcafc641.js +0 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +0 -2
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +0 -2
package/views/draw/DrawTool.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{ignoreAbortErrors as p}from"../../core/promiseUtils.js";import{when as u,initial as c,watch as h,syncAndInitial as g,on as m,sync as v}from"../../core/reactiveUtils.js";import{screenPointEqual as y,createScreenPoint as f}from"../../core/screenUtils.js";import{diff as M}from"../../core/accessorSupport/diffUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polygon.js";import{i as C,e as P}from"../../chunks/simplifyOperator.js";import{isPolygon as x}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as H}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as L}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as k}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as I,getMinSegmentsPerCurve as O}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as V}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as G,markHandled as T,getPointerType as j}from"./support/drawToolUtils.js";import{PluginContext as E}from"./support/PluginContext.js";import{viewEventToCommand as D}from"./support/input/drawToolInput.js";import{EditSessionManager as U}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as A}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as F}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as R}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as Z}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as B}from"./support/managers/SurfaceManager.js";import{TooltipManager as q}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as z}from"../input/InputManager.js";import{createCoordinateHelper as K}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as N}from"../interactive/InteractiveToolBase.js";import{KeyBindings as Q,mediaKeys as W,sketchKeys as $,advancedSketchKeys as J,tooltipKeys as X}from"../interactive/keybindings.js";import{isInputModeAvailable as Y}from"../interactive/tooltip/tooltipCommonUtils.js";const ee=Symbol();let te=class extends N{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new S,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new R,this.globalStateManager=new A({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new U({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new Z({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new F({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new q({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(u(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(V(e,t).then(e=>this._snappingVisualizer=e))},c)),this.addHandles([h(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,i,n,a])=>{this.surfaceManager?.destroy(),this.surfaceManager=new B({spatialReference:t,excludedGraphicsLayer:null,defaultZ:i,hasZ:n,view:e,elevationInfo:a,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},g),u(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),h(()=>[this.editGeometryOperations,this.sketchOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},c),m(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},v),m(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},v),h(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},v),m(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _zOfLastUserInput(){const e=this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin),t=e?.firstPointAddedBySession?.point;return t?.hasZ?t.z:null}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:n,elevationInfo:a,view:s}=this;return t&&i&&s?{defaultZ:e,directionOptions:n,elevationInfo:a,editGeometryOperations:t,sketchOptions:i,view:s,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*I()*s,minSegmentsPerCurve:O()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return K(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&x(e))try{const t=this._densificationParameters,i=H(e)&&t?new w({...L(e,t)}):e;if(!C(i))return P(i)}catch(t){return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return"3d"===this.view.type&&"point"===this.unprocessedGeometry?.type&&!!this.interactiveHandleManager?.allhandles?.find(e=>"primary"===e.role)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){const e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;if(e&&t.complete(e),0===t.pluginStack.length){const e=this.unprocessedGeometry,t=!e||"mesh"===e.type||C(e);this.emit("complete",{geometry:e,isSimple:t,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(h(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?G(e):null})},c)),this.addHandles([h(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},c),u(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:y}),h(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},v),this._keybindings.register(e,z.TOOL),h(()=>e.viewpoint,(e,t)=>{e&&t&&M(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],ee)}onDeactivate(){super.onDeactivate(),this.removeHandles(ee),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=D(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{T(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(T(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&T(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&Y(t.info)&&(await t.enterInputMode(),T(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&T(e):T(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(T(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:j(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager))}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&T(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:j(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=j(e.originalEvent),i=this._updateLastScreenPosition(e),n=this.interactiveHandleManager?.findHandleByManipulator(i,t);"touch"===t&&n&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const a=this.interactiveHandleManager?.findHandleDragging(),s=this.interactiveHandleManager?.capturingHandle,r=a??s??n;r&&!n&&T(e),"capture-when-engaged"===r?.captureMode||"capture-always"===r?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(r.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===j(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&"primary"===r.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(r.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===j(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&!r.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(r?.moveTo(i,{...this.movementCommandContext,pointerType:j(e.originalEvent)})):"grabbable-object"===r?.captureMode&&(this.interactiveHandleManager?.releaseHandle(s),await this._updatingHandles.addPromise(r.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=j(e.originalEvent),n=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,i);this.editable&&n&&(this._before(e)||(T(e),await this._updatingHandles.addPromise(n.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:i}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new Q,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(W.preserveAspectRatio,"constraint-aspect"),t($.center,"constraint-center"),i(J.toggleFollowManipulator,"toggle-manipulator-follow"),i($.undo,"undo"),i($.redo,"redo"),i($.complete,"complete"),i($.vertexAdd,"vertex-add"),i({key:X.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=f(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new E({drawTool:this,plugin:e,session:t}));return i.session=t,i}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.sketchOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();const i=this._segmentLabelsImportTask=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return p(i.promise)}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.sketchOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([_()],te.prototype,"_commandsSuspended",void 0),i([_()],te.prototype,"_zOfLastUserInput",null),i([_()],te.prototype,"_snappingVisualizer",void 0),i([_()],te.prototype,"_segmentLabels",void 0),i([_()],te.prototype,"_segmentLabelsImportTask",void 0),i([_()],te.prototype,"_tooltipDependencies",null),i([_()],te.prototype,"_editSessionManagerContext",null),i([_()],te.prototype,"_densificationParameters",null),i([_({constructOnly:!0,nonNullable:!0})],te.prototype,"view",void 0),i([_()],te.prototype,"automaticManipulatorSelection",void 0),i([_()],te.prototype,"updating",null),i([_()],te.prototype,"coordinateHelper",null),i([_()],te.prototype,"editGeometry",null),i([_()],te.prototype,"editGeometryOperations",null),i([_()],te.prototype,"unprocessedGeometry",null),i([_()],te.prototype,"simplifiedGeometryPreview",null),i([_()],te.prototype,"_suppressCoincidentPointOverlaysIn3D",null),i([_()],te.prototype,"_shapeVisualGeometry",null),i([_()],te.prototype,"_vertexVisualGeometry",null),i([_()],te.prototype,"snappingManager",void 0),i([_()],te.prototype,"sketchOptions",void 0),i([_()],te.prototype,"elevationInfo",void 0),i([_()],te.prototype,"hasZ",void 0),i([_()],te.prototype,"defaultZ",void 0),i([_()],te.prototype,"directionOptions",void 0),i([_()],te.prototype,"canUndo",null),i([_()],te.prototype,"canRedo",null),i([_()],te.prototype,"pluginStack",null),i([_()],te.prototype,"mostDownstreamPlugin",null),i([_()],te.prototype,"mostUpstreamPlugin",null),i([_()],te.prototype,"lastScreenPosition",void 0),i([_()],te.prototype,"positionOfLastUserInput",null),i([_()],te.prototype,"tooltipManager",void 0),i([_()],te.prototype,"measurementManager",void 0),i([_()],te.prototype,"globalStateManager",void 0),i([_()],te.prototype,"editSessionManager",void 0),i([_()],te.prototype,"lifecycleManager",void 0),i([_()],te.prototype,"surfaceManager",void 0),i([_()],te.prototype,"interactiveHandleManager",void 0),i([_()],te.prototype,"renderer",void 0),i([_()],te.prototype,"readPluginSetting",void 0),i([_()],te.prototype,"movementCommandContext",null),i([_()],te.prototype,"tooltip",null),i([_()],te.prototype,"activeTooltipInfo",null),i([_()],te.prototype,"helpMessageKey",null),i([_({constructOnly:!0})],te.prototype,"enableVertexVisuals",void 0),te=i([b("esri.views.draw.DrawTool")],te);export{te as DrawTool};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{ignoreAbortErrors as p}from"../../core/promiseUtils.js";import{when as u,initial as c,watch as h,syncAndInitial as g,on as m,sync as v}from"../../core/reactiveUtils.js";import{screenPointEqual as y,createScreenPoint as f}from"../../core/screenUtils.js";import{diff as M}from"../../core/accessorSupport/diffUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import S from"../../geometry/Polygon.js";import{i as C,e as P}from"../../chunks/simplifyOperator.js";import{isPolygon as H}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as x}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as L}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as O,getMinSegmentsPerCurve as k}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as T}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as V,markHandled as G,getPointerType as j,getPointerId as E}from"./support/drawToolUtils.js";import{PluginContext as D}from"./support/PluginContext.js";import{viewEventToCommand as U}from"./support/input/drawToolInput.js";import{EditSessionManager as A}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as F}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as R}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as Z}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as B}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as q}from"./support/managers/SurfaceManager.js";import{TooltipManager as z}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as K}from"../input/InputManager.js";import{createCoordinateHelper as N}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as Q}from"../interactive/InteractiveToolBase.js";import{KeyBindings as W,mediaKeys as $,sketchKeys as J,advancedSketchKeys as X,tooltipKeys as Y}from"../interactive/keybindings.js";import{isInputModeAvailable as ee}from"../interactive/tooltip/tooltipCommonUtils.js";const te=Symbol();let ie=class extends Q{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new w,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.toolOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new Z,this.globalStateManager=new F({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new A({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new B({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new R({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new z({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(u(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(T(e,t).then(e=>this._snappingVisualizer=e))},c)),this.addHandles([h(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,i,n,a])=>{this.surfaceManager?.destroy(),this.surfaceManager=new q({spatialReference:t,excludedGraphicsLayer:null,defaultZ:i,hasZ:n,view:e,elevationInfo:a,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},g),u(()=>this.toolOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),h(()=>[this.editGeometryOperations,this.toolOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},c),m(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},v),m(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},v),h(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},v),m(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _zOfLastUserInput(){const e=this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin),t=e?.firstPointAddedBySession?.point;return t?.hasZ?t.z:null}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,toolOptions:i,directionOptions:n,elevationInfo:a,view:s}=this;return t&&i&&s?{defaultZ:e,directionOptions:n,elevationInfo:a,editGeometryOperations:t,toolOptions:i,view:s,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*O()*s,minSegmentsPerCurve:k()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return N(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&H(e))try{const t=this._densificationParameters,i=x(e)&&t?new S({...I(e,t)}):e;if(!C(i))return P(i)}catch(t){return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return"3d"===this.view.type&&"point"===this.unprocessedGeometry?.type&&!!this.interactiveHandleManager?.allhandles?.find(e=>"primary"===e.role)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){const e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;if(e&&t.complete(e),0===t.pluginStack.length){const e=this.unprocessedGeometry,t=!e||"mesh"===e.type||C(e);this.emit("complete",{geometry:e,isSimple:t,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(h(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?V(e):null})},c)),this.addHandles([h(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},c),u(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:y}),h(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},v),this._keybindings.register(e,K.TOOL),h(()=>e.viewpoint,(e,t)=>{e&&t&&M(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],te)}onDeactivate(){super.onDeactivate(),this.removeHandles(te),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){"pointer-down"===e.type?this.interactiveHandleManager?.notePointerDown(e.pointerId,e.pointerType):"pointer-up"!==e.type&&"pointer-leave"!==e.type||this.interactiveHandleManager?.notePointerUp(e.pointerId,e.pointerType);const t=U(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{G(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(G(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&G(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&ee(t.info)&&(await t.enterInputMode(),G(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&G(e):G(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(G(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){if(!this.editable)return;const t=j(e.originalEvent),i=E(e.originalEvent);await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:t,pointerId:i})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager)}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=j(e.originalEvent),i=E(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(i,t))return;const n=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&G(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(n,{...this.movementCommandContext,pointerType:t,pointerId:i}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=j(e.originalEvent),i=E(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(i,t))return;const n=this._updateLastScreenPosition(e),a=this.interactiveHandleManager?.findHandleByManipulator(n,t);"touch"===t&&a&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const s=this.interactiveHandleManager?.findHandleDragging(),r=this.interactiveHandleManager?.capturingHandle,o=s??r??a;o&&!a&&G(e),"capture-when-engaged"===o?.captureMode||"capture-always"===o?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(o.noteDragEnd(n,{...this.movementCommandContext,pointerType:t,pointerId:i}).then(()=>{o&&"touch"===j(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&"primary"===o.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(o.noteDragStart(n,{...this.movementCommandContext,pointerType:t,pointerId:i}).then(()=>{o&&"touch"===j(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&!o.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(o?.moveTo(n,{...this.movementCommandContext,pointerType:t,pointerId:i})):"grabbable-object"===o?.captureMode&&(this.interactiveHandleManager?.releaseHandle(r),await this._updatingHandles.addPromise(o.moveTo(n,{...this.movementCommandContext,pointerType:t,pointerId:i})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=j(e.originalEvent),n=E(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,i))return;const a=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,i);this.editable&&a&&(this._before(e)||(G(e),await this._updatingHandles.addPromise(a.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:i,pointerId:n}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new W,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t($.preserveAspectRatio,"constraint-aspect"),t(J.center,"constraint-center"),i(X.toggleFollowManipulator,"toggle-manipulator-follow"),i(J.undo,"undo"),i(J.redo,"redo"),i(J.complete,"complete"),i(J.vertexAdd,"vertex-add"),i({key:Y.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=f(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new D({drawTool:this,plugin:e,session:t}));return i.session=t,i}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.toolOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();const i=this._segmentLabelsImportTask=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return p(i.promise)}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.toolOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([_()],ie.prototype,"_commandsSuspended",void 0),i([_()],ie.prototype,"_zOfLastUserInput",null),i([_()],ie.prototype,"_snappingVisualizer",void 0),i([_()],ie.prototype,"_segmentLabels",void 0),i([_()],ie.prototype,"_segmentLabelsImportTask",void 0),i([_()],ie.prototype,"_tooltipDependencies",null),i([_()],ie.prototype,"_editSessionManagerContext",null),i([_()],ie.prototype,"_densificationParameters",null),i([_({constructOnly:!0,nonNullable:!0})],ie.prototype,"view",void 0),i([_()],ie.prototype,"automaticManipulatorSelection",void 0),i([_()],ie.prototype,"updating",null),i([_()],ie.prototype,"coordinateHelper",null),i([_()],ie.prototype,"editGeometry",null),i([_()],ie.prototype,"editGeometryOperations",null),i([_()],ie.prototype,"unprocessedGeometry",null),i([_()],ie.prototype,"simplifiedGeometryPreview",null),i([_()],ie.prototype,"_suppressCoincidentPointOverlaysIn3D",null),i([_()],ie.prototype,"_shapeVisualGeometry",null),i([_()],ie.prototype,"_vertexVisualGeometry",null),i([_()],ie.prototype,"snappingManager",void 0),i([_()],ie.prototype,"toolOptions",void 0),i([_()],ie.prototype,"elevationInfo",void 0),i([_()],ie.prototype,"hasZ",void 0),i([_()],ie.prototype,"defaultZ",void 0),i([_()],ie.prototype,"directionOptions",void 0),i([_()],ie.prototype,"canUndo",null),i([_()],ie.prototype,"canRedo",null),i([_()],ie.prototype,"pluginStack",null),i([_()],ie.prototype,"mostDownstreamPlugin",null),i([_()],ie.prototype,"mostUpstreamPlugin",null),i([_()],ie.prototype,"lastScreenPosition",void 0),i([_()],ie.prototype,"positionOfLastUserInput",null),i([_()],ie.prototype,"tooltipManager",void 0),i([_()],ie.prototype,"measurementManager",void 0),i([_()],ie.prototype,"globalStateManager",void 0),i([_()],ie.prototype,"editSessionManager",void 0),i([_()],ie.prototype,"lifecycleManager",void 0),i([_()],ie.prototype,"surfaceManager",void 0),i([_()],ie.prototype,"interactiveHandleManager",void 0),i([_()],ie.prototype,"renderer",void 0),i([_()],ie.prototype,"readPluginSetting",void 0),i([_()],ie.prototype,"movementCommandContext",null),i([_()],ie.prototype,"tooltip",null),i([_()],ie.prototype,"activeTooltipInfo",null),i([_()],ie.prototype,"helpMessageKey",null),i([_({constructOnly:!0})],ie.prototype,"enableVertexVisuals",void 0),ie=i([b("esri.views.draw.DrawTool")],ie);export{ie as DrawTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{zeroDegreesGeographic as t,createLength as i}from"../../../core/quantity.js";import{watch as o,initial as s}from"../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isPolyline as l}from"../../../geometry/support/typeUtils.js";import{PluginBase as a}from"./PluginBase.js";import{knownFieldDisplayOrders as d}from"../support/types.js";import{directionForVertices as p}from"../../support/angularMeasurementUtils.js";const m=Symbol("polyline-committed-length-measurement"),u=Symbol("polyline-staged-measurement"),c=Symbol("polyline-cursor-distance-measurement"),h=Symbol("polyline-distance-field"),_=Symbol("polyline-direction-field"),y=Symbol("polyline-total-length-field");let g=class extends a{constructor(){super(...arguments),this._lineVisualId=Symbol()}get _downstreamGeometry(){return this._downstreamEditSession?.generatePreviewGeometry({includeAutomaticConnection:!0,geometryType:"polyline"})}get _downstreamEditSession(){const{_downstreamPlugin:e,_context:t}=this;return e?t?.getSession(e):null}get _committed(){return this._getCommittedGeometry()}get helpMessageKey(){return this._session?.lastPointAddedBySession?"polylineOneVertex":"polylineZeroVertices"}start(e){super.start(e);const{session:t}=e;t.automaticRestart=!1,e.addOrUpdateVisual(this._lineVisualId,{role:"outline",state:"active"}),this.addHandles([o(()=>this._downstreamEditSession?.lastPointAddedBySession,t=>{this._cursorVertex=t;const i=this._downstreamGeometry,o=this._session;t&&o?(this._lastVertex=null!=t.pointIndex&&t.pointIndex>0?o.getInformationAboutPoint(t.pointIndex-1,t.partIndex):null,this._secondToLastVertex=null!=t.pointIndex&&t.pointIndex>1?o.getInformationAboutPoint(t.pointIndex-2,t.partIndex):null):(this._lastVertex=null,this._secondToLastVertex=null),e.addOrUpdateVisual(this._lineVisualId,{geometry:i})},s)],this._ownHandlesKey),this._setupTooltips()}complete(){this._session?.complete(),this._isComplete=!0,this.removeHandles(this._ownHandlesKey),this.removeHandles(this._downstreamHandlesKey)}attachPlugin(e){this._downstreamPlugin=e,this.notifyChange("_downstreamEditSession")}detachPlugin(e,t){this.notifyChange("_committed"),"complete"===t&&e.configuration&&this._context?.requestBeginDownstreamPlugin(e.configuration)}_getCommittedGeometry(){return this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"polyline"})}_setupTooltips(){this._context&&(this._distanceField??=this._context.createMeasuredField({id:h,preset:"distance",getMeasurementInput:()=>[this._lastVertex?.point,this._cursorVertex?.point],measure:async(e,t)=>{if(!e||!e[0]||!e[1])return null;const i=t.inputUnitInfos.length.unit;return this._context?.measureDistance([e[0],e[1]],c,"tooltip",i)},fieldProperties:{displayOrder:d.Coordinates+11},fieldFilters:{appliesToHandlesWithRole:"primary"}}),this._directionField??=this._context.createMeasuredField({id:_,preset:"direction",getMeasurementInput:()=>[this._lastVertex?.point,this._cursorVertex?.point],measure:async([e,i],o)=>{const s=o.
|
|
2
|
+
import{__decorate as e}from"tslib";import{zeroDegreesGeographic as t,createLength as i}from"../../../core/quantity.js";import{watch as o,initial as s}from"../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isPolyline as l}from"../../../geometry/support/typeUtils.js";import{PluginBase as a}from"./PluginBase.js";import{knownFieldDisplayOrders as d}from"../support/types.js";import{directionForVertices as p}from"../../support/angularMeasurementUtils.js";const m=Symbol("polyline-committed-length-measurement"),u=Symbol("polyline-staged-measurement"),c=Symbol("polyline-cursor-distance-measurement"),h=Symbol("polyline-distance-field"),_=Symbol("polyline-direction-field"),y=Symbol("polyline-total-length-field");let g=class extends a{constructor(){super(...arguments),this._lineVisualId=Symbol()}get _downstreamGeometry(){return this._downstreamEditSession?.generatePreviewGeometry({includeAutomaticConnection:!0,geometryType:"polyline"})}get _downstreamEditSession(){const{_downstreamPlugin:e,_context:t}=this;return e?t?.getSession(e):null}get _committed(){return this._getCommittedGeometry()}get helpMessageKey(){return this._session?.lastPointAddedBySession?"polylineOneVertex":"polylineZeroVertices"}start(e){super.start(e);const{session:t}=e;t.automaticRestart=!1,e.addOrUpdateVisual(this._lineVisualId,{role:"outline",state:"active"}),this.addHandles([o(()=>this._downstreamEditSession?.lastPointAddedBySession,t=>{this._cursorVertex=t;const i=this._downstreamGeometry,o=this._session;t&&o?(this._lastVertex=null!=t.pointIndex&&t.pointIndex>0?o.getInformationAboutPoint(t.pointIndex-1,t.partIndex):null,this._secondToLastVertex=null!=t.pointIndex&&t.pointIndex>1?o.getInformationAboutPoint(t.pointIndex-2,t.partIndex):null):(this._lastVertex=null,this._secondToLastVertex=null),e.addOrUpdateVisual(this._lineVisualId,{geometry:i})},s)],this._ownHandlesKey),this._setupTooltips()}complete(){this._session?.complete(),this._isComplete=!0,this.removeHandles(this._ownHandlesKey),this.removeHandles(this._downstreamHandlesKey)}attachPlugin(e){this._downstreamPlugin=e,this.notifyChange("_downstreamEditSession")}detachPlugin(e,t){this.notifyChange("_committed"),"complete"===t&&e.configuration&&this._context?.requestBeginDownstreamPlugin(e.configuration)}_getCommittedGeometry(){return this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"polyline"})}_setupTooltips(){this._context&&(this._distanceField??=this._context.createMeasuredField({id:h,preset:"distance",getMeasurementInput:()=>[this._lastVertex?.point,this._cursorVertex?.point],measure:async(e,t)=>{if(!e||!e[0]||!e[1])return null;const i=t.inputUnitInfos.length.unit;return this._context?.measureDistance([e[0],e[1]],c,"tooltip",i)},fieldProperties:{displayOrder:d.Coordinates+11},fieldFilters:{appliesToHandlesWithRole:"primary"}}),this._directionField??=this._context.createMeasuredField({id:_,preset:"direction",getMeasurementInput:()=>[this._lastVertex?.point,this._cursorVertex?.point],measure:async([e,i],o)=>{const s=o.toolOptions.values.effectiveDirectionMode;if(e&&i){const o=p(this._secondToLastVertex?.point,e,i,s);return this._directionField&&(this._directionField.readOnly="absolute"===s?!e:!this._secondToLastVertex?.point),o??("absolute"===s||this._secondToLastVertex?t:null)}return null},fieldProperties:{displayOrder:d.Coordinates+10},fieldFilters:{appliesToHandlesWithRole:"primary"}}),this._setupGeometrySpecificTooltip())}_setupGeometrySpecificTooltip(){this._context&&(this._lengthField??=this._context.createMeasuredField({id:y,preset:"totalLength",getMeasurementInput:()=>[this._committed,this._downstreamGeometry],measure:async([e,t],o,s)=>{const n=o.inputUnitInfos.length.unit,r=t&&l(t)?await(this._context?.measureLength(t,u,"tooltip",n)):void 0,a=e&&e!==s?.[0]&&l(e)?await(this._context?.measureLength(e,m,"tooltip",n)):e?this._cachedCommittedLength:null;return this._cachedCommittedLength=a,(a||r)&&(e||0!==r?.value)?i((a?.value??0)+(r?.value??0),n):null},fieldProperties:{displayOrder:d.ShapeMeasurements}}))}};e([n()],g.prototype,"_downstreamPlugin",void 0),e([n()],g.prototype,"_lastVertex",void 0),e([n()],g.prototype,"_cursorVertex",void 0),e([n()],g.prototype,"_secondToLastVertex",void 0),e([n()],g.prototype,"_lengthField",void 0),e([n()],g.prototype,"_distanceField",void 0),e([n()],g.prototype,"_directionField",void 0),e([n()],g.prototype,"_downstreamGeometry",null),e([n()],g.prototype,"_downstreamEditSession",null),e([n()],g.prototype,"_committed",null),e([n()],g.prototype,"helpMessageKey",null),g=e([r("esri.views.draw.plugins.PolylinePlugin")],g);export{g as PolylinePlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{debounce as o}from"../../../core/promiseUtils.js";import{zeroMeters as r}from"../../../core/quantity.js";import{when as a,watch as h,syncAndInitial as c,initial as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../../core/support/UpdatingHandles.js";import d from"../../../geometry/Point.js";import m from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{create as g,center as y}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as v}from"../../../geometry/support/boundsUtils.js";import f from"../../../geometry/support/rotate.js";import G from"../../../symbols/SimpleFillSymbol.js";import b from"../../../symbols/SimpleLineSymbol.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as w,scale as S,getRotationAngle as k,getScaleRatio as R}from"./drawUtils.js";import H from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import T from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as O}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as E}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{GeometryWorkerHandle as L}from"../../support/GeometryWorkerHandle.js";const N=M.transformGraphics,z={centerIndicator:new x({style:"cross",size:N.center.size,color:N.center.color}),fill:{default:new G({color:N.fill.color,outline:{color:N.fill.outlineColor,join:"round",width:1}}),active:new G({color:N.fill.stagedColor,outline:{color:N.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new x({style:"square",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"square",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotator:{default:new x({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotatorLine:new b({color:N.line.color,width:1})},Y=Symbol();let A=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new T,this.view=null,this._updatingHandles=new _,this._getBounds=(()=>{const t=g();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=v(t,s);[i,o,r,a]=e}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})(),this._extentScaleTooltipInfo=new E({sketchOptions:this.sketchOptions}),this._measurementWorker=new L({preloadGeodetic:!0}),this._updateScaleTooltipAsync=o(async()=>{const t=this._getCoordinates(),e=this.view.spatialReference,{width:i,height:s}=await this._measurementWorker.autoSize2D(new d({x:t[0][0],y:t[0][1],spatialReference:e}),new d({x:t[1][0],y:t[1][1],spatialReference:e}),new d({x:t[2][0],y:t[2][1],spatialReference:e}),new d({x:t[3][0],y:t[3][1],spatialReference:e}));this._extentScaleTooltipInfo.xSize=i,this._extentScaleTooltipInfo.ySize=s}),this._translateTooltipInfo=new B({sketchOptions:this.sketchOptions}),this._updateMoveTooltipAsync=o(async t=>{const{view:e}=this,i=this._translateTooltipInfo;if(!t)return void(i.distance=r);const{x:s,y:o}=t.origin,a=e.toMap(t),h=e.toMap({x:s,y:o}),c=await this._measurementWorker.autoDistance2DBetweenPoints(h,a);i.distance=null!=c?c:r})}initialize(){const t=this.view;this._highlightHelper=new I({view:t}),this._setup(),this.addHandles([a(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),h(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),h(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),h(()=>this.graphics,()=>this.refresh()),h(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?O(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},c),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),n),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=w(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(!this._mover||!this.graphics.length)return;const i=this._getBoxBounds(g()),s=y(i);for(const o of this.graphics){const i=o.geometry,r=S(i,t,e,s);o.geometry=r}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new d(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new H({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),Y)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(g()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(g(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(Y),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:p}=e,{resolution:_,transform:m}=o.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],b=G.every(t=>"point"===t.type);if((0===p||0===c)&&b){const t=P((g-n)/_),i=P((l-y)/_);for(let e=0;e<G.length;e++)this.graphics[e].geometry=w(G[e],t,i,o,!0);return this._centerGraphic.geometry=new d(g,y,o.spatialReference),void(this._backgroundGraphic.geometry=w(e.box,t,i,o,!0))}if(s){const t=P(m[0]*r+m[2]*a+m[4],2),e=P(m[1]*r+m[3]*a+m[5],2),i=P(m[0]*n+m[2]*l+m[4],2),s=P(m[1]*n+m[3]*l+m[5],2);let o=R(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=S(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-n,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(p+(n>r?t:-1*t))/p,v=(c+(l<a?i:-1*i))/c;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/_,b=(h-a)/_,x=S(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=w(x,f,b,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),H=(k-r)/_,I=-1*(R-a)/_;for(const e of G){const t=G.indexOf(e),i=S(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=w(i,H,I,o,!0)}this._centerGraphic.geometry=new d(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new d(s,o,h),n=new d(e,i,h),l=t.geometry;this._angleOfRotation=k(c,l,n);const p=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const _ of p){const t=p.indexOf(_),e=f(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=f(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=f(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=w(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=w(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new m({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(g()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new d(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new d(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new u({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new d(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new d(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new d(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(g());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new j({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s}=this;if(null==t)return;const o=Math.abs(e),r=Math.abs(i),a=this._extentScaleTooltipInfo;a.sketchOptions=s,a.xScale=o,a.yScale=r,this._updatingHandles.consumePromise(this._updateScaleTooltipAsync()),t.info=a}_updateMoveTooltip(t){const{tooltip:e}=this;if(null==e)return;const i=this._translateTooltipInfo;this._updatingHandles.consumePromise(this._updateMoveTooltipAsync(t)),e.info=i}};function P(t,e=2){return Number.parseFloat(t.toFixed(e))}t([l()],A.prototype,"tooltip",void 0),t([l({readOnly:!0})],A.prototype,"type",void 0),t([l()],A.prototype,"callbacks",void 0),t([l()],A.prototype,"enableMovement",void 0),t([l()],A.prototype,"enableRotation",void 0),t([l()],A.prototype,"enableScaling",void 0),t([l()],A.prototype,"graphics",void 0),t([l()],A.prototype,"highlightName",void 0),t([l()],A.prototype,"highlightsEnabled",void 0),t([l()],A.prototype,"layer",void 0),t([l()],A.prototype,"preserveAspectRatio",void 0),t([l()],A.prototype,"showCenterGraphic",void 0),t([l({readOnly:!0})],A.prototype,"state",null),t([l()],A.prototype,"symbols",void 0),t([l({type:T})],A.prototype,"sketchOptions",void 0),t([l({constructOnly:!0})],A.prototype,"view",void 0),A=t([p("esri.views.draw.support.Box")],A);const U=A;export{U as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{debounce as s}from"../../../core/promiseUtils.js";import{zeroMeters as r}from"../../../core/quantity.js";import{when as a,watch as h,syncAndInitial as n,initial as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../../core/support/UpdatingHandles.js";import d from"../../../geometry/Point.js";import m from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{create as g,center as y}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as v}from"../../../geometry/support/boundsUtils.js";import f from"../../../geometry/support/rotate.js";import G from"../../../symbols/SimpleFillSymbol.js";import b from"../../../symbols/SimpleLineSymbol.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as w,scale as S,getRotationAngle as k,getScaleRatio as R}from"./drawUtils.js";import H from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import T from"../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as O}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as E}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{GeometryWorkerHandle as L}from"../../support/GeometryWorkerHandle.js";const N=M.transformGraphics,z={centerIndicator:new x({style:"cross",size:N.center.size,color:N.center.color}),fill:{default:new G({color:N.fill.color,outline:{color:N.fill.outlineColor,join:"round",width:1}}),active:new G({color:N.fill.stagedColor,outline:{color:N.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new x({style:"square",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"square",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotator:{default:new x({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotatorLine:new b({color:N.line.color,width:1})},Y=Symbol();let A=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.toolOptions=new T,this.view=null,this._updatingHandles=new _,this._getBounds=(()=>{const t=g();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const o of i){if(!o)continue;let i,s,r,a;if("point"===o.type)i=r=o.x,s=a=o.y;else if("extent"===o.type)[i,s,r,a]=[o.xmin,o.ymin,o.xmax,o.ymax];else{const e=v(t,o);[i,s,r,a]=e}e[0]=Math.min(i,e[0]),e[1]=Math.min(s,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})(),this._extentScaleTooltipInfo=new E({toolOptions:this.toolOptions}),this._measurementWorker=new L({preloadGeodetic:!0}),this._updateScaleTooltipAsync=s(async()=>{const t=this._getCoordinates(),e=this.view.spatialReference,{width:i,height:o}=await this._measurementWorker.autoSize2D(new d({x:t[0][0],y:t[0][1],spatialReference:e}),new d({x:t[1][0],y:t[1][1],spatialReference:e}),new d({x:t[2][0],y:t[2][1],spatialReference:e}),new d({x:t[3][0],y:t[3][1],spatialReference:e}));this._extentScaleTooltipInfo.xSize=i,this._extentScaleTooltipInfo.ySize=o}),this._translateTooltipInfo=new B({toolOptions:this.toolOptions}),this._updateMoveTooltipAsync=s(async t=>{const{view:e}=this,i=this._translateTooltipInfo;if(!t)return void(i.distance=r);const{x:o,y:s}=t.origin,a=e.toMap(t),h=e.toMap({x:o,y:s}),n=await this._measurementWorker.autoDistance2DBetweenPoints(h,a);i.distance=null!=n?n:r})}initialize(){const t=this.view;this._highlightHelper=new I({view:t}),this._setup(),this.addHandles([a(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),h(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),h(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),h(()=>this.graphics,()=>this.refresh()),h(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.toolOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?O(()=>({view:t,options:this.toolOptions.tooltips})):o(this.tooltip)},n),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),c),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=o(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const o=i.geometry,s=w(o,t,e,this.view);i.geometry=s}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(!this._mover||!this.graphics.length)return;const i=this._getBoxBounds(g()),o=y(i);for(const s of this.graphics){const i=s.geometry,r=S(i,t,e,o);s.geometry=r}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new d(t,i,this.view.spatialReference)}for(const i of this.graphics){const o=i.geometry,s=f(o,t,e);i.geometry=s}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new H({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),Y)}_getStartInfo(t){const[e,i,o,s]=this._getBoxBounds(g()),r=Math.abs(o-e),a=Math.abs(s-i),h=(o+e)/2,n=(s+i)/2,{x:c,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:n,startX:c,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,o,s,r]=this._getBounds(g(),[e]);return{width:Math.abs(s-i),height:Math.abs(r-o),centerX:(s+i)/2,centerY:(r+o)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:o,_backgroundGraphic:s,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:n}=this,{graphic:c,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),s.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),this._updateTooltip(c,_),c===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:c,graphics:n,angle:e})):r.includes(c)?(this._activeHandleGraphic=c,this.emit("scale-start",{type:"scale-start",mover:c,graphics:n,xScale:i,yScale:o})):this.emit("move-start",{type:"move-start",graphics:n,mover:c,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:o,_angleOfRotation:s,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:o});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:s});else{const{dx:i,dy:o}=t;this._totalDx+=i,this._totalDy+=o,this._moveGraphic(e,i,o),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:o})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:o,_totalDy:s,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:n,graphics:c}=this;this.refresh(),e===n?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:c,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:c,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:c,mover:e,dx:o,dy:s})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:o,_rotateHandleGraphic:s,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===s)return s.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(o.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const n=a.rotation;let c,l=t.index;switch(l<8&&(n>=0&&n<45?l%=8:l=n>=45&&n<90?(l+1)%8:n>=90&&n<135?(l+2)%8:n>=135&&n<180?(l+3)%8:n>=180&&n<225?(l+4)%8:n>=225&&n<270?(l+5)%8:n>=270&&n<315?(l+6)%8:(l+7)%8),l){case 0:case 4:c="nwse-resize";break;case 1:case 5:c="ns-resize";break;case 2:case 6:c="nesw-resize";break;case 3:case 7:c="ew-resize";break;default:c="pointer"}this._setCursor(c)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:o}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=o.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=o.handles.default),this.removeHandles(Y),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:o,view:s}=this,{centerX:r,centerY:a,graphicInfos:h,height:n,startX:c,startY:l,width:p}=e,{resolution:_,transform:m}=s.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],b=G.every(t=>"point"===t.type);if((0===p||0===n)&&b){const t=P((g-c)/_),i=P((l-y)/_);for(let e=0;e<G.length;e++)this.graphics[e].geometry=w(G[e],t,i,s,!0);return this._centerGraphic.geometry=new d(g,y,s.spatialReference),void(this._backgroundGraphic.geometry=w(e.box,t,i,s,!0))}if(o){const t=P(m[0]*r+m[2]*a+m[4],2),e=P(m[1]*r+m[3]*a+m[5],2),i=P(m[0]*c+m[2]*l+m[4],2),o=P(m[1]*c+m[3]*l+m[5],2);let s=R(t,e,i,o,v,f);0!==s&&Math.abs(s)!==1/0||(s=1),this._xScale=this._yScale=s;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=S(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-c,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const o=r+t/2,h=a+i/2;let m=(p+(c>r?t:-1*t))/p,v=(n+(l<a?i:-1*i))/n;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(o-r)/_,b=(h-a)/_,x=S(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=w(x,f,b,s,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),H=(k-r)/_,I=-1*(R-a)/_;for(const e of G){const t=G.indexOf(e),i=S(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=w(i,H,I,s,!0)}this._centerGraphic.geometry=new d(k,R,s.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:o,startY:s,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,n=new d(o,s,h),c=new d(e,i,h),l=t.geometry;this._angleOfRotation=k(n,l,c);const p=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const _ of p){const t=p.indexOf(_),e=f(_,this._angleOfRotation,c);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=f(r,this._angleOfRotation,c),this._rotateHandleGraphic.geometry=f(a,this._angleOfRotation,c)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const o=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(o,e,i,this.view);for(const s of this.graphics)s!==t&&(s.geometry=w(s.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const o of this.graphics)o.geometry=w(o.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let o=0;o<8;o++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[o,s]=t[i];this._updateXY(e,o,s)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new m({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,o]=this._getBoxBounds(g()),s=(i+t)/2,r=(o+e)/2;this._centerGraphic.geometry=new d(s,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new d(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new u({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new d(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new d(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new d(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,o,s]=this._getBoxBounds(g());if(t){const t=(e+o)/2,r=(s+i)/2;return[[e,s],[t,s],[o,s],[o,r],[o,i],[t,i],[e,i],[e,r]]}return[[e,s],[o,s],[o,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:o,_vertexGraphics:s,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():s.includes(t)?this._updateScaleTooltip():(o.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new j({toolOptions:this.toolOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,toolOptions:o}=this;if(null==t)return;const s=Math.abs(e),r=Math.abs(i),a=this._extentScaleTooltipInfo;a.toolOptions=o,a.xScale=s,a.yScale=r,this._updatingHandles.consumePromise(this._updateScaleTooltipAsync()),t.info=a}_updateMoveTooltip(t){const{tooltip:e}=this;if(null==e)return;const i=this._translateTooltipInfo;this._updatingHandles.consumePromise(this._updateMoveTooltipAsync(t)),e.info=i}};function P(t,e=2){return Number.parseFloat(t.toFixed(e))}t([l()],A.prototype,"tooltip",void 0),t([l({readOnly:!0})],A.prototype,"type",void 0),t([l()],A.prototype,"callbacks",void 0),t([l()],A.prototype,"enableMovement",void 0),t([l()],A.prototype,"enableRotation",void 0),t([l()],A.prototype,"enableScaling",void 0),t([l()],A.prototype,"graphics",void 0),t([l()],A.prototype,"highlightName",void 0),t([l()],A.prototype,"highlightsEnabled",void 0),t([l()],A.prototype,"layer",void 0),t([l()],A.prototype,"preserveAspectRatio",void 0),t([l()],A.prototype,"showCenterGraphic",void 0),t([l({readOnly:!0})],A.prototype,"state",null),t([l()],A.prototype,"symbols",void 0),t([l({type:T})],A.prototype,"toolOptions",void 0),t([l({constructOnly:!0})],A.prototype,"view",void 0),A=t([p("esri.views.draw.support.Box")],A);const U=A;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{valueInUnit as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{valueInUnit as r}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as a,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromArray as l,create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import g from"../../../geometry/Point.js";import{pointEquals as d}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as f}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as m,getPointConstraint as P,pointToConstraintSpace as y,constraintSpaceToPoint as v}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as S}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as M}from"../../interactive/snapping/SnappingOperation.js";let T=class extends e{constructor(t){super(t),this._snappingOperation=null,this.role="primary",this.captureMode="capture-always",this.defaultCaptureMode="capture-always",this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((t,e,n,i,o,r)=>n?new S({elevationInfo:i,pointer:t,vertexHandle:e,editGeometryOperations:n,visualizer:o,suppressSelfSnapping:!r}):null)}get grabbable(){return"grabbable-object"===this.captureMode}get following(){const{captureMode:t}=this;return"capture-always"===t||"capture-when-engaged"===t}get outputMapPosition(){return this._get("outputMapPosition")}set outputMapPosition(t){const e=this._get("outputMapPosition");t&&e&&d(t,e)||this._set("outputMapPosition",t)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){const t=this.editSession?.lastPointAddedBySession;if(!t)return null;const e=this.editSession?.getInformationAboutPoint(0,t.partIndex);return e?.point.hasZ?e.point.z:null}async moveTo(t,e){const{snappingManager:n,skipSnapping:i,surfaceManager:r,pointerType:s,editGeometryOperations:a,snappingVisualizer:p}=e;this.notePointerActivity(e.pointerId,s);const l=this._getSnappingContext(s??"mouse",this.editSession?.endVertex,a,r?.elevationInfo,p,this.selfSnappingEnabled),u=this._ensureSnappingOperation(e);t&&(this.screenPosition=t);const c=this.screenPosition;if(!c)return null;const f=this.firstPointZ,m=r?.screenToMap(c,{firstPointZ:f});if(this.inputMapPosition=m,this.selectedSnappingResult=null,!n||!m||!l||i||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,m,e);const P=h(m.x,m.y,m.z,m?.spatialReference),y=r?.screenToScene?.(c,{firstPointZ:f}),v=u.snap({point:P,scenePoint:y},n,l);return o(v.then(()=>{const t=u.stagedPoint;return d(this.selectedSnappingResult,t)||(this.selectedSnappingResult=new g({...t})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,m,e)}))}async moveDeltaRelativeToScreen(t,e,n){const{inputMapPosition:i,screenPosition:o,firstPointZ:r}=this;if(!i)return null;const a=n.surfaceManager?n.surfaceManager.mapToScreen(i,{firstPointZ:r}):o;if(!a)return null;const p=s(a.x+t,a.y+e);return this.moveTo(p,n)}async noteDragStart(t,e){if(this.notePointerDown(e.pointerId,e.pointerType),this.drawToolDragging=!0,e.skipSnapping||!this.snappingEnabled)return null;const{snappingManager:i,surfaceManager:r,pointerType:s,editGeometryOperations:a,snappingVisualizer:p}=e,l=this._getSnappingContext(s??"mouse",this.editSession?.endVertex,a,r?.elevationInfo,p,this.selfSnappingEnabled),u=this._ensureSnappingOperation(e),c=this.firstPointZ,d=r?.screenToMap(t,{firstPointZ:c});if(this.outputMapPositionOfDragStart=null,i&&l&&d){const s=u.snap({point:h(d.x,d.y,d.z,d?.spatialReference),scenePoint:r?.screenToScene?.(t,{firstPointZ:c})},i,l);return o(s.then(()=>{const t=u.stagedPoint?new g({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(t,d,e)})).catch(t=>(n.getLogger(this).error("drawtool:handle:snapping-failed",t),null))}return this.outputMapPositionOfDragStart=d,null}async noteDragEnd(t,e){return this.moveTo(t,e).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(e.pointerId,e.pointerType)})}notePointerActivity(t=null,e=null){e&&(this.activePointerType=e),null!=t&&this.dragging&&(this.activePointerId=t)}notePointerDown(t=null,e=null){null!=t&&(this.activePointerId=t),e&&(this.activePointerType=e)}notePointerUp(t=null,e=null){null!=t&&null!=this.activePointerId&&this.activePointerId!==t||(this.activePointerId=null),e&&this.activePointerType===e&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(t,e){const n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:i}=this,o=this.inputMapPosition?e.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:i})??this.screenPosition:this.screenPosition;if(!n||!o)return null;const r=e.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!r)return null;const s=e.surfaceManager?.mapToScreen(r,{firstPointZ:i});if(!s)return null;const a=[o.x-s.x,o.y-s.y],p=c(u(),l(a)),[g,d]=[p[0]*t,p[1]*t];return this.moveDeltaRelativeToScreen(g,d,e)}refreshConstraint(t){const e=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,e,t)}_finalizeSnappingAndConstraintResult(t,e,n){const i=t??e;i&&(i.z=f(n.snappingManager)??i.z);const o=(i?n.surfaceManager?.constrainZToEffectiveSurface?.(i):null)??i;return this._ensureZ(this._applyTooltipConstraints(o,n),n)}_applyTooltipConstraints(t,e){let n=t;const i=e.tooltipManager?.getConstraints(this);if(!i&&!e.interactiveHandleManager?.customConstraints)return n;if(!n)return n;const o=e.interactiveHandleManager?.customConstraints,s=e.editGeometryOperations?.data?.coordinateHelper;if(!s)return n;if(o&&this.editSession&&n){const t={handle:this,editSession:this.editSession,toScreen:t=>e.surfaceManager?.mapToScreen(t,{firstPointZ:this.firstPointZ})??null};for(const e of o)n=e(n,t)||n}const a=this.editSession?.endVertex,p=a?.leftSegment?.leftVertex,l=p?.leftSegment?.leftVertex,u=p&&s.vectorToPoint(p.pos),c=l&&s.vectorToPoint(l.pos);if(!i)return n;const d=(u||c)&&"primary"===this.role?m(u,c,i):P(i);if(!n||!i||!d)return n;const{context:h}=i,f=y(n,h),S=f?d.closestTo(f):void 0;if(!S)return n;const M=v(S,n,h),T="2d"===e.surfaceManager?.view?.type||"absolute-height"!==h.elevationInfo.mode,Z=i.elevation,{hasZ:w,metersPerVerticalUnit:x}=e.surfaceManager??{};if(null!=M&&T&&null!=Z&&w&&x&&(M.z=r(Z,"meters")/x),!M)return null;return new g({x:M.x,y:M.y,z:M.z,hasM:M.hasM,hasZ:M.hasZ,m:M.m,spatialReference:M.spatialReference})}_ensureZ(t,e){return t&&e.hasZ?(null!=t.z&&t.hasZ||(t.z=e.defaultZ??0,t.hasZ=!0),t):t}_ensureSnappingOperation({view:t}){return this._snappingOperation??=new M({view:t})}};t([a()],T.prototype,"_snappingOperation",void 0),t([a()],T.prototype,"role",void 0),t([a()],T.prototype,"name",void 0),t([a()],T.prototype,"captureMode",void 0),t([a()],T.prototype,"defaultCaptureMode",void 0),t([a()],T.prototype,"grabbable",null),t([a()],T.prototype,"following",null),t([a()],T.prototype,"snappingEnabled",void 0),t([a()],T.prototype,"selfSnappingEnabled",void 0),t([a()],T.prototype,"editSession",void 0),t([a()],T.prototype,"outputMapPosition",null),t([a()],T.prototype,"outputMapPositionOfDragStart",void 0),t([a()],T.prototype,"selectedSnappingResult",void 0),t([a()],T.prototype,"screenPosition",void 0),t([a()],T.prototype,"inputMapPosition",void 0),t([a()],T.prototype,"dragging",null),t([a()],T.prototype,"drawToolDragging",void 0),t([a()],T.prototype,"manipulatorDragging",void 0),t([a()],T.prototype,"activePointerId",void 0),t([a()],T.prototype,"activePointerType",void 0),t([a({readOnly:!0})],T.prototype,"firstPointZ",null),T=t([p("esri.views.draw.support.InteractiveHandle")],T);export{T as InteractiveHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as H}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as k,getEndpoint as O,isCircularArc as P,isEllipticArc4 as L,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as Z}from"./drawUtils.js";import $ from"./GraphicMover.js";import q from"./HighlightHelper.js";import{addUniqueLayer as X,isConnectedReshapeSupportedLayer as Y}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as ee}from"./reshapeTooltipUtils.js";import{defaultSymbols as te,createMidpointGraphics as ie,createVertexGraphics as se,createCurveControlPointGraphics as oe,createCurveConstructionLineGraphics as re,attributeKeys as ne,getMidpoint as ae,controlPointKinds as he,fastCloneGeometry as pe,saveUpdatedCurveOrCoordinate as le,toolIdAttribute as ce,splitCurve as de,isSingleSegmentCircle as me,isSingleSegmentEllipse as ve}from"./reshapeUtils.js";import{ViewEventPriorities as ue}from"../../input/InputManager.js";import{createCoordinateHelper as ye}from"../../interactive/coordinateHelper.js";import{sketchKeys as _e}from"../../interactive/keybindings.js";import{EditGeometryOperations as ge}from"../../interactive/editGeometry/EditGeometryOperations.js";import fe from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Ge}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const Se=Symbol(),Ce={mode:"on-the-ground",offset:0};let Ee=class extends r{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=te,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new fe,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new q({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,e=>{if(!e||!0===this._primaryGraphicMoving)return;const t=new Set(this.selectedManipulators.map(Re));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Re(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Re(e))).forEach(e=>this._addToSelection(e));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=be(()=>({view:e,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>e?.ready,()=>{const{layer:e,view:t}=this;X(t,e),this.addHandles(t.on("key-down",e=>this._keyDownHandler(e),ue.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??ye(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:e,activeTooltipInfo:t,graphic:i}=this;return{sketchOptions:e,activeTooltipInfo:t,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}get updating(){return!!(this._updatingHandles?.updating||this._connectedReshapeManager?.updating||this._segmentLabels?.updating||this.snappingManager?.updating)}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(const t of this.vertexGraphics)e.has(Re(t))&&this._addToSelection(t);for(const t of this.curveControlPointGraphics)e.has(Re(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=ge.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Ge({editGeometryOperations:i,elevationInfo:Ce,pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(Se),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),h(this._snappingGraphicsLayer)),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){const{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(h)}_removeVertexGraphics(e=this.layer){const{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(h)}_removeCurveGraphics(e=this.layer){const{curveControlPointGraphics:t,constructionLineGraphics:i}=this;e?.removeMany(t.items),e?.removeMany(i.items),t.drain(h),i.drain(h)}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type||"multipoint"===e.type)){const t=we(e);this.enableMidpoints&&"multipoint"!==e.type&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=ie(e,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const t=se(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{const t=se(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();const t=oe(e,this.symbols,this._coordinateHelper),i=re(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(t)}async _setupSegmentLabels(){const e=this._editGeometryOperations,t=this.sketchOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&e&&t){const t=this._segmentLabelsImportTask??=i(async e=>{const t=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(t);return e.aborted?null:i}),s=await this._updatingHandles.addPromise(t.promise);if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:e,elevationInfo:Ce,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",e),hover:this.symbols.vertices.hover?.clone().set("color",e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",e),hover:this.symbols.controlPoints.hover?.clone().set("color",e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",e)};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default;for(const t of this.curveControlPointGraphics)this._isSelected(t)?t.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===t?t.symbol=this.symbols.controlPoints.hover:t.symbol=this.symbols.controlPoints.default;for(const t of this.constructionLineGraphics)t.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes[ne.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();e&&"multipoint"!==t.geometry?.type&&r.push(t),this._mover=new $({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:e}=this;null!=e&&0!==e.length&&(this._connectedReshapeManager??=new K({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic,i=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(e);this.refresh(),s.length&&this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t)||i){if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)return void(i||this._removeVertices(t));e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e,o=this._connectedReshapeManager,r=o?je(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const t=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(e);i.length&&(this._emitVertexAddEvent([s],t,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(e),r){const e=n.filter(e=>this._isVertex(e));o?.startVertexMove(r,Ue(e))}this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:t,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const t of e){if("point"===t.geometry?.type){const{pathIndex:e,pointIndex:i}=t.attributes,s=k(n)[e][i];if(s){const e=O(s);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}}else{const e=we(n);this._updateVertexGraphicLocations(e)}this._connectedReshapeManager?.translate(t,o,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=e,{operationType:a}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&"move"===t){const e=new Set;for(const t of this.selectedManipulators)e.add(Re(t));return this.refresh(e),void this._updateTooltip()}this._isMidpoint(e)||e.getAttribute(ne.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,s){const o=e.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(e,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,t,r);c(i);const a=E(s);this._coordinateHelper.hasZ()||(a.z=void 0),this._syncGeometryAfterVertexMove(e,a,0,0),e.geometry=a}finally{a(),this._afterMoveStop(e,s)}})}_updateVertexGraphicLocations(e){const{_coordinateHelper:t}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=t.arrayToPoint(O(e[s][o]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){const{_coordinateHelper:i}=this;if(t)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!t.has(o))continue;const a=t.get(o);if(!a.has(r)&&!a.has(n))continue;const h=e[o];s.geometry=new G(ae(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:t,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=e[t];s.geometry=new G(ae(n[o],n[r],i))}}_updateCurveGraphicLocations(e){const{spatialReference:t}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[e,t]=Te(s);null!=e&&null!=t&&s.getAttribute(ne.controlPointKind)&&a(i,e,()=>new Set)?.add(t)}for(const s of this.curveControlPointGraphics){const[t,o]=Te(s);if(i.get(t)?.has(o))continue;const r=e[t][o];if(P(r)||L(r)){const i=O(e[t][o-1]),n=P(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const e=s.getAttribute(ne.controlPointKind),[t,i]=e===he.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:t,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(ne.controlPointKind),[o,r]=Te(s),n=e[o],a=O(n[r-1]),h=O(n[r]),p=e[o][r];i===he.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:t}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){const{componentIndex:t,vertexIndex:i}=e,s=e=>{const[s,o]=Te(e);s===t&&o>=i&&e.setAttribute(ne.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(ne.pathIndex)!==t)continue;const e=o.getAttribute(ne.pointIndexStart);e>=i&&(o.setAttribute(ne.pointIndexStart,e+1),o.setAttribute(ne.pointIndexEnd,o.getAttribute(ne.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){const[t,i]=Te(e);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=e.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(e,new G(this._stagedVertex),t,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=this._coordinateHelper.hasZ()?W(this.snappingManager)??i.z:void 0,this._stagedVertex=i,this._syncGeometryAfterVertexMove(e,new G(this._stagedVertex),t,s,h),r()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(e,i,t,s,h),r()}else r()}_syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=pe(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(t),h=this._getVertexFromEditGeometry(e);let p=null;if(h){const e=n.getZ(a);p=[h.pos[0],h.pos[1]];const t=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=e?e-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],t,i,s),this._connectedReshapeManager?.translate(t,i,s)}if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{if(e!==this.graphic){p&&!this._isVertex(e)&&(p=null);const o=n.spatialReference,[a,h]=Te(e);let l=Ie(r);const c=n.pointToArray(t);if(this._updateGeometryFromGraphic(e,l,a,h,c,o,"polygon"===r.type),this._isVertex(e)||this._isCurveControlPoint(e)){const t=new Map;t.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,e,c,t,p),l=this._moveSelectedHandleCoordinates(l,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,t),this._updateCurveGraphicLocations(l)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(l);le(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){const t=this._editGeometryOperations?.trySetGeometry(e);t||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Le(e,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=t.geometry.x,n.coordinate[1]=t.geometry.y,n.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(n));return e}const{relatedGraphicIndices:r}=t.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return e;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Te(o);s&&a(s,r,()=>new Set).add(p),Le(e,r,p,i,n),o.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==t){const[t,a]=Te(n),h=n.getAttribute(ne.relatedGraphicIndices),p=Z(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,e,t,a,l,r,o),h?.length)for(const i of h){const t=this.vertexGraphics.at(i),[s,o]=Te(t);Le(e,s,o,l,r),t.geometry=p}}return e}_updateGeometryFromGraphic(e,t,i,s,o,r,n){const a=t[i].length-1;this._isCurveControlPoint(e)?He(t,i,s,[o[0],o[1]],e.getAttribute(ne.controlPointKind)):(Le(t,i,s,o,r),n&&(0===s?Le(t,i,a,o,r):s===a&&(t[i][0]=o)))}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(Se),this._updateTooltip()}_handleMidpointClickOrStartMove(e){const{graphic:t}=e,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pe(i),o=[],{[ne.pathIndex]:r,[ne.pointIndexStart]:n,[ne.pointIndexEnd]:a}=t.attributes,h=C(t.geometry),p=0===a?n+1:a;t.attributes={[ne.tool]:ce,[ne.pathIndex]:r,[ne.pointIndex]:p,[ne.relatedGraphicIndices]:[]};const l=Ie(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){const e=O(l[r][p]);l[r].splice(p,1,{c:[e,[h[0],h[1]]]}),t.setAttribute(ne.controlPointKind,he.circle.interior),t.setAttribute(ne.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),le(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const e=O(l[r][n]),t=de(e,c,.5,this._coordinateHelper);l[r].splice(a,1,...t),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(e){const t=Ae(e);for(const i of t)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){const{vertices:i}=this.symbols;e.symbol=t?i.hover:i.default}else if(this._isCurveControlPoint(e)){const{controlPoints:i}=this.symbols;e.symbol=t?i.hover:i.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){const e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:i}=this.symbols;if(e.length>0){for(const s of e)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){null==this._activeOperationInfo&&xe(e,this.tooltip)||_e.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){const t=this.graphic.geometry,i=this.vertexGraphics.length;if(null==t||"polygon"!==t.type&&"polyline"!==t.type&&"multipoint"!==t.type)return;if("polygon"===t.type&&i<4||"multipoint"===t.type&&i<2||"polyline"===t.type&&i<3)return;const s=this.graphic.clone(),o=pe(t);let r=Ie(o);const n=[],a=Ae(e);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:e,y:t}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(e===a&&t===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const e=r[i][o];e&&!R(e)&&(r[i][o]=O(e))}}}}if("polygon"===o.type)r=r.filter(e=>{if(e.length<2)return!1;const[t,i]=O(e[0]),[s,o]=O(e[e.length-1]);return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);le(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){const t=this._isMidpoint(e)?"copy":"move";this.addHandles(this.view.acquireCursor(t,"high"),Se)}_updateTooltip(e,t){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:e===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(i=r.translateVertices,ee(i,o,n,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i={type:"move-start",mover:this.graphic,dx:e,dy:t};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i={type:"move",mover:this.graphic,dx:e,dy:t};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(e,t){if(null==e||null==t){const i=this._activeOperationInfo;if(!i)return;e=i.totalDx,t=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:e,dy:t};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t={type:"reshape-start",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t={type:"reshape",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t={type:"reshape-stop",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t={type:"vertex-select",added:e};this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t={type:"vertex-deselect",removed:e};this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s={type:"vertex-add",added:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s={type:"vertex-remove",removed:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function we(e){let t=Ie(e);t=t.map(e=>e.slice());for(const i of t)for(let e=0;e<i.length;e++)i[e]=A(i[e]);if("polygon"===e.type)for(const i of t){const e=i[i.length-1];if(!R(e))continue;const t=i[0];t[0]===e[0]&&t[1]===e[1]&&i.length>2&&i.pop()}return t}function Ie(e){return"polygon"===e.type?e.curveRings?.slice()??e.rings.slice():"polyline"===e.type?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ve(e,t,i,s){const o=e[t][i];if(P(o))o.c[1]=s;else if(L(o)){const o=O(e[t][i]);e[t][i]={c:[o,s]}}}function He(e,t,i,s,o){switch(o){case he.circle.interior:Ve(e,t,i,s);break;case he.bezier.cp1:e[t][i].b[1]=s;break;case he.bezier.cp2:e[t][i].b[2]=s}}function ke(e,t){return e<1e-8*t}function Oe(e,{cx:t,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=e,[l,c]=n,d=l-h,m=c-p;t-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[t,i]:v?[-i,t]:[i,-t],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(ke(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(ke(E**2+w**2,C)){const[e,t]=v?[-S,M]:[S,-M];return[e+M+h,t+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Pe(e,t,i){const s=x(new b({curvePaths:[[e,t]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:H(e,r)}function Le(e,t,i,s,o){const r=e[t][i],n=e[t].at(i+1);if(me(e,t)){const i=e[t][1];return e[t][0]=[...s],void(e[t][1]={a:[[...s],[...i.a[1]],0,0]})}if(ve(e,t)){const i=e[t][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return e[t][0]=[...s],void(e[t][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(P(r)||L(r)){const o=O(e[t][i-1]),n=P(r)?V(o,r):U(o,r);e[t].splice(i,1,{c:[[...s],Oe(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(e[t][i-1]);r.a=Pe(n,r,o).a}if(n&&!R(n)&&!T(r))if(P(n)||L(n)){const o=O(n),r=P(n)?V(a,n):U(a,n);e[t].splice(i+1,1,{c:[o,Oe(o,r,s,!1)]})}else if(j(n)){const e=O(r);n.a=Pe(e,n,o).a}}function Te({attributes:e}){return[e?.[ne.pathIndex]||0,e?.[ne.pointIndex]||0]}function Re({attributes:e}){return`${e?.[ne.pathIndex]}-${e?.[ne.pointIndex]}-${e?.[ne.controlPointKind]??"vertex"}`}function Ae(e){return e instanceof t?[e]:[...e]}function je(e){const t=e.sourceLayer??e.layer;return Y(t)?{graphic:e,layer:t}:null}function Ue(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[ne.pathIndex],vertexIndex:e[ne.pointIndex]}))}e([_()],Ee.prototype,"_activeOperationInfo",void 0),e([_()],Ee.prototype,"_connectedReshapeManager",void 0),e([_()],Ee.prototype,"_coordinateHelper",null),e([_()],Ee.prototype,"_editGeometryOperations",void 0),e([_()],Ee.prototype,"_effectiveFilterVerticesEnabled",null),e([_()],Ee.prototype,"_primaryGraphicMoving",void 0),e([_()],Ee.prototype,"_segmentLabels",void 0),e([_()],Ee.prototype,"test",null),e([_()],Ee.prototype,"_segmentLabelsImportTask",void 0),e([_()],Ee.prototype,"_updatingHandles",void 0),e([_()],Ee.prototype,"_selectedManipulator",null),e([_()],Ee.prototype,"_tooltipsContext",null),e([_()],Ee.prototype,"callbacks",void 0),e([_()],Ee.prototype,"connectedReshapeProviders",void 0),e([_()],Ee.prototype,"enableMidpoints",void 0),e([_()],Ee.prototype,"enableCurveOnMidpoint",void 0),e([_()],Ee.prototype,"enableMovement",void 0),e([_()],Ee.prototype,"enableVertices",void 0),e([_()],Ee.prototype,"filterVerticesEnabled",void 0),e([_()],Ee.prototype,"graphic",void 0),e([_()],Ee.prototype,"highlightName",void 0),e([_()],Ee.prototype,"highlightsEnabled",void 0),e([_()],Ee.prototype,"layer",void 0),e([_()],Ee.prototype,"snappingManager",void 0),e([_({readOnly:!0})],Ee.prototype,"state",null),e([_()],Ee.prototype,"symbols",void 0),e([_()],Ee.prototype,"tooltip",void 0),e([_()],Ee.prototype,"tooltipInfos",void 0),e([_()],Ee.prototype,"activeTooltipInfo",void 0),e([_()],Ee.prototype,"updating",null),e([_({type:fe})],Ee.prototype,"sketchOptions",void 0),e([_({readOnly:!0})],Ee.prototype,"type",void 0),e([_({readOnly:!0})],Ee.prototype,"vertexGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"curveControlPointGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"constructionLineGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"midpointGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"selectedManipulators",void 0),e([_()],Ee.prototype,"view",void 0),Ee=e([g("esri.views.draw.support.Reshape")],Ee);const Fe=Ee;export{Fe as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as H}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as P,isCircularArc as L,isEllipticArc4 as k,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as Z}from"./drawUtils.js";import $ from"./GraphicMover.js";import q from"./HighlightHelper.js";import{addUniqueLayer as X,isConnectedReshapeSupportedLayer as Y}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Mt}from"../../support/GeometryWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new q({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.toolOptions.tooltips})),this.tooltipInfos=B(this.toolOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;X(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.toolOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{toolOptions:t,activeTooltipInfo:e,graphic:i}=this;return{toolOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return!!(this._updatingHandles?.updating||this._connectedReshapeManager?.updating||this._segmentLabels?.updating||this.snappingManager?.updating)}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),h(this._snappingGraphicsLayer)),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.toolOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await this._updatingHandles.addPromise(e.promise);if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new $({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager??=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=O(n)[t][i];if(s){const t=P(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._coordinateHelper.hasZ()||(a.z=void 0),this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(P(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||k(r)){const i=P(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=P(n[r-1]),h=P(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=this._coordinateHelper.hasZ()?W(this.snappingManager)??i.z:void 0,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),kt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),kt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=Z(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);kt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?Ht(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(kt(e,i,s,o,r),n&&(0===s?kt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=P(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=P(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:P(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=P(s[o]);if(t===a&&e===h){n.push({coordinates:P(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=P(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=P(t[0]),[s,o]=P(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(k(o)){const o=P(t[e][i]);t[e][i]={c:[o,s]}}}function Ht(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ot(t,e){return t<1e-8*e}function Pt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ot(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ot(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:H(t,r)}function kt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=P(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||k(r)){const o=P(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Pt(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=P(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||k(n)){const o=P(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Pt(o,r,s,!1)]})}else if(j(n)){const t=P(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Y(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_()],Et.prototype,"toolOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../geometry/Multipoint.js";import{getEndpoint as
|
|
2
|
+
import t from"../../../geometry/Multipoint.js";import{getEndpoint as n}from"../../../geometry/support/curves/curveUtils.js";function e(t){if(!t)return"mouse";if("pointerType"in t)return t.pointerType;if("native"in t&&t.native&&"pointerType"in t.native){const n=t.native.pointerType;if("pen"===n||"touch"===n)return n}return"mouse"}function i(t){if(!t)return null;const n="native"in t?t.native:t;return"pointerId"in n&&"number"==typeof n.pointerId?n.pointerId:null}function o(t){const{originalEvent:n,stopPropagation:e}=t;n&&e&&"stopPropagation"in n&&n.stopPropagation()}function r(e){if("multipoint"===e.type||"point"===e.type)return e;const i=new t({spatialReference:e.spatialReference});return"polyline"===e.type?i.points=e.curvePaths?.flatMap(t=>t.map(t=>n(t)))??e.paths.flat():"polygon"===e.type&&(i.points=e.curveRings?.flatMap(t=>t.map(t=>n(t)))??e.rings.flat()),i}export{i as getPointerId,e as getPointerType,o as markHandled,r as multipointFromGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Collection.js";import{getOrCreateMapValue as a}from"../../../../core/MapUtils.js";import r from"../../../../core/ReactiveMap.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as p}from"../../DrawManipulator.js";import{DrawManipulator3D as d}from"../../DrawManipulator3D.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as c}from"../../../interactive/ManipulatorCollection.js";const h=Symbol("manipulator-handle-watch");let g=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new r,this._pluginHandleRegistry=new r,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new c,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){const{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t)return void this.followHandle(n.at(0)?.handle);const a=n.findIndex(({handle:e})=>e===t),r="forward"===e?a+1:a-1;this.followHandle(n.at(r%n.length)?.handle)}toggleFollow(){const e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;const t=this._handleManipulatorMap.find(e=>"grabbable-object"!==e.handle.defaultCaptureMode)?.handle;return!!t&&(this.followHandle(t),!0)}shouldCaptureInput(e=null,t=null){const n=this.capturingHandle;return!n||(null==e||null==n.activePointerId||n.activePointerId===e)&&("touch"!==t||"pen"!==n.activePointerType)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode="grabbable-object",e.drawToolDragging=!1),e&&e!==this.capturingHandle||(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode="grabbable-object"),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{"grabbable-object"!==e.captureMode&&(e.captureMode="grabbable-object")}),e&&(e.captureMode="grabbable-object"===e.defaultCaptureMode?"capture-always":e.defaultCaptureMode),"grabbable-object"!==e?.captureMode&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,a=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:r,manipulator:i})=>{if("grabbable-object"!==r.captureMode||!i.interactive)return;const o=i.intersectionDistance(e,t);null!=o&&o<a&&(a=o,n=r)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){const{view:a}=this,{surfaceManager:r}=n,l=n.editGeometryOperations?.data.coordinateHelper;if(!a||!r||!l)return;const s="3d"===a.type?new d({view:a,renderer:this.renderer,managedHandle:e}):new p({renderer:this.renderer,managedHandle:e});this._handleManipulatorMap.push({handle:e,manipulator:s}),this.manipulators.add(s),e.addHandles([i(()=>s.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],h),e.following&&(this.capturingHandle=e);const u=(e.inputMapPosition&&r.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(a?.width/2,a.height/2);await(e?.moveTo(u,{...n,pointerType:"mouse"}))}removeManipulatorForHandle(e){const t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(h)}registerHandle(e,t){const r=a(this._pluginHandleRegistry,e,()=>new n),i=new u(t);return r.push(i),i}unregisterHandle(e,t){const n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){a(this._pluginConstraintRegistry,e,()=>new r).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){const n=this._pluginHandleRegistry.get(e);if(n)for(const a of n)a.editSession=t}updateAllScreenPositions(e=null){const{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{const a=n.outputMapPosition;a&&(n.screenPosition=e?.mapToScreen(a,{firstPointZ:n.firstPointZ})??t?.toScreen(a))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}};e([l({constructOnly:!0})],g.prototype,"renderer",void 0),e([l({readOnly:!0})],g.prototype,"manipulators",void 0),e([l({constructOnly:!0})],g.prototype,"view",void 0),e([l()],g.prototype,"capturingHandle",void 0),e([l()],g.prototype,"customConstraints",null),e([l()],g.prototype,"focusedHandle",null),e([l()],g.prototype,"handleCount",null),e([l()],g.prototype,"allhandles",null),g=e([s("esri.views.draw.support.managers.InteractiveHandleManager")],g);export{g as InteractiveHandleManager};
|