@arcgis/core 5.0.0-next.58 → 5.0.0-next.59
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/Graphic.d.ts +2 -2
- package/Viewpoint.d.ts +1 -1
- package/applications/Urban/meshUtils.d.ts +2 -2
- package/arcade.d.ts +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0bd73a66baea2f52e8a6.js +1 -0
- package/assets/esri/core/workers/chunks/262c5794650853457acc.js +1 -0
- package/assets/esri/core/workers/chunks/55a9ea536c64976c3409.js +1 -0
- package/assets/esri/core/workers/chunks/{5f9e64f00329cb646f0c.js → 741d170187e58e81584d.js} +1 -1
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +2 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/config.js +1 -1
- package/geometry/Extent.d.ts +1 -1
- package/geometry/Mesh.d.ts +2 -2
- package/geometry/SpatialReference.js +1 -1
- package/geometry/geometryEngine.d.ts +3 -3
- package/geometry/{geometryEngineInterfaces.d.ts → geometryEngineTypes.d.ts} +1 -1
- package/geometry/operators/affineTransformOperator.d.ts +3 -3
- package/geometry/operators/alphaShapeOperator.d.ts +1 -1
- package/geometry/operators/areaOperator.d.ts +1 -1
- package/geometry/operators/boundaryOperator.d.ts +3 -3
- package/geometry/operators/bufferOperator.d.ts +1 -1
- package/geometry/operators/centroidOperator.d.ts +1 -1
- package/geometry/operators/clipOperator.d.ts +3 -3
- package/geometry/operators/containsOperator.d.ts +1 -1
- package/geometry/operators/convexHullOperator.d.ts +3 -3
- package/geometry/operators/crossesOperator.d.ts +1 -1
- package/geometry/operators/cutOperator.d.ts +2 -2
- package/geometry/operators/densifyOperator.d.ts +3 -3
- package/geometry/operators/differenceOperator.d.ts +3 -3
- package/geometry/operators/disjointOperator.d.ts +1 -1
- package/geometry/operators/distanceOperator.d.ts +1 -1
- package/geometry/operators/equalsOperator.d.ts +1 -1
- package/geometry/operators/generalizeOperator.d.ts +3 -3
- package/geometry/operators/geodesicBufferOperator.d.ts +1 -2
- package/geometry/operators/geodesicProximityOperator.d.ts +2 -5
- package/geometry/operators/geodeticAreaOperator.d.ts +1 -2
- package/geometry/operators/geodeticDensifyOperator.d.ts +3 -4
- package/geometry/operators/geodeticDistanceOperator.d.ts +1 -2
- package/geometry/operators/geodeticLengthOperator.d.ts +1 -2
- package/geometry/operators/geodeticUtilsOperator.d.ts +1 -1
- package/geometry/operators/graphicBufferOperator.d.ts +1 -1
- package/geometry/operators/integrateOperator.d.ts +2 -2
- package/geometry/operators/intersectionOperator.d.ts +3 -3
- package/geometry/operators/intersectsOperator.d.ts +1 -1
- package/geometry/operators/isNearOperator.d.ts +1 -1
- package/geometry/operators/labelPointOperator.d.ts +1 -1
- package/geometry/operators/lengthOperator.d.ts +1 -1
- package/geometry/operators/linesToPolygonsOperator.d.ts +1 -1
- package/geometry/operators/locateBetweenOperator.d.ts +2 -2
- package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
- package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
- package/geometry/operators/offsetOperator.d.ts +3 -3
- package/geometry/operators/overlapsOperator.d.ts +1 -1
- package/geometry/operators/projectOperator.d.ts +4 -6
- package/geometry/operators/proximityOperator.d.ts +2 -2
- package/geometry/operators/relateOperator.d.ts +1 -1
- package/geometry/operators/shapePreservingProjectOperator.d.ts +3 -3
- package/geometry/operators/simplifyOGCOperator.d.ts +3 -3
- package/geometry/operators/simplifyOperator.d.ts +3 -3
- package/geometry/operators/symmetricDifferenceOperator.d.ts +3 -3
- package/geometry/operators/touchesOperator.d.ts +1 -1
- package/geometry/operators/{support/proximityResult.d.ts → types.d.ts} +18 -3
- package/geometry/operators/unionOperator.d.ts +3 -3
- package/geometry/operators/withinOperator.d.ts +1 -1
- package/geometry/support/geodesicUtils.d.ts +15 -2
- package/geometry/support/jsonUtils.d.ts +1 -1
- package/geometry/support/meshUtils/types.d.ts +34 -0
- package/geometry/support/meshUtils.d.ts +4 -7
- package/geometry/support/webMercatorUtils.d.ts +1 -1
- package/geometry/types.d.ts +23 -1
- package/geometry.d.ts +1 -1
- package/interfaces.d.ts +69 -72
- package/kernel.js +1 -1
- package/layers/CSVLayer.d.ts +0 -2
- package/layers/CatalogLayer.d.ts +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/OGCFeatureLayer.d.ts +1 -1
- package/layers/OrientedImageryLayer.d.ts +1 -3
- package/layers/ParquetLayer.d.ts +1 -1
- package/layers/WFSLayer.d.ts +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +2 -2
- package/layers/mixins/APIKeyMixin.d.ts +2 -2
- package/layers/mixins/ArcGISImageService.d.ts +4 -3
- package/layers/mixins/BlendLayer.d.ts +16 -15
- package/layers/mixins/DisplayFilteredLayer.d.ts +6 -3
- package/layers/mixins/FeatureEffectLayer.d.ts +23 -21
- package/layers/mixins/FeatureLayerBase.d.ts +23 -20
- package/layers/mixins/ImageryTileMixin.d.ts +5 -5
- package/layers/mixins/PortalLayer.d.ts +7 -7
- package/layers/mixins/RasterPresetRendererMixin.d.ts +6 -3
- package/layers/mixins/SceneService.d.ts +2 -2
- package/layers/mixins/TemporalLayer.d.ts +8 -7
- package/layers/mixins/TemporalSceneLayer.d.ts +2 -2
- package/layers/mixins/TrackableLayer.d.ts +4 -4
- package/layers/ogc/wfsUtils.d.ts +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/functions/creators/createSurfaceFunctions.d.ts +2 -2
- package/layers/support/DisplayFilterInfo.d.ts +7 -7
- package/layers/support/FeatureReductionCluster.d.ts +5 -5
- package/layers/support/FieldsIndex.d.ts +1 -2
- package/layers/support/RasterBandInfo.d.ts +1 -1
- package/layers/support/RasterInfo.d.ts +2 -2
- package/layers/support/RasterSensorInfo.d.ts +1 -1
- package/layers/support/Sublayer.d.ts +3 -3
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/layers/support/TrackInfo.d.ts +2 -2
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/fieldUtils.d.ts +0 -1
- package/layers/support/source/QueryTableDataSource.d.ts +2 -2
- package/layers/support/types.d.ts +2 -2
- package/layers/types.d.ts +1 -1
- package/package.json +1 -1
- package/popup/FieldInfo.d.ts +8 -8
- package/popup/content/AttachmentsContent.d.ts +2 -2
- package/popup/content/CustomContent.d.ts +1 -1
- package/portal/interfaces.d.ts +2 -2
- package/portal/support/resourceUtils.d.ts +6 -7
- package/rest/featureService/types.d.ts +1 -1
- package/rest/geometryService.d.ts +2 -2
- package/rest/imageService.d.ts +1 -1
- package/rest/knowledgeGraph/GraphAnyValue.d.ts +1 -1
- package/rest/query/support/AttachmentInfo.d.ts +1 -1
- package/rest/query.d.ts +1 -1
- package/rest/support/BufferParameters.d.ts +1 -1
- package/rest/support/DataLayer.d.ts +1 -1
- package/rest/support/DensifyParameters.d.ts +1 -1
- package/rest/support/DistanceParameters.d.ts +1 -1
- package/rest/support/FeatureSet.d.ts +2 -2
- package/rest/support/FindImagesParameters.d.ts +1 -1
- package/rest/support/GeneralizeParameters.d.ts +1 -1
- package/rest/support/IdentifyParameters.d.ts +1 -1
- package/rest/support/ImageGPSInfoParameters.d.ts +1 -1
- package/rest/support/ImageMeasureResultAreaValue.d.ts +1 -1
- package/rest/support/ImageToMapMultirayParameters.d.ts +1 -1
- package/rest/support/OffsetParameters.d.ts +1 -1
- package/rest/support/ProjectParameters.d.ts +1 -1
- package/rest/support/Query.d.ts +1 -1
- package/rest/support/QueryMixin.d.ts +1 -1
- package/rest/support/RelationParameters.d.ts +1 -1
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/rest/support/TopFeaturesQuery.d.ts +1 -1
- package/smartMapping/labels/bins.d.ts +3 -6
- package/smartMapping/labels/clusters.d.ts +2 -2
- package/smartMapping/popup/clusters.d.ts +4 -4
- package/smartMapping/popup/templates.d.ts +4 -4
- package/smartMapping/renderers/color.d.ts +6 -6
- package/smartMapping/renderers/size.d.ts +6 -6
- package/smartMapping/statistics/support/ageUtils.d.ts +5 -5
- package/smartMapping/statistics/types.d.ts +5 -5
- package/smartMapping/types.d.ts +9 -1
- package/support/revision.js +1 -1
- package/unionTypes.d.ts +1 -1
- package/views/2d/MapViewConstraints.d.ts +5 -4
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/BreakpointsOwner.d.ts +1 -1
- package/views/LinkChartView.d.ts +1 -2
- package/views/MapView.d.ts +1 -2
- package/views/SceneView.d.ts +1 -2
- package/views/View.d.ts +1 -1
- package/views/Viewport2DMixin.d.ts +1 -1
- package/views/draw/MultipointDrawAction.d.ts +1 -1
- package/views/draw/MultipointDrawAction.js +1 -1
- package/views/draw/PointDrawAction.d.ts +1 -1
- package/views/draw/PointDrawAction.js +1 -1
- package/views/draw/PolygonDrawAction.d.ts +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.d.ts +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/SegmentDrawAction.d.ts +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/input/{IViewEvents.js → mouseButtons.js} +1 -1
- package/views/input/types.d.ts +602 -1
- package/views/layers/BuildingSceneLayerView.d.ts +1 -1
- package/views/layers/FeatureLayerViewMixin.d.ts +1 -1
- package/views/layers/ImageryLayerViewMixin.d.ts +1 -1
- package/views/layers/MediaLayerViewMixin.d.ts +1 -1
- package/views/layers/PointCloudLayerView.d.ts +1 -1
- package/views/layers/SceneLayerView.d.ts +2 -2
- package/views/types.d.ts +148 -2
- package/webdoc/geotriggersInfo/FeatureFilter.d.ts +1 -1
- package/webscene/support/FeatureReferenceObjectId.d.ts +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -2
- package/widgets/BasemapLayerList.d.ts +3 -4
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +1 -1
- package/widgets/CatalogLayerList.d.ts +2 -4
- package/widgets/Directions/DirectionsViewModel.d.ts +1 -1
- package/widgets/Editor/types.d.ts +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +2 -2
- package/widgets/FeatureTable/VisibleElements.d.ts +30 -9
- package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +1 -1
- package/widgets/FeatureTable/support/interfaces.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +4 -4
- package/widgets/LayerList/LayerListViewModel.d.ts +9 -10
- package/widgets/LayerList/ListItem.d.ts +9 -11
- package/widgets/LayerList/ListItemPanel.d.ts +1 -1
- package/widgets/LayerList.d.ts +7 -4
- package/widgets/Legend/LegendViewModel.d.ts +5 -5
- package/widgets/Legend/support/ActiveLayerInfo.d.ts +5 -5
- package/widgets/Legend.d.ts +4 -4
- package/widgets/Popup/types.d.ts +3 -3
- package/widgets/Popup.d.ts +3 -3
- package/widgets/TableList/TableListViewModel.d.ts +2 -4
- package/widgets/TableList.d.ts +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/052ded41dc06c93ec0a7.js +0 -1
- package/assets/esri/core/workers/chunks/a1f264abbd6354c333bf.js +0 -1
- package/assets/esri/core/workers/chunks/ed38c1043e6a83f49f93.js +0 -1
- package/geometry/geodesicUtils.d.ts +0 -19
- package/geometry/operators/support/geodeticCurveType.d.ts +0 -2
- package/geometry/operators/support/projectionTransformation.d.ts +0 -16
- package/geometry/support/MeshVertexSpace.d.ts +0 -4
- package/geometry/support/meshUtils/elevation.d.ts +0 -16
- package/geometry/support/meshUtils/elevationSampler.d.ts +0 -9
- package/geometry/support/meshUtils/georeference.d.ts +0 -10
- package/geometry/support/typeUtils.d.ts +0 -16
- package/smartMapping/popup/support/utils.d.ts +0 -13
- package/smartMapping/support/binningUtils.d.ts +0 -11
- package/smartMapping/support/clusterUtils.d.ts +0 -11
- package/smartMapping/support/utils.d.ts +0 -4
- package/views/2d/constraints/GeometryConstraint.d.ts +0 -4
- package/views/HitTestItem3D.d.ts +0 -20
- package/views/HitTestOptions.d.ts +0 -25
- package/views/IBreakpointsOwner.d.ts +0 -55
- package/views/IObjectId.d.ts +0 -2
- package/views/ISceneView.d.ts +0 -5
- package/views/IView.d.ts +0 -43
- package/views/input/IViewEvents.d.ts +0 -602
- /package/views/draw/input/{CursorUpdateEvents.d.ts → CursorUpdateEvent.d.ts} +0 -0
- /package/views/draw/input/{CursorUpdateEvents.js → CursorUpdateEvent.js} +0 -0
- /package/views/layers/{HighlightableLayerView.d.ts → types.d.ts} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as h,on as d,initial as u,syncAndInitial as c,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as M,e as b,l as x,h as y,i as O,j as E}from"../../../../../chunks/vec32.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as T}from"../../Manipulator3D.js";import{createManipulatorMaterial as G,createManipulatorOutlineMaterial as U,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as W}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ae,getUpdatedTranslateObjectTooltipInfo as ne,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as re,createSphereGeometry as le}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as pe}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as he,addMapDelta as de,createManipulatorDragEventPipeline as ue,dragAtLocation as ce,addScreenDelta as me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as fe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as _e}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ve,enterInputModeIfAvailable as Me}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const be=Symbol();let xe=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=G(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=U(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=G(a.color.toUnitRGBA(),a.renderOccluded),this._edgeManipulatorOutlineMaterial=U(a.outlineColor.toUnitRGBA(),a.renderOccluded);const n=t.edgeOffset;this._edgeOffsetManipulatorMaterial=G(n.color.toUnitRGBA(),n.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=G(n.hoverColor.toUnitRGBA(),n.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=G(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=U(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=ve(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([h(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ie(t)&&(t.edgeManipulator.available=e)}),h(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),h(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},u),ae(this.tooltip,this.object,()=>this._tooltipsContext),h(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),d(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!Me(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(be):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,be)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new W({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=_e({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(de()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},u)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=re(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=re(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new T({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:je(n)}),_=new T({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:je(n)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ue(f,this._createEdgeOffsetPipeline(v,t,a)),ue(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&ee(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),s(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(we,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(ce(this.view,r)).next(R(this.view,r,t,s,e)).next(me()).next(de()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(ce(this.view,a.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(de()).next(ye()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),h=J(n,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=p(d)},c=this.events.on("undo",u);return d=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==h?(u(),null):{...e,operation:r,plane:h},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=n()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<He){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<He){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!Me(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ie).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=Q(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,s=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?s(e):a()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),g),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,s=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(s.manipulators.vertex);this._vertexManipulatorGeometry=le(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=le(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(s.manipulators.edge);this._edgeManipulatorGeometry=le(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=le(this._edgeManipulatorOutlineMaterial,t,16,16)}const h="point"===r||"mesh"===r?[]:[new k(this._vertexManipulatorGeometry.instantiate(),4|Ve),new k(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ve),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve),new k(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&h.push(new k(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|De),new k(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|De),new k(this._edgeManipulatorGeometry.instantiate(),5|De),new k(this._edgeManipulatorOutlineGeometry.instantiate(),5|De));const d=new T({view:a,renderObjects:h,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:je(l)});d.selected=i,this._setTypeSpecificManipulatorSettings(d,e,t);const u="vertex"===e.type?{manipulator:d,handle:e,type:"vertex",selectedIndex:0}:{manipulator:d,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(d),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=o(e),this._manipulatorHandles.add(u.locationUpdateHandle,d)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(d,!0),d);const c=ue(d,(e,i,o,s)=>{let r=null;const{snappingStep:h,cancelSnapping:d}=_e({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(d);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(ce(a,c)).next(R(a,c,t,l,m)).next(he(a,t,m)).next(...h).next(de()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,d.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),d.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),d.events.on("focus-changed",()=>{this._resetTooltip()})],d),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.state=Ve,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=De,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ie(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Se),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(r,l,p,t.data.spatialReference)}else x(we,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=we}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(we,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ee(t,e):o&&(i=Ee(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Se.spatialReference=this._operations.data.spatialReference,Se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Se),this._moveManipulation.elevationAlignedLocation=Se):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const a of e){const e=a.handle.part;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightSegment));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a){e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===pe.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===pe.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ne(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function ye(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Oe(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ee(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Ie(e){return"edge"===e.type&&"edgeManipulator"in e}e([f()],xe.prototype,"_numGrabbing",void 0),e([f()],xe.prototype,"_numDragging",void 0),e([f()],xe.prototype,"_pendingEdgeOffsetInfo",void 0),e([f()],xe.prototype,"_operations",null),e([f()],xe.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],xe.prototype,"tool",void 0),e([f()],xe.prototype,"tooltip",void 0),e([f()],xe.prototype,"activeTooltipInfo",void 0),e([f({readOnly:!0})],xe.prototype,"updating",null),e([f()],xe.prototype,"manipulators",null),e([f()],xe.prototype,"view",null),e([f()],xe.prototype,"automaticAreaMeasurementUtils",null),e([f()],xe.prototype,"automaticLengthMeasurementUtils",null),e([f()],xe.prototype,"object",null),e([f()],xe.prototype,"enableZShape",null),e([f()],xe.prototype,"enableDeleteVertices",null),e([f()],xe.prototype,"enableZVertex",null),e([f()],xe.prototype,"autoHideManipulators",null),e([f()],xe.prototype,"enableMoveObject",null),e([f()],xe.prototype,"enableMidpoints",null),e([f()],xe.prototype,"enableEdgeOffset",null),e([f()],xe.prototype,"_sketchOptions",null),e([f()],xe.prototype,"_accentColor",null),e([f()],xe.prototype,"_tooltipsContext",null),xe=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],xe);const Se=D(0,0,void 0,V.WGS84),we=I(),He=1e-6,Ve=16,De=32;export{xe as ReshapeOperation};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as h,on as d,initial as u,syncAndInitial as c,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as M,e as b,l as x,h as y,i as O,j as E}from"../../../../../chunks/vec32.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as T}from"../../Manipulator3D.js";import{createManipulatorMaterial as G,createManipulatorOutlineMaterial as U,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as k}from"../../RenderObject.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as W}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ae,getUpdatedTranslateObjectTooltipInfo as ne,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as re,createSphereGeometry as le}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as pe}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as he,addMapDelta as de,createManipulatorDragEventPipeline as ue,dragAtLocation as ce,addScreenDelta as me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as fe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as _e}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ve,enterInputModeIfAvailable as Me}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const be=Symbol();let xe=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=G(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=U(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=G(a.color.toUnitRGBA(),a.renderOccluded),this._edgeManipulatorOutlineMaterial=U(a.outlineColor.toUnitRGBA(),a.renderOccluded);const n=t.edgeOffset;this._edgeOffsetManipulatorMaterial=G(n.color.toUnitRGBA(),n.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=G(n.hoverColor.toUnitRGBA(),n.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=G(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=U(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=ve(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([h(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ie(t)&&(t.edgeManipulator.available=e)}),h(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),h(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},u),ae(this.tooltip,this.object,()=>this._tooltipsContext),h(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),d(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!Me(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(be):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,be)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new W({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=_e({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(de()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},u)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=re(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=re(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new k(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new k(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new T({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:je(n)}),_=new T({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:je(n)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ue(f,this._createEdgeOffsetPipeline(v,t,a)),ue(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&ee(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),s(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(we,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(ce(this.view,r)).next(R(this.view,r,t,s,e)).next(me()).next(de()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(ce(this.view,a.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(de()).next(ye()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),h=J(n,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=p(d)},c=this.events.on("undo",u);return d=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==h?(u(),null):{...e,operation:r,plane:h},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=n()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<He){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<He){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!Me(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ie).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=Q(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,s=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?s(e):a()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),g),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,s=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(s.manipulators.vertex);this._vertexManipulatorGeometry=le(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=le(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(s.manipulators.edge);this._edgeManipulatorGeometry=le(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=le(this._edgeManipulatorOutlineMaterial,t,16,16)}const h="point"===r||"mesh"===r?[]:[new k(this._vertexManipulatorGeometry.instantiate(),4|Ve),new k(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ve),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve),new k(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new k(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&h.push(new k(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|De),new k(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|De),new k(this._edgeManipulatorGeometry.instantiate(),5|De),new k(this._edgeManipulatorOutlineGeometry.instantiate(),5|De));const d=new T({view:a,renderObjects:h,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:je(l)});d.selected=i,this._setTypeSpecificManipulatorSettings(d,e,t);const u="vertex"===e.type?{manipulator:d,handle:e,type:"vertex",selectedIndex:0}:{manipulator:d,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(d),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=o(e),this._manipulatorHandles.add(u.locationUpdateHandle,d)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(d,!0),d);const c=ue(d,(e,i,o,s)=>{let r=null;const{snappingStep:h,cancelSnapping:d}=_e({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(d);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(ce(a,c)).next(R(a,c,t,l,m)).next(he(a,t,m)).next(...h).next(de()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,d.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),d.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),d.events.on("focus-changed",()=>{this._resetTooltip()})],d),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.state=Ve,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=De,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ie(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Se),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(r,l,p,t.data.spatialReference)}else x(we,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=we}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(we,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ee(t,e):o&&(i=Ee(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Se.spatialReference=this._operations.data.spatialReference,Se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Se),this._moveManipulation.elevationAlignedLocation=Se):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const a of e){const e=a.handle.part;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightSegment));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a){e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===pe.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===pe.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ne(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function ye(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Oe(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ee(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Ie(e){return"edge"===e.type&&"edgeManipulator"in e}e([f()],xe.prototype,"_numGrabbing",void 0),e([f()],xe.prototype,"_numDragging",void 0),e([f()],xe.prototype,"_pendingEdgeOffsetInfo",void 0),e([f()],xe.prototype,"_operations",null),e([f()],xe.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],xe.prototype,"tool",void 0),e([f()],xe.prototype,"tooltip",void 0),e([f()],xe.prototype,"activeTooltipInfo",void 0),e([f({readOnly:!0})],xe.prototype,"updating",null),e([f()],xe.prototype,"manipulators",null),e([f()],xe.prototype,"view",null),e([f()],xe.prototype,"automaticAreaMeasurementUtils",null),e([f()],xe.prototype,"automaticLengthMeasurementUtils",null),e([f()],xe.prototype,"object",null),e([f()],xe.prototype,"enableZShape",null),e([f()],xe.prototype,"enableDeleteVertices",null),e([f()],xe.prototype,"enableZVertex",null),e([f()],xe.prototype,"autoHideManipulators",null),e([f()],xe.prototype,"enableMoveObject",null),e([f()],xe.prototype,"enableMidpoints",null),e([f()],xe.prototype,"enableEdgeOffset",null),e([f()],xe.prototype,"_sketchOptions",null),e([f()],xe.prototype,"_accentColor",null),e([f()],xe.prototype,"_tooltipsContext",null),xe=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],xe);const Se=D(0,0,void 0,V.WGS84),we=I(),He=1e-6,Ve=16,De=32;export{xe as ReshapeOperation};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BreakpointOrientation, Breakpoints, BreakpointSize } from "./
|
|
1
|
+
import type { BreakpointOrientation, Breakpoints, BreakpointSize } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export interface BreakpointsOwnerProperties extends Partial<Pick<BreakpointsOwner, "breakpoints" | "heightBreakpoint" | "widthBreakpoint">> {}
|
|
4
4
|
|
package/views/LinkChartView.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type WebLinkChart from "../WebLinkChart.js";
|
|
|
2
2
|
import type View2D from "./View2D.js";
|
|
3
3
|
import type ColorBackground from "../webmap/background/ColorBackground.js";
|
|
4
4
|
import type { ScreenPoint } from "../core/types.js";
|
|
5
|
-
import type { HitTestOptions } from "./
|
|
6
|
-
import type { ViewHitTestResult } from "./types.js";
|
|
5
|
+
import type { HitTestOptions, ViewHitTestResult } from "./types.js";
|
|
7
6
|
import type { ColorBackgroundProperties } from "../webmap/background/ColorBackground.js";
|
|
8
7
|
import type { WebLinkChartProperties } from "../WebLinkChart.js";
|
|
9
8
|
import type { View2DProperties } from "./View2D.js";
|
package/views/MapView.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type View2D from "./View2D.js";
|
|
2
2
|
import type { ScreenPoint } from "../core/types.js";
|
|
3
|
-
import type { HitTestOptions } from "./
|
|
4
|
-
import type { ViewHitTestResult, Screenshot, UserSettings } from "./types.js";
|
|
3
|
+
import type { HitTestOptions, ViewHitTestResult, Screenshot, UserSettings } from "./types.js";
|
|
5
4
|
import type { View2DProperties } from "./View2D.js";
|
|
6
5
|
|
|
7
6
|
export interface MapViewProperties extends View2DProperties {}
|
package/views/SceneView.d.ts
CHANGED
|
@@ -22,9 +22,8 @@ import type { ResourceHandle } from "../core/Handles.js";
|
|
|
22
22
|
import type { ScreenPoint } from "../core/types.js";
|
|
23
23
|
import type { BreakpointsOwner, BreakpointsOwnerProperties } from "./BreakpointsOwner.js";
|
|
24
24
|
import type { DOMContainer, DOMContainerProperties } from "./DOMContainer.js";
|
|
25
|
-
import type { HitTestOptions3D } from "./HitTestItem3D.js";
|
|
26
25
|
import type { PopupView, PopupViewProperties } from "./PopupView.js";
|
|
27
|
-
import type { SceneViewHitTestResult, GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
26
|
+
import type { HitTestOptions3D, SceneViewHitTestResult, GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
28
27
|
import type { LayerView3DFor } from "./3d/types.js";
|
|
29
28
|
import type { AnalysisView3DFor } from "./3d/analysis/types.js";
|
|
30
29
|
import type { Constraints, ConstraintsProperties } from "./3d/constraints/Constraints.js";
|
package/views/View.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { ReadonlyArrayOrCollection, ReadonlyCollection } from "../core/Coll
|
|
|
18
18
|
import type { EventedMixin, EventedMixinProperties } from "../core/Evented.js";
|
|
19
19
|
import type { EsriPromise, EsriPromiseMixinProperties } from "../core/Promise.js";
|
|
20
20
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
21
|
-
import type { SceneViewEventTypes } from "./
|
|
21
|
+
import type { SceneViewEventTypes } from "./types.js";
|
|
22
22
|
import type { Padding } from "./ui/types.js";
|
|
23
23
|
import type { GraphicProperties } from "../Graphic.js";
|
|
24
24
|
import type { HighlightOptionsProperties } from "./support/HighlightOptions.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventNames } from "../core/Evented.js";
|
|
2
2
|
import type { ResourceHandle } from "../core/Handles.js";
|
|
3
|
-
import type { SceneViewEventTypes } from "./
|
|
3
|
+
import type { SceneViewEventTypes } from "./types.js";
|
|
4
4
|
|
|
5
5
|
export interface Viewport2DMixinProperties {}
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { CursorUpdateEvent } from "./input/
|
|
2
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
3
3
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
4
4
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
5
5
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as s}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as n}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as a}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as d}from"../input/InputManager.js";import{sketchKeys as p}from"../interactive/keybindings.js";import{createScreenPointFromEvent as h}from"../support/screenUtils.js";const l=Symbol("view-handles"),c=Symbol("undo-redo-handles");let _=class extends o{constructor(e){super(e),this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1}initialize(){this._addViewHandles(),this._addUndoRedoHandles()}destroy(){this._removeViewHandles(),this._removeUndoRedoHandles(),this.emit("destroy")}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this._completeDrawing()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},d.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=h(e),"touch"===e.pointerType&&this._updateCursor())},d.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=h(e),"touch"!==e.pointerType&&this._updateCursor()},d.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},d.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}this._vertexAddHandler(e)}},d.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},d.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},d.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},d.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===p.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==p.complete||i?t!==p.undo||this.interactiveUndoDisabled||i?t!==p.redo||this.interactiveUndoDisabled||i?t!==p.pan||i||e.stopPropagation():(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},d.TOOL),this.view.on("key-up",e=>{e.key===p.pan&&e.stopPropagation()},d.TOOL)],l)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new a(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new n(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new n(this.view,e.vertices[0].index,t))}})],c)}_removeViewHandles(){this.removeHandles(l)}_removeUndoRedoHandles(){this.removeHandles(c)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||this._editGeometryOperations.appendVertexToFirstPart(t)}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new r(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null)))}_completeDrawing(){if(this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const e=new s(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this._removeViewHandles()}};_=e([t("esri.views.draw.MultipointDrawAction")],_);const u=_;export{u as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { CursorUpdateEvent } from "./input/
|
|
2
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
3
3
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
4
4
|
import type { DrawActionProperties } from "./DrawAction.js";
|
|
5
5
|
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{subclass as e}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/
|
|
5
|
+
import{__decorate as t}from"tslib";import{subclass as e}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as s}from"./input/DrawCompleteEvent.js";import{ViewEventPriorities as n}from"../input/InputManager.js";import{sketchKeys as a}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as d}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as p}from"../support/screenUtils.js";let h=class extends o{constructor(t){super(t),this._addVertexOnPointerUp=!1,this._drawTool=null}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",t=>{t.key===a.complete&&(this._drawTool?this.complete():(this._abortSnapping(),this._vertexAddHandler(t)))},n.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&this.addHandles([this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),"touch"===t.pointerType&&this._updateCursor())},n.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._cursorScreenPoint=p(t),"touch"!==t.pointerType&&this._updateCursor()},n.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},n.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const e="touch"===t.pointerType;return void this._updateCursor(e)}t.stopPropagation(),this._vertexAddHandler(t)}},n.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},n.TOOL)])}async _addDrawTool(){const[{LegacyDrawTool:t},e]=await Promise.all([import("./LegacyDrawTool.js"),d()]),i=new t({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click",automaticLengthMeasurementUtils:e});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("cursor-update",t=>{1===t.vertices.length&&this.emit("cursor-update",new r(this.view,t.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",t=>{this.emit("draw-complete",new s(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()})]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(t){const e=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(e)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(e),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==e||t||this._pushCursorVertex(e.vertex,()=>this.emit("cursor-update",new r(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const t=new s(this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this.removeAllHandles()}};h=t([e("esri.views.draw.PointDrawAction")],h);const l=h;export{l as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
2
|
import type { DrawingMode } from "./types.js";
|
|
3
|
-
import type { CursorUpdateEvent } from "./input/
|
|
3
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
6
6
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as d}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as h}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as p}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles(this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))},l.TOOL))}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",e=>{e.stopPropagation()},l.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())},l.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()},l.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},l.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}},l.TOOL),this.view.on("drag",e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()},l.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},l.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)},l.TOOL),this.view.on("key-up",e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)},l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new p(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}})])}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),i.on("vertex-add",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new h(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new h(t,o,r))}}),i.on("vertex-remove",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new p(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new p(t,o,r))}}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_dragEnabled",null),e([t()],u.prototype,"_clickEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolygonDrawAction")],u);const m=u;export{m as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
2
|
import type { DrawingMode } from "./types.js";
|
|
3
|
-
import type { CursorUpdateEvent } from "./input/
|
|
3
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
6
6
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as d}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as h}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as p}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))},l.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",e=>{e.stopPropagation()},l.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())},l.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()},l.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},l.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}},l.TOOL),this.view.on("drag",e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()},l.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},l.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)},l.TOOL),this.view.on("key-up",e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)},l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new p(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}})])}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("vertex-add",e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new h(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new h(t,o,r))}),i.on("vertex-remove",e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new p(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new p(t,o,r))}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()})]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_clickEnabled",null),e([t()],u.prototype,"_dragEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolylineDrawAction")],u);const m=u;export{m as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { CursorUpdateEvent } from "./input/
|
|
2
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
3
3
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
4
4
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
5
5
|
import type { DrawActionProperties } from "./DrawAction.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import s from"./DrawAction.js";import{CursorUpdateEvent as o}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import s from"./DrawAction.js";import{CursorUpdateEvent as o}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as n}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as a}from"./input/VertexAddEvent.js";import{createViewAlignedCoordinateSystem as d}from"./support/surfaceCoordinateSystems.js";import{ViewEventPriorities as h}from"../input/InputManager.js";import{sketchKeys as p}from"../interactive/keybindings.js";import{EditGeometry as l,Part as c}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as _}from"../interactive/editGeometry/EditGeometryOperations.js";import{loadAutomaticLengthMeasurementUtils as m}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as g}from"../support/screenUtils.js";const v=["freehand","click"];let u=class extends s{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode="freehand"}initialize(){"2d"===this.view.type?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){"click"===this.mode?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on("immediate-click",e=>{if(e.stopPropagation(),e.mapPoint&&!this._panEnabled){null!=this.getCoordsFromScreenPoint(g(e))&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))}},h.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=g(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()))},h.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),null==this._activePointerId&&"touch"!==e.pointerType&&(this._cursorScreenPoint=g(e),this._updateCursor())},h.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=g(e),this._updateCursor())},h.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),2===this._committedVertices.length&&this._drawCompleteHandler(e),this._isDragging=!1)},h.TOOL),this.view.on("key-down",e=>{e.key===p.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===p.pan&&(this._panEnabled=!0)},h.TOOL),this.view.on("key-up",e=>{e.key===p.pan&&(this._panEnabled=!1)},h.TOOL),this.view.on("drag",e=>{null!=this._activePointerId&&e.stopPropagation()},h.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},h.TOOL)]}_getClickModeViewHandles(){return[this.view.on("pointer-down",e=>{this._abortSnapping(),this._cursorScreenPoint=g(e),this._activePointerId=e.pointerId,this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()},h.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._cursorScreenPoint=g(e),null==this._activePointerId&&"touch"!==e.pointerType&&this._updateCursor()},h.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},h.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),2!==this.vertices.length||this._isDragging||this._drawCompleteHandler(e),this._isDragging=!1)},h.TOOL),this.view.on("key-down",e=>{e.key===p.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),2===this.vertices.length&&this._drawCompleteHandler(e)),e.key===p.complete&&this._cursorScreenPoint&&2===this.vertices.length&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},h.TOOL)]}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),m()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"segment",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("vertex-add",e=>{1===e.vertices.length&&this.emit("vertex-add",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new o(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new n(i.getVertexCoords())),this._removeDrawTool()}),this.view.on("key-down",e=>{e.key!==p.vertexAdd||e.repeat||"click"!==this.mode?e.key!==p.complete||e.repeat||i.completeCreateOperation():i.drawOperation.numCommittedVertices>0?i.completeCreateOperation():i.drawOperation.commitStagedVertex()},h.TOOL)]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t),1===this._committedVertices.length&&(this.viewAlignedCoordinateSystem=d(this.view,this._committedVertices[0]));const i=this._committedVertices.length-1,r=new a(this.view,i,this.vertices);this.emit("vertex-add",r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null!=e&&this._pushCursorVertex(e.vertex,()=>this.emit("cursor-update",new o(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new r(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return this._drawTool.completeCreateOperation(),void this.removeAllHandles();if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const e=new n(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new _(new l("polygon",this._coordinateHelper),2),this._activeComponent=new c(this._coordinateHelper.spatialReference,2),this._editGeometryOperations.data.parts.push(this._activeComponent)}};e([t({type:v})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.SegmentDrawAction")],u);const w=u;export{w as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const d={Left:0,Middle:1,Right:2,Back:3,Forward:4,Undefined:-1};export{d as
|
|
5
|
+
const d={Left:0,Middle:1,Right:2,Back:3,Forward:4,Undefined:-1};export{d as mouseButtons};
|