@arcgis/core 4.30.0-next.20240313 → 4.30.0-next.20240315
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/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{90c569353df5af9ed368.js → 0877c99e0338f8e7c0c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{c76e155332aa0491de3d.js → 0ef3fee7614596d591ba.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d60f3af5886b7dea9ee.js → 12b95408753cea053a40.js} +1 -1
- package/assets/esri/core/workers/chunks/{b93e601da1592f153a3d.js → 13b6de78894ba1a70ace.js} +1 -1
- package/assets/esri/core/workers/chunks/14b9001a3233075dd1b7.js +1 -0
- package/assets/esri/core/workers/chunks/16397420fb6067b47b25.js +1 -0
- package/assets/esri/core/workers/chunks/{67abe8171d41cf21624f.js → 1696784da83588878989.js} +1 -1
- package/assets/esri/core/workers/chunks/{a38ab7cb733426de9588.js → 25d68c7837631f497edb.js} +1 -1
- package/assets/esri/core/workers/chunks/{39ff4d571abbd2df5d5b.js → 2707b8ef8ca636e184ba.js} +1 -1
- package/assets/esri/core/workers/chunks/2d0a01d0957b3e4512f6.js +1 -0
- package/assets/esri/core/workers/chunks/4b25dc661bb958e651fd.js +1 -0
- package/assets/esri/core/workers/chunks/{f5a0f106d9edaddb83fa.js → 4e4c146796a47da2c5a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{f46bc8e507d75d218ac7.js → 5929931ff9ecde6cc084.js} +1 -1
- package/assets/esri/core/workers/chunks/5a747af5273646ab848c.js +1 -0
- package/assets/esri/core/workers/chunks/{da7189c3077f49858dc8.js → 5b6fe9c935e065d59ab7.js} +1 -1
- package/assets/esri/core/workers/chunks/6867fe9937c49e99eb6f.js +2 -0
- package/assets/esri/core/workers/chunks/{fd4ec788953d9776126f.js → 7bc977db7b2dc3d238b5.js} +1 -1
- package/assets/esri/core/workers/chunks/7d7c0aee461571a7c1f8.js +1 -0
- package/assets/esri/core/workers/chunks/{03ae0196aafcb6146f61.js → 7f87af6ec7160e9fd713.js} +1 -1
- package/assets/esri/core/workers/chunks/8ca8ae3207b1025d0116.js +1 -0
- package/assets/esri/core/workers/chunks/8cdfd39b5f4d12c77f0b.js +1 -0
- package/assets/esri/core/workers/chunks/{893d96c21d929d38ab58.js → 8efb216c3250bd3a5bd8.js} +1 -1
- package/assets/esri/core/workers/chunks/{c0217dde5ff4d6a4c14c.js → 8fc69ac4cce6d4dd5513.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1a557cbfb0aa915f81b.js → 95d7b168991ddb3a96ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ab6af927ea04c01a40.js → a658dd87b1b59e9cf2a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{c67b99d2a8376a15a71b.js → bd6a9816d88d757f143e.js} +1 -1
- package/assets/esri/core/workers/chunks/{933f56e7299a5844e367.js → de33bb5df97c66623b68.js} +1 -1
- package/assets/esri/core/workers/chunks/{9656002ff528a7eda746.js → e5cb8297d5824f139b3e.js} +1 -1
- package/assets/esri/core/workers/chunks/eb3e82ed1653ecf348da.js +1 -0
- package/assets/esri/core/workers/chunks/f969c134b1694c4c7cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d573c58a6b80c38c1d.js → fe7dfb8546d0fc40843c.js} +1 -1
- package/assets/esri/themes/base/widgets/_Popup.scss +4 -0
- 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/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/terrainUtilsSpherical.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/interfaces.d.ts +93 -18
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/CornersGeoreference.js +1 -1
- package/layers/support/ExtentAndRotationGeoreference.js +1 -1
- package/layers/support/LocalMediaElementSource.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItemResource.js +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/Rasterizer.js +1 -1
- package/symbols/cim/TextRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/undoredo/support/ApplySet.js +5 -0
- package/undoredo/support/ApplySetItem.js +5 -0
- package/versionManagement/VersionManagementService.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugLayer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestDisplayObject.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +5 -0
- package/views/3d/interactive/editingTools/ManipulatedObject3DMediaElement.js +5 -0
- package/views/3d/interactive/editingTools/lineObjectVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYObjectManipulation.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +5 -0
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +5 -0
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +5 -0
- package/views/3d/interactive/editingTools/media/mediaElementUtils.js +5 -0
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/PreserveAspectRatio.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/SnapRotation.js +5 -0
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/PointCloudWorkerHandle.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +5 -0
- package/views/3d/layers/support/MediaLayerInteractionOptions.js +5 -0
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/TilingScheme.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/input/ViewEvents.js +1 -1
- package/views/input/gamepad/GamepadSource.js +1 -1
- package/views/input/recognizers/DoubleTapDrag.js +1 -1
- package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
- package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/SnappingVisualizer.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/MediaLayerView.d.ts +4 -0
- package/views/layers/MediaLayerView.js +5 -0
- package/views/support/waitForResources.js +1 -1
- package/views/webgl/ContextState.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/Popup/css.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Zoom.js +1 -1
- package/assets/esri/core/workers/chunks/0feee6447793bc42df9d.js +0 -1
- package/assets/esri/core/workers/chunks/1805a6e63a1bfe6950be.js +0 -1
- package/assets/esri/core/workers/chunks/2ceebeac397374a126ba.js +0 -2
- package/assets/esri/core/workers/chunks/678ffc061fe5dec51930.js +0 -1
- package/assets/esri/core/workers/chunks/6c5ea910265d4f6a368d.js +0 -1
- package/assets/esri/core/workers/chunks/6fa0abf415859f40ea6c.js +0 -1
- package/assets/esri/core/workers/chunks/a1978ae86e466020dd28.js +0 -1
- package/assets/esri/core/workers/chunks/bf041907bac8fae05c2b.js +0 -1
- package/assets/esri/core/workers/chunks/c018ce3935d5f1e60e3c.js +0 -1
- package/assets/esri/core/workers/chunks/cccf63c65070c6a47b16.js +0 -1
- package/assets/esri/core/workers/chunks/d2e4c01e33691801f9ef.js +0 -1
- package/views/3d/interactive/editingTools/ManipulatedObjectGraphic3D.js +0 -5
- /package/assets/esri/core/workers/chunks/{2ceebeac397374a126ba.js.LICENSE.txt → 6867fe9937c49e99eb6f.js.LICENSE.txt} +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/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import r from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,abortMaybe as a}from"../../../core/maybe.js";import{zeroMeters as p}from"../../../core/quantityUtils.js";import{when as c,pausable as l,watch as d,syncAndInitial as m,initial as v}from"../../../core/reactiveUtils.js";import{createScreenPoint as y}from"../../../core/screenUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import{closeRingsAndFixWinding as u,geometryToCoordinates as f,getMidpoint as x}from"../../../geometry/support/coordsUtils.js";import G from"../../../layers/GraphicsLayer.js";import b from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as V}from"../../ViewingMode.js";import{SnappingVisualizer2D as M}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as w}from"./drawUtils.js";import S from"./GraphicMover.js";import k from"./HighlightHelper.js";import{addUniqueLayer as E}from"./layerUtils.js";import{settings as I}from"./settings.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{sketchKeys as T}from"../../interactive/keybindings.js";import{EditGeometryOperations as C}from"../../interactive/editGeometry/EditGeometryOperations.js";import R from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as j}from"../../interactive/snapping/SnappingContext.js";import{Tooltip as H}from"../../interactive/tooltip/Tooltip.js";import{TranslateTooltipInfo as U,TranslateVertexTooltipInfo as A}from"../../interactive/tooltip/TranslateTooltipInfos.js";import{autoArea2D as z}from"../../support/automaticAreaMeasurementUtils.js";import{autoDistanceBetweenPoints2D as F,autoLength2D as L}from"../../support/automaticLengthMeasurementUtils.js";import D from"../../../geometry/Polyline.js";import P from"../../../geometry/Point.js";class q{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class K{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class N{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class B{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class J{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class Q{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class W{constructor(e){this.added=e,this.type="vertex-select"}}class X{constructor(e){this.removed=e,this.type="vertex-deselect"}}class Y{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class Z{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const $=I.reshapeGraphics,ee={vertices:{default:new b({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new b({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new b({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new b({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new b({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}})}};let te=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this._translateGraphicTooltipInfo=null,this._translateVertexTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new b({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.symbols=ee,this.sketchOptions=new R,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new k({view:e}),this._setup(),this.addHandles([c((()=>e?.ready),(()=>{const{layer:e,view:t}=this;E(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),O.TOOL))}),{once:!0,initial:!0}),l((()=>this.graphic),(()=>this.refresh())),l((()=>this.layer),((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),l((()=>this.enableMidpoints),(()=>this.refresh())),d((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?new H({view:this.view}):h(this.tooltip)}),m),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),v)])}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&u(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new D({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=C.fromGeometry(t,V.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new G({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new j({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new M(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=a(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=f(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return e?.forEach(((e,n)=>{e.forEach(((e,h)=>{const[a,p,c]=e;r.push(new t({geometry:new P({x:a,y:p,z:c,spatialReference:o}),symbol:s?.vertices?.default,attributes:{...i,pathIndex:n,pointIndex:h}}))}))})),r}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return e?.forEach(((e,n)=>{e.forEach(((h,a)=>{const[p,c,l]=h,d=e[a+1]?a+1:0;if("polygon"===this.graphic.geometry?.type||0!==d){const[h,m,v]=e[d],[y,_,g]=x([p,c,l],[h,m,v]);r.push(new t({geometry:new P({x:y,y:_,z:g,spatialReference:o}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:a,pointIndexEnd:d}}))}}))})),r}_updateSymbolsForTheme(){const e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",e),hover:this.symbols.vertices.hover?.clone().set("color",e)},midpoints:{...this.symbols.midpoints}};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i).items;e&&r.push(t),this._mover=new S({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),void(null!=o&&"point"===o.type&&this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)})))}if(!this.selectedVertices.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),t=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],e,t)}this._addToSelection(s)}this._setUpOperation(e),this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)}))}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,(()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)}));else if("point"===n.type)this._onHandleMove(o,i,s,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}));else if("polyline"===n.type||"polygon"===n.type){const t=this._getCoordinatesForUI(n);this._updateVertexGraphicLocations(t),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e,{operationType:r}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,(()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o))),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(e){const t=this.view.spatialReference;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes,[r,n,h]=e[s][o];i.geometry=new P({x:r,y:n,z:h,spatialReference:t})}this._updateMidpointGraphicLocations(e)}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,[r,n,h]=e[i][s],[a,p,c]=e[i][o],[l,d,m]=x([r,n,h],[a,p,c]);t.geometry=new P({x:l,y:d,z:m,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,s,o,r){a(this._snappingTask);const n=this._snappingContext;if(!n)return;const h=e.geometry,p="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!p){const o=this.snappingManager;this._stagedVertex=o.update({point:h,context:n}),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,p),r(),this._snappingTask=i((async i=>{const a=await o.snap({point:h,context:n,signal:i});a.valid&&(this._stagedVertex=a.apply(),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,p),r())}))}else{const i=null!=this._stagedVertex?new P(this._stagedVertex):h;this._syncGeometryAfterVertexMove(e,i,t,s,p),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations.data.geometry;if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{const{x:n,y:h,z:a}=t,[p,c]=this._getIndicesForVertexGraphic(e);let l=f(r);const d=l[p].length-1,m=null!=a?[n,h,a]:[n,h];l[p][c]=m,"polygon"===r.type&&(0===c?l[p][d]=m:c===d&&(l[p][0]=m)),this._isVertex(e)&&(l=this._moveRelatedCoordinates(l,e,m),l=this._moveSelectedHandleCoordinates(l,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l)),this.graphic.geometry=r.clone();const v=this._getVertexFromEditGeometry(e),y=n-v.pos[0],_=h-v.pos[1];this._editGeometryOperations.moveVertices([v],y,_,0),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i){const{relatedGraphicIndices:s}=t.attributes;for(const o of s){const s=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:n}=s.attributes;e[r][n]=i,s.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:h}=r.attributes,a=w(r.geometry,i,s,this.view),p=e[t].length-1;e[t][n]=[a.x,a.y],r.geometry=a,o&&(0===n?e[t][p]=[a.x,a.y]:n===p&&(e[t][0]=[a.x,a.y]));for(const i of h){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=[a.x,a.y],t.geometry=a}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default",this._updateTooltip()}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(null==s||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:h,pointIndexEnd:a}=e.attributes,{x:p,y:c,z:l}=e.geometry,d=0===a?h+1:a,m=f(o);return m[n].splice(d,0,null!=l?[p,c,l]:[p,c]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},r.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=o,r}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,o=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",o);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){T.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),o=i.clone();let r=f(o);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<r.length;t++){const s=r[t];for(let o=0;o<s.length;o++){const[h,a]=s[o];e===h&&i===a&&(n.push({coordinates:r[t][o],componentIndex:t,vertexIndex:o}),r[t].splice(Number(o),1))}}}if("polygon"===o.type)r=r.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,o]=e[e.length-1];return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)})),o.rings=r;else{for(const e of r)1===e.length&&r.splice(r.indexOf(e),1);o.paths=r}this.graphic.geometry=o,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_updateTooltip(e,t){null!=this.tooltip&&(e?e===this.graphic?this._updateMoveGraphicTooltip(t):this._updateMoveVertexTooltip(t):this.tooltip.clear())}_updateMoveGraphicTooltip(e){const{tooltip:t,sketchOptions:i,view:s}=this;if(null==t)return;const o=this._translateGraphicTooltipInfo??=new U({sketchOptions:i});if(o.clear(),o.sketchOptions=i,e){const{x:t,y:i}=e.origin,r=s.toMap(e),n=s.toMap(y(t,i)),h=F(n,r);o.distance=null!=h?h:p}t.info=o}_updateMoveVertexTooltip(e){const{tooltip:t,graphic:{geometry:i},sketchOptions:s,view:o}=this;if(null==t)return;const r=this._translateVertexTooltipInfo??=new A({sketchOptions:s});if(r.clear(),r.sketchOptions=s,"polygon"===i?.type?r.area=z(i):"polyline"===i?.type&&(r.totalLength=L(i)),e){const{x:t,y:i}=e.origin,s=o.toMap(e),n=o.toMap(y(t,i)),h=F(n,s);r.distance=null!=h?h:p}t.info=r}_emitMoveStartEvent(e,t){const i=new B(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new J(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const e=this._activeOperationInfo;if(!e)return;const{totalDx:t,totalDy:i}=e,s=new Q(this.graphic,t,i);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitReshapeStartEvent(e){const t=new q(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new K(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new N(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new W(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new X(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new Y(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new Z(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([_()],te.prototype,"tooltip",void 0),e([_()],te.prototype,"_translateGraphicTooltipInfo",void 0),e([_()],te.prototype,"_translateVertexTooltipInfo",void 0),e([_()],te.prototype,"callbacks",void 0),e([_()],te.prototype,"enableMidpoints",void 0),e([_()],te.prototype,"enableMovement",void 0),e([_()],te.prototype,"enableVertices",void 0),e([_()],te.prototype,"graphic",void 0),e([_({value:!0})],te.prototype,"highlightsEnabled",null),e([_()],te.prototype,"layer",void 0),e([_({readOnly:!0})],te.prototype,"midpointGraphics",void 0),e([_()],te.prototype,"midpointSymbol",void 0),e([_({readOnly:!0})],te.prototype,"selectedVertices",void 0),e([_()],te.prototype,"snappingManager",void 0),e([_({readOnly:!0})],te.prototype,"state",null),e([_()],te.prototype,"symbols",void 0),e([_({type:R})],te.prototype,"sketchOptions",void 0),e([_({readOnly:!0})],te.prototype,"type",void 0),e([_({readOnly:!0})],te.prototype,"vertexGraphics",void 0),e([_()],te.prototype,"view",void 0),te=e([g("esri.views.draw.support.Reshape")],te);const ie=te;export{ie as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import r from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,abortMaybe as a}from"../../../core/maybe.js";import{zeroMeters as p}from"../../../core/quantityUtils.js";import{when as c,pausable as l,watch as d,syncAndInitial as m,initial as v}from"../../../core/reactiveUtils.js";import{createScreenPoint as y}from"../../../core/screenUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import{closeRingsAndFixWinding as u,getMidpoint as f,geometryToCoordinates as x}from"../../../geometry/support/coordsUtils.js";import G from"../../../layers/GraphicsLayer.js";import b from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as V}from"../../ViewingMode.js";import{SnappingVisualizer2D as M}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as w}from"./drawUtils.js";import S from"./GraphicMover.js";import k from"./HighlightHelper.js";import{addUniqueLayer as E}from"./layerUtils.js";import{settings as I}from"./settings.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{sketchKeys as T}from"../../interactive/keybindings.js";import{EditGeometryOperations as C}from"../../interactive/editGeometry/EditGeometryOperations.js";import R from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as j}from"../../interactive/snapping/SnappingContext.js";import{Tooltip as H}from"../../interactive/tooltip/Tooltip.js";import{TranslateTooltipInfo as U,TranslateVertexTooltipInfo as A}from"../../interactive/tooltip/TranslateTooltipInfos.js";import{autoArea2D as z}from"../../support/automaticAreaMeasurementUtils.js";import{autoDistanceBetweenPoints2D as L,autoLength2D as D}from"../../support/automaticLengthMeasurementUtils.js";import F from"../../../geometry/Polyline.js";import P from"../../../geometry/Point.js";class q{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class K{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class N{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class B{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class J{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class Q{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class W{constructor(e){this.added=e,this.type="vertex-select"}}class X{constructor(e){this.removed=e,this.type="vertex-deselect"}}class Y{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class Z{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const $=I.reshapeGraphics,ee={vertices:{default:new b({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new b({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new b({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new b({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new b({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}})}};let te=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this._translateGraphicTooltipInfo=null,this._translateVertexTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new b({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.symbols=ee,this.sketchOptions=new R,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new k({view:e}),this._setup(),this.addHandles([c((()=>e?.ready),(()=>{const{layer:e,view:t}=this;E(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),O.TOOL))}),{once:!0,initial:!0}),l((()=>this.graphic),(()=>this.refresh())),l((()=>this.layer),((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),l((()=>this.enableMidpoints),(()=>this.refresh())),d((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?new H({view:this.view}):h(this.tooltip)}),m),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),v)])}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&u(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new F({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=C.fromGeometry(t,V.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new G({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new j({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new M(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=a(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type)){const t=ie(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return e?.forEach(((e,n)=>{e.forEach(((e,h)=>{const[a,p,c]=e;r.push(new t({geometry:new P({x:a,y:p,z:c,spatialReference:o}),symbol:s?.vertices?.default,attributes:{...i,pathIndex:n,pointIndex:h}}))}))})),r}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return e?.forEach(((e,n)=>{e.forEach(((h,a)=>{const[p,c,l]=h,d=e[a+1]?a+1:0;if("polygon"===this.graphic.geometry?.type||0!==d){const[h,m,v]=e[d],[y,_,g]=f([p,c,l],[h,m,v]);r.push(new t({geometry:new P({x:y,y:_,z:g,spatialReference:o}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:a,pointIndexEnd:d}}))}}))})),r}_updateSymbolsForTheme(){const e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",e),hover:this.symbols.vertices.hover?.clone().set("color",e)},midpoints:{...this.symbols.midpoints}};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i).items;e&&r.push(t),this._mover=new S({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),void(null!=o&&"point"===o.type&&this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)})))}if(!this.selectedVertices.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),t=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],e,t)}this._addToSelection(s)}this._setUpOperation(e),this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)}))}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,(()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)}));else if("point"===n.type)this._onHandleMove(o,i,s,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}));else if("polyline"===n.type||"polygon"===n.type){const t=ie(n);this._updateVertexGraphicLocations(t),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e,{operationType:r}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,(()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o))),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(e){const t=this.view.spatialReference;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes,[r,n,h]=e[s][o];i.geometry=new P({x:r,y:n,z:h,spatialReference:t})}this._updateMidpointGraphicLocations(e)}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,[r,n,h]=e[i][s],[a,p,c]=e[i][o],[l,d,m]=f([r,n,h],[a,p,c]);t.geometry=new P({x:l,y:d,z:m,spatialReference:this.view.spatialReference})}}_getVertexFromEditGeometry(e){const[t,i]=se(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,s,o,r){a(this._snappingTask);const n=this._snappingContext;if(!n)return;const h=e.geometry,p="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!p){const o=this.snappingManager;this._stagedVertex=o.update({point:h,context:n}),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,p),r(),this._snappingTask=i((async i=>{const a=await o.snap({point:h,context:n,signal:i});a.valid&&(this._stagedVertex=a.apply(),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,p),r())}))}else{const i=null!=this._stagedVertex?new P(this._stagedVertex):h;this._syncGeometryAfterVertexMove(e,i,t,s,p),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations.data.geometry;if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{const{x:n,y:h,z:a}=t,[p,c]=se(e);let l=x(r);const d=l[p].length-1,m=null!=a?[n,h,a]:[n,h];l[p][c]=m,"polygon"===r.type&&(0===c?l[p][d]=m:c===d&&(l[p][0]=m)),this._isVertex(e)&&(l=this._moveRelatedCoordinates(l,e,m),l=this._moveSelectedHandleCoordinates(l,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l)),this.graphic.geometry=r.clone();const v=this._getVertexFromEditGeometry(e),y=n-v.pos[0],_=h-v.pos[1];this._editGeometryOperations.moveVertices([v],y,_,0),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i){const{relatedGraphicIndices:s}=t.attributes;for(const o of s){const s=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:n}=s.attributes;e[r][n]=i,s.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:h}=r.attributes,a=w(r.geometry,i,s,this.view),p=e[t].length-1;e[t][n]=[a.x,a.y],r.geometry=a,o&&(0===n?e[t][p]=[a.x,a.y]:n===p&&(e[t][0]=[a.x,a.y]));for(const i of h){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=[a.x,a.y],t.geometry=a}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default",this._updateTooltip()}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(null==s||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:h,pointIndexEnd:a}=e.attributes,{x:p,y:c,z:l}=e.geometry,d=0===a?h+1:a,m=x(o);return m[n].splice(d,0,null!=l?[p,c,l]:[p,c]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},r.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=o,r}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,o=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",o);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){T.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),o=i.clone();let r=x(o);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<r.length;t++){const s=r[t];for(let o=0;o<s.length;o++){const[h,a]=s[o];e===h&&i===a&&(n.push({coordinates:r[t][o],componentIndex:t,vertexIndex:o}),r[t].splice(Number(o),1))}}}if("polygon"===o.type)r=r.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,o]=e[e.length-1];return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)})),o.rings=r;else{for(const e of r)1===e.length&&r.splice(r.indexOf(e),1);o.paths=r}this.graphic.geometry=o,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_updateTooltip(e,t){null!=this.tooltip&&(e?e===this.graphic?this._updateMoveGraphicTooltip(t):this._updateMoveVertexTooltip(t):this.tooltip.clear())}_updateMoveGraphicTooltip(e){const{tooltip:t,sketchOptions:i,view:s}=this;if(null==t)return;const o=this._translateGraphicTooltipInfo??=new U({sketchOptions:i});if(o.clear(),o.sketchOptions=i,e){const{x:t,y:i}=e.origin,r=s.toMap(e),n=s.toMap(y(t,i)),h=L(n,r);o.distance=null!=h?h:p}t.info=o}_updateMoveVertexTooltip(e){const{tooltip:t,graphic:{geometry:i},sketchOptions:s,view:o}=this;if(null==t)return;const r=this._translateVertexTooltipInfo??=new A({sketchOptions:s});if(r.clear(),r.sketchOptions=s,"polygon"===i?.type?r.area=z(i):"polyline"===i?.type&&(r.totalLength=D(i)),e){const{x:t,y:i}=e.origin,s=o.toMap(e),n=o.toMap(y(t,i)),h=L(n,s);r.distance=null!=h?h:p}t.info=r}_emitMoveStartEvent(e,t){const i=new B(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new J(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const e=this._activeOperationInfo;if(!e)return;const{totalDx:t,totalDy:i}=e,s=new Q(this.graphic,t,i);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitReshapeStartEvent(e){const t=new q(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new K(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new N(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new W(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new X(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new Y(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new Z(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function ie(e){const t=x(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function se({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}e([_()],te.prototype,"tooltip",void 0),e([_()],te.prototype,"_translateGraphicTooltipInfo",void 0),e([_()],te.prototype,"_translateVertexTooltipInfo",void 0),e([_()],te.prototype,"callbacks",void 0),e([_()],te.prototype,"enableMidpoints",void 0),e([_()],te.prototype,"enableMovement",void 0),e([_()],te.prototype,"enableVertices",void 0),e([_()],te.prototype,"graphic",void 0),e([_({value:!0})],te.prototype,"highlightsEnabled",null),e([_()],te.prototype,"layer",void 0),e([_({readOnly:!0})],te.prototype,"midpointGraphics",void 0),e([_()],te.prototype,"midpointSymbol",void 0),e([_({readOnly:!0})],te.prototype,"selectedVertices",void 0),e([_()],te.prototype,"snappingManager",void 0),e([_({readOnly:!0})],te.prototype,"state",null),e([_()],te.prototype,"symbols",void 0),e([_({type:R})],te.prototype,"sketchOptions",void 0),e([_({readOnly:!0})],te.prototype,"type",void 0),e([_({readOnly:!0})],te.prototype,"vertexGraphics",void 0),e([_()],te.prototype,"view",void 0),te=e([g("esri.views.draw.support.Reshape")],te);const oe=te;export{oe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{makeHandle as t}from"../../core/handleUtils.js";import{rad2deg as e}from"../../core/mathUtils.js";import{createScreenPoint as
|
|
5
|
+
import"../../core/has.js";import{makeHandle as t}from"../../core/handleUtils.js";import{rad2deg as e}from"../../core/mathUtils.js";import{createScreenPoint as n}from"../../core/screenUtils.js";import{InputHandler as a}from"./InputHandler.js";import{ViewEventPriorities as r}from"./InputManager.js";export{MouseButton}from"./IViewEvents.js";const i=["click","double-click","immediate-click","immediate-double-click","hold","drag","key-down","key-up","pointer-down","pointer-move","pointer-up","pointer-drag","mouse-wheel","pointer-enter","pointer-leave","gamepad","focus","blur"],o={};function s(t){return!!o[t]}function p(t){for(const e of t)if(!s(e))return!1;return!0}i.forEach((t=>{o[t]=!0}));class c{constructor(t){this._handlers=new Map,this._counter=0,this._handlerCounts=new Map,this.view=t,this.inputManager=null}connect(t){t&&this.disconnect(),this.inputManager=t,this._handlers.forEach((({handler:t,priority:e},n)=>this.inputManager?.installHandlers(n,[t],e)))}disconnect(){this.inputManager&&this._handlers.forEach(((t,e)=>this.inputManager?.uninstallHandlers(e))),this.inputManager=null}destroy(){this.disconnect(),this._handlers.clear(),this.view=null}on(e,n,a,i){const o=Array.isArray(e)?e:e.split(",");if(!p(o))return o.some(s)&&console.error("Error: registering input events and other events on the view at the same time is not supported."),null;let c,u;Array.isArray(n)?u=n:(c=n,u=[]),"function"==typeof a?c=a:i=a,i=null!=i?i:r.DEFAULT;const d=this._createUniqueGroupName(),m=new l(this.view,o,u,c);this._handlers.set(d,{handler:m,priority:i});for(const t of o){const e=this._handlerCounts.get(t)||0;this._handlerCounts.set(t,e+1)}return this.inputManager&&this.inputManager.installHandlers(d,[m],i),t((()=>this._removeHandler(d,o)))}hasHandler(t){return!!this._handlerCounts.get(t)}_removeHandler(t,e){if(this._handlers.has(t)){this._handlers.delete(t);for(const t of e){const e=this._handlerCounts.get(t);void 0===e?console.error("Trying to remove handler for event that has no handlers registered: ",t):1===e?this._handlerCounts.delete(t):this._handlerCounts.set(t,e-1)}}this.inputManager&&this.inputManager.uninstallHandlers(t)}_createUniqueGroupName(){return this._counter+=1,`viewEvents_${this._counter}`}}class l extends a{constructor(t,e,n,a){super(!0),this._latestDragStart=void 0,this.view=t;for(const r of e)switch(r){case"click":this.registerIncoming("click",n,(e=>a(m(t,e))));break;case"double-click":this.registerIncoming("double-click",n,(e=>a(g(t,e))));break;case"immediate-click":this.registerIncoming("immediate-click",n,(e=>a(v(t,e))));break;case"immediate-double-click":this.registerIncoming("immediate-double-click",n,(e=>a(y(t,e))));break;case"hold":this.registerIncoming("hold",n,(e=>a(h(t,e))));break;case"drag":this.registerIncoming("drag",n,(t=>{const e=this._wrapDrag(t);e&&a(e)}));break;case"key-down":this.registerIncoming("key-down",n,(t=>a(f(t))));break;case"key-up":this.registerIncoming("key-up",n,(t=>a(k(t))));break;case"pointer-down":this.registerIncoming("pointer-down",n,(t=>a(I(t,"pointer-down"))));break;case"pointer-move":this.registerIncoming("pointer-move",n,(t=>a(I(t,"pointer-move"))));break;case"pointer-up":this.registerIncoming("pointer-up",n,(t=>a(I(t,"pointer-up"))));break;case"pointer-drag":this.registerIncoming("pointer-drag",n,(t=>a(D(t))));break;case"mouse-wheel":this.registerIncoming("mouse-wheel",n,(t=>a(P(t))));break;case"pointer-enter":this.registerIncoming("pointer-enter",n,(t=>a(I(t,"pointer-enter"))));break;case"pointer-leave":this.registerIncoming("pointer-leave",n,(t=>a(I(t,"pointer-leave"))));break;case"gamepad":this.registerIncoming("gamepad",n,(t=>{a(_(t))}));break;case"focus":this.registerIncoming("focus",n,(t=>{a(u(t))}));break;case"blur":this.registerIncoming("blur",n,(t=>{a(d(t))}))}}_wrapDrag(t){const n=t.data,{x:a,y:r}=n.center,{action:i,pointerType:o,button:s}=n;if("start"===i&&(this._latestDragStart=n),!this._latestDragStart)return;const p=n.pointer.native,c=n.buttons,{cancelable:l,timestamp:u}=t,d={x:this._latestDragStart.center.x,y:this._latestDragStart.center.y};return"end"===i&&(this._latestDragStart=void 0),{type:"drag",action:i,x:a,y:r,origin:d,pointerType:o,button:s,buttons:c,radius:n.radius,angle:e(n.angle),native:p,timestamp:u,cancelable:l,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}}function u(t){return{type:"focus",timestamp:t.timestamp,native:t.data.native,cancelable:t.cancelable,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function d(t){return{type:"blur",timestamp:t.timestamp,native:t.data.native,cancelable:t.cancelable,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function m(t,e){const{pointerType:a,button:r,buttons:i,x:o,y:s,native:p,eventId:c}=e.data,{cancelable:l,timestamp:u}=e;return{type:"click",pointerType:a,button:r,buttons:i,x:o,y:s,native:p,timestamp:u,screenPoint:n(o,s),mapPoint:b(t,o,s),eventId:c,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function g(t,e){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=e.data,{cancelable:c,timestamp:l}=e;return{type:"double-click",pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:l,mapPoint:b(t,i,o),eventId:p,cancelable:c,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function v(t,e){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=e.data,c=s.pointerId,{cancelable:l,timestamp:u}=e;return{type:"immediate-click",pointerId:c,pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:u,mapPoint:b(t,i,o),eventId:p,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function y(t,e){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=e.data,c=s.pointerId,{cancelable:l,timestamp:u}=e;return{type:"immediate-double-click",pointerId:c,pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:u,mapPoint:b(t,i,o),eventId:p,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function h(t,e){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s}=e.data,{cancelable:p,timestamp:c}=e;return{type:"hold",pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:c,mapPoint:b(t,i,o),cancelable:p,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function b(t,e,a){return t.toMap(n(e,a),{exclude:[]})}function f(t){const{key:e,repeat:n,native:a}=t.data,{cancelable:r,timestamp:i}=t;return{type:"key-down",key:e,repeat:n,native:a,timestamp:i,cancelable:r,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function k(t){const{key:e,native:n}=t.data,{cancelable:a,timestamp:r}=t;return{type:"key-up",key:e,native:n,timestamp:r,cancelable:a,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function I(t,e){const{x:n,y:a,button:r,buttons:i,native:o,eventId:s}=t.data,p=o.pointerId,c=o.pointerType,{cancelable:l,timestamp:u}=t;return{type:e,x:n,y:a,pointerId:p,pointerType:c,button:r,buttons:i,native:o,timestamp:u,eventId:s,cancelable:l,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function D(t){const{x:e,y:n,buttons:a,native:r,eventId:i}=t.data.currentEvent,{button:o}=t.data.startEvent,s=t.data.startEvent.native.pointerId,p=t.data.startEvent.native.pointerType,c=t.data.action,l={x:t.data.startEvent.x,y:t.data.startEvent.y},{cancelable:u,timestamp:d}=t;return{type:"pointer-drag",x:e,y:n,pointerId:s,pointerType:p,button:o,buttons:a,action:c,origin:l,native:r,timestamp:d,eventId:i,cancelable:u,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function P(t){const{cancelable:e,data:n,timestamp:a}=t,{x:r,y:i,deltaY:o,native:s}=n;return{type:"mouse-wheel",x:r,y:i,deltaY:o,native:s,timestamp:a,cancelable:e,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function _(t){const{action:e,state:n,device:a}=t.data,{cancelable:r,timestamp:i}=t,{buttons:o,axes:s}=n;return{type:"gamepad",device:a,timestamp:i,action:e,buttons:o,axes:s,cancelable:r,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}export{c as ViewEvents,i as eventTypes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{addFrameTask as e}from"../../../core/scheduling.js";import t from"./GamepadInputDevice.js";import{extractState as
|
|
5
|
+
import{addFrameTask as e}from"../../../core/scheduling.js";import t from"./GamepadInputDevice.js";import{extractState as n,stateIdle as s,stateEqual as i}from"./GamepadState.js";class a{constructor(e,t){this._element=e,this._input=t,this._hasEventListeners=!1,this._onConnectGamepad=e=>{this._connectGamepad(e.gamepad)},this._onDisconnectGamepad=e=>{const t=e.gamepad,s=t.index,i=this._inputDevices[s];i&&(this._emitGamepadEvent(t,n(i),!1),this._inputDevices.splice(s,1),this._latestUpdate.splice(s,1),this._input.gamepad.devices.remove(i),this.ensurePollingState())},this._frameTask=null,this._latestUpdate=new Array,this._inputDevices=new Array,this._callback=null;const s="getGamepads"in window.navigator,i=window.isSecureContext;this.supported=s&&i,this.supported&&(d((e=>this._connectGamepad(e))),window.addEventListener("gamepadconnected",this._onConnectGamepad),window.addEventListener("gamepaddisconnected",this._onDisconnectGamepad),this.ensurePollingState())}destroy(){this.hasEventListeners=!1,this.supported&&(window.removeEventListener("gamepadconnected",this._onConnectGamepad),window.removeEventListener("gamepaddisconnected",this._onDisconnectGamepad))}set hasEventListeners(e){this._hasEventListeners!==e&&(this._hasEventListeners=e,this.ensurePollingState())}get _eventsEnabled(){return this.supported&&this._inputDevices.length>0&&this._hasEventListeners}set onEvent(e){this._callback=e}_connectGamepad(e){const n=new t(e);"unknown"!==n.deviceType&&(this._inputDevices[e.index]=n,this._input.gamepad.devices.add(n)),this.ensurePollingState()}ensurePollingState(){this._eventsEnabled?this._startPolling():this._stopPolling()}_startPolling(){null==this._frameTask&&(this._frameTask=e({update:()=>this._readGamepadState()}))}_stopPolling(){null!=this._frameTask&&(this._frameTask.remove(),this._frameTask=null,this._latestUpdate=new Array)}_readGamepadState(){const e=document.hasFocus(),t=this._element.contains(document.activeElement),a="document"===this._input.gamepad.enabledFocusMode&&!e||"view"===this._input.gamepad.enabledFocusMode&&!t;d((e=>{const t=this._inputDevices[e.index];if(!t)return;const o=this._latestUpdate[e.index],d=n(t),c=a||s(d);if(o){if(o.timestamp===e.timestamp)return;if(!o.active&&c)return;if(i(o.state,d))return}this._emitGamepadEvent(e,d,!c)}))}_emitGamepadEvent(e,t,n){const s=this._latestUpdate[e.index],i=s&&s.active;if(!i&&!n)return;const a=!i&&n?"start":i&&n?"update":"end";this._latestUpdate[e.index]={timestamp:e.timestamp,state:t,active:n},this._callback&&this._callback({device:this._inputDevices[e.index],state:t,action:a})}}function o(e){if(!e)return!1;if(!e.connected)return!1;for(let t=0;t<e.axes.length;t++)if(isNaN(e.axes[t]))return!1;return!0}function d(e){const t=window.navigator.getGamepads();for(let n=0;n<t.length;n++){const s=t[n];o(s)&&e(s)}}export{a as GamepadSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clock as t}from"../../../core/clock.js";import{someMap as e}from"../../../core/MapUtils.js";import{removeMaybe as
|
|
5
|
+
import{clock as t}from"../../../core/clock.js";import{someMap as e}from"../../../core/MapUtils.js";import{removeMaybe as i}from"../../../core/maybe.js";import{createScreenPoint as o}from"../../../core/screenUtils.js";import{DragEventSeparator as a}from"../DragEventSeparator.js";import{InputHandler as r}from"../InputHandler.js";import{DefaultParameters as n,getPointerId as s,manhattanDistance as u}from"./support.js";class p extends r{constructor(e=n.maximumDoubleClickDelay,i=n.maximumDoubleClickDistance,r=n.maximumDoubleTouchDelay,s=n.maximumDoubleTouchDistance,u=t){super(!1),this._maximumDoubleClickDelay=e,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=r,this._maximumDoubleTouchDistance=s,this._clock=u,this._doubleTapDragReady=!1,this._doubleTapDragActive=!1,this._dragStartCenter=o(0,0),this._pointerState=new Map,this._doubleTapDrag=this.registerOutgoing("double-tap-drag"),this._dragEventSeparator=new a({start:(t,e)=>this._dragStart(t,e),update:(t,e)=>this._dragUpdate(e),end:(t,e)=>this._dragEnd(e)}),this.registerIncoming("drag",(t=>this._dragEventSeparator.handle(t))),this.registerIncoming("pointer-down",(t=>this._handlePointerDown(t))),this.registerIncoming("pointer-up",(()=>this._handlePointerUp()))}onUninstall(){this._pointerState.forEach((t=>{t.doubleTapTimeout=i(t.doubleTapTimeout)}))}get hasPendingInputs(){return e(this._pointerState,(t=>null!=t.doubleTapTimeout))}_clearPointerDown(t){const e=this._pointerState.get(t);e&&(e.doubleTapTimeout=i(e.doubleTapTimeout),this._pointerState.delete(t),this.refreshHasPendingInputs())}_dragStart(t,e){if(!this._doubleTapDragReady||1!==t)return;this._doubleTapDragReady=!1,this._doubleTapDragActive=!0;const{data:i,modifiers:a}=e,{center:r}=i;this._dragStartCenter=r;const n=d("begin",o(0,0),i);this._doubleTapDrag.emit(n,void 0,a),e.stopPropagation()}_dragUpdate(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:i}=t,{center:a}=e,r=d("update",o(a.x-this._dragStartCenter.x,a.y-this._dragStartCenter.y),e);this._doubleTapDrag.emit(r,void 0,i),t.stopPropagation()}_dragEnd(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:i}=t,{center:a}=e,r=d("end",o(a.x-this._dragStartCenter.x,a.y-this._dragStartCenter.y),e);this._doubleTapDrag.emit(r,void 0,i),this._doubleTapDragActive=!1,t.stopPropagation()}_handlePointerDown(t){const{data:e}=t,i=s(e),o=this._pointerState.get(i),{pointerType:a}=e.native;if(o){const r="touch"===a?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;this._clearPointerDown(i),u(o.event.data,e)>r?this._storePointerDown(t):this._doubleTapDragReady=!0}else this._storePointerDown(t)}_handlePointerUp(){this._doubleTapDragReady=!1}_storePointerDown(t){const{data:e}=t,{pointerType:i}=e.native,o=s(e),a="touch"===i?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay,r=this._clock.setTimeout((()=>this._clearPointerDown(o)),a);this._pointerState.set(o,{event:t,doubleTapTimeout:r}),this.refreshHasPendingInputs()}}function d(t,e,i){const{button:o,buttons:a,pointer:r,pointers:n,pointerType:s,timestamp:u}=i;return{action:t,delta:e,button:o,buttons:a,pointer:r,pointers:n,pointerType:s,timestamp:u}}export{p as DoubleTapDrag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clock as t}from"../../../core/clock.js";import{removeMaybe as e}from"../../../core/maybe.js";import{InputHandler as i}from"../InputHandler.js";import{DefaultParameters as n,euclideanDistance as o}from"./support.js";class r extends i{constructor(e=n.maximumClickDelay,i=n.movementUntilMouseDrag,o=n.movementUntilPenDrag,r=n.movementUntilTouchDrag,s=n.holdDelay,a=t){super(!1),this._maximumClickDelay=e,this._movementUntilMouseDrag=i,this._movementUntilPenDrag=o,this._movementUntilTouchDrag=r,this._holdDelay=s,this._clock=a,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")})),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach((t=>{t.holdTimeout=e(t.holdTimeout)})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=e.native.pointerId;let n=null;0===this._pointerState.size&&(n=this._clock.setTimeout((()=>{const e=this._pointerState.get(i);if(e){if(!e.isDragging){const i=e.previousEvent;this._pointerHold.emit(i,void 0,t.modifiers),e.holdEmitted=!0}e.holdTimeout=null}}),this._holdDelay));const o={startEvent:e,previousEvent:e,startTimestamp:t.timestamp,isDragging:!1,downButton:e.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(i,o),this.startCapturingPointer(e.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(t)}
|
|
5
|
+
import{clock as t}from"../../../core/clock.js";import{removeMaybe as e}from"../../../core/maybe.js";import{InputHandler as i}from"../InputHandler.js";import{DefaultParameters as n,euclideanDistance as o}from"./support.js";class r extends i{constructor(e=n.maximumClickDelay,i=n.movementUntilMouseDrag,o=n.movementUntilPenDrag,r=n.movementUntilTouchDrag,s=n.holdDelay,a=t){super(!1),this._maximumClickDelay=e,this._movementUntilMouseDrag=i,this._movementUntilPenDrag=o,this._movementUntilTouchDrag=r,this._holdDelay=s,this._clock=a,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")})),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach((t=>{t.holdTimeout=e(t.holdTimeout)})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=e.native.pointerId;let n=null;0===this._pointerState.size&&(n=this._clock.setTimeout((()=>{const e=this._pointerState.get(i);if(e){if(!e.isDragging){const i=e.previousEvent;this._pointerHold.emit(i,void 0,t.modifiers),e.holdEmitted=!0}e.holdTimeout=null}}),this._holdDelay));const o={startEvent:e,previousEvent:e,startTimestamp:t.timestamp,isDragging:!1,downButton:e.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(i,o),this.startCapturingPointer(e.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(t)}_handlePointerMove(t){const e=t.data,i=e.native.pointerId,n=this._pointerState.get(i);if(n){if(n.isDragging)this._pointerDrag.emit(s("update",n,e),void 0,n.modifiers);else{o(e,n.startEvent)>this._getDragThreshold(e.native.pointerType)&&this._startDragging(t)}n.previousEvent=e}}_getDragThreshold(t){switch(t){case"touch":return this._movementUntilTouchDrag;case"pen":return this._movementUntilPenDrag;default:return this._movementUntilMouseDrag}}_startDragging(t){const e=t.data,i=e.native.pointerId;this._pointerState.forEach((n=>{null!=n.holdTimeout&&(n.holdTimeout.remove(),n.holdTimeout=null),n.isDragging||(n.modifiers=t.modifiers,n.isDragging=!0,i===n.startEvent.native.pointerId?this._pointerDrag.emit(s("start",n,e)):this._pointerDrag.emit(s("start",n,n.previousEvent),t.timestamp))}))}_handlePointerLoss(t,e){const i=t.data,n=i.native.pointerId,o=this._pointerState.get(n);if(o){if(null!=o.holdTimeout&&(o.holdTimeout.remove(),o.holdTimeout=null),o.isDragging)this._pointerDrag.emit(s("end",o,"pointer-up"===e?i:o.previousEvent),void 0,o.modifiers);else if("pointer-up"===e&&o.downButton===i.native.button){t.timestamp-o.startTimestamp<=this._maximumClickDelay&&!o.holdEmitted&&this._immediateClick.emit(i)}this._pointerState.delete(n),this.stopCapturingPointer(i.native),0===this._pointerState.size&&this._moveHandle.pause()}}}function s(t,e,i){return{action:t,startEvent:e.startEvent,previousEvent:e.previousEvent,currentEvent:i}}export{r as PointerClickHoldAndDrag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clock as e}from"../../../core/clock.js";import{someMap as t}from"../../../core/MapUtils.js";import{removeMaybe as i}from"../../../core/maybe.js";import{InputHandler as o}from"../InputHandler.js";import{DefaultParameters as n,manhattanDistance as s,getPointerId as l}from"./support.js";class r extends o{constructor(t=n.maximumDoubleClickDelay,i=n.maximumDoubleClickDistance,o=n.maximumDoubleTouchDelay,s=n.maximumDoubleTouchDistance,l=e){super(!1),this._maximumDoubleClickDelay=t,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=o,this._maximumDoubleTouchDistance=s,this._clock=l,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this))}onUninstall(){this._pointerState.forEach((e=>e.doubleClickTimer=i(e.doubleClickTimer)))}get hasPendingInputs(){return t(this._pointerState,(e=>null!=e.doubleClickTimer))}_clearDoubleClickTimer(e,t){const o=this._pointerState.get(e);o&&(o.doubleClickTimer=i(o.doubleClickTimer),t&&this._click.emit(o.event.data,void 0,o.event.modifiers),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const t=this._pointerState.get(e);1===t.pointerDownCount&&this._click.emit(t.event.data,void 0,t.event.modifiers),t.doubleClickTimer=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}
|
|
5
|
+
import{clock as e}from"../../../core/clock.js";import{someMap as t}from"../../../core/MapUtils.js";import{removeMaybe as i}from"../../../core/maybe.js";import{InputHandler as o}from"../InputHandler.js";import{DefaultParameters as n,manhattanDistance as s,getPointerId as l}from"./support.js";class r extends o{constructor(t=n.maximumDoubleClickDelay,i=n.maximumDoubleClickDistance,o=n.maximumDoubleTouchDelay,s=n.maximumDoubleTouchDistance,l=e){super(!1),this._maximumDoubleClickDelay=t,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=o,this._maximumDoubleTouchDistance=s,this._clock=l,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this))}onUninstall(){this._pointerState.forEach((e=>e.doubleClickTimer=i(e.doubleClickTimer)))}get hasPendingInputs(){return t(this._pointerState,(e=>null!=e.doubleClickTimer))}_clearDoubleClickTimer(e,t){const o=this._pointerState.get(e);o&&(o.doubleClickTimer=i(o.doubleClickTimer),t&&this._click.emit(o.event.data,void 0,o.event.modifiers),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const t=this._pointerState.get(e);1===t.pointerDownCount&&this._click.emit(t.event.data,void 0,t.event.modifiers),t.doubleClickTimer=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}_handleImmediateClick(e){const t=e.data,{pointerType:i}=t.native,o=c(t);if(!this._pointerState.has(o))return void this._startClick(e);const n=this._pointerState.get(o),{data:l,modifiers:r}=n.event,a="touch"===i?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;s(l,t)>a?(this._clearDoubleClickTimer(o,!0),this._startClick(e)):(this._clearDoubleClickTimer(o,!1),2===n.pointerDownCount&&this._doubleClick.emit(l,void 0,r))}_handlePointerDown(e){const t=l(e.data),i=this._pointerState.get(t);i&&(i.pointerDownCount+=1)}_startClick(e){const{data:t}=e,{native:{pointerType:i}}=t,o=l(t),n="touch"===i?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay,s=this._clock.setTimeout((()=>this._doubleClickTimeoutExceeded(o)),n),r=1;this._pointerState.set(o,{event:e,doubleClickTimer:s,pointerDownCount:r}),this.refreshHasPendingInputs()}}function c(e){const{pointerId:t,pointerType:i,button:o}=e.native;return"mouse"===i?`${t}:${o}`:`${i}`}export{r as SingleAndDoubleClick};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{find as t}from"../../core/iteratorUtils.js";import{someMap as e}from"../../core/MapUtils.js";import{clamp as o}from"../../core/mathUtils.js";import{createScreenPoint as
|
|
5
|
+
import{find as t}from"../../core/iteratorUtils.js";import{someMap as e}from"../../core/MapUtils.js";import{clamp as o}from"../../core/mathUtils.js";import{createScreenPoint as a}from"../../core/screenUtils.js";import{areToolManipulatorsEditable as i}from"./interactiveToolUtils.js";import{createScreenPointFromEvent as r}from"../support/screenUtils.js";class n{constructor(){this._pointerLocations=new Map,this._hoveredManipulators=new Map,this._grabbedManipulators=new Map,this._draggedManipulators=new Map,this._stopDrag=!1,this._revertToNullActiveTool=!1,this._cursor=null}get cursor(){return this._cursor}hasFocusedManipulators(){return this._grabbedManipulators.size>0||this._draggedManipulators.size>0}handleInputEvent(t,e){const a=()=>t.stopPropagation();switch(t.type){case"pointer-move":p(t.pointerType)&&this._pointerLocations.set(t.pointerId,{x:t.x,y:t.y,pointerType:t.pointerType});break;case"drag":this._grabbedManipulators.size>0&&(this._stopDrag=!0),this._stopDrag&&(a(),"end"===t.action&&(this._stopDrag=!1));break;case"pointer-down":{if(!u(t))break;const o=r(t),i=l(o,t.pointerType,e.forEachTool);if(null==i)break;const n=i.manipulator,s=i.tool;null==n||null==s||!n.interactive||n.grabbable&&n.grabbableForEvent(t)||!n.grabbing||n.dragging||this._releaseManipulatorBeforeDragging(n,t,e),null!=n&&null!=s&&n.interactive&&n.grabbable&&n.grabbableForEvent(t)&&!n.grabbing&&(this._grabbedManipulators.set(t.pointerId,{manipulator:n,tool:s,start:o,pointerType:t.pointerType}),1===this._grabbedManipulators.size&&null==e.activeTool&&(this._revertToNullActiveTool=!0,e.setActiveTool(i.tool)),n.grabbing=!0,n.events.emit("grab-changed",{action:"start",pointerType:t.pointerType,screenPoint:o}),a());break}case"pointer-up":this._draggedManipulators.has(t.pointerId)||this._handlePointerEnd(t,e);break;case"pointer-drag":{if(!u(t))break;const i=this._grabbedManipulators.get(t.pointerId),n=i?.manipulator,s=i?.tool;if(null==n||null==s)break;const l=r(t);l.x=o(l.x,0,e.view.width),l.y=o(l.y,0,e.view.height);const p=i.start,c=this._draggedManipulators.get(t.pointerId);switch(t.action){case"start":case"update":"update"!==t.action&&1!==this._grabbedManipulators.size||(n.dragging=!0,c?n.events.emit("drag",{action:"update",start:p,screenPoint:l}):n.events.emit("drag",{action:"start",start:p,screenPoint:l,pointerType:t.pointerType}),this._draggedManipulators.set(t.pointerId,{tool:s,manipulator:n,start:p}));break;case"end":n.dragging=!1,c&&n.events.emit("drag",{action:"end",start:p,screenPoint:l}),this._draggedManipulators.delete(t.pointerId),this._handlePointerEnd(t,e)}a();break}case"immediate-click":{const o=r(t),i=l(o,t.pointerType,e.forEachTool);if(c(t)||e.forEachTool((t=>{if((null==i||i.tool!==t||t.automaticManipulatorSelection)&&t.manipulators){let e=!1;t.manipulators.forEach((({manipulator:t})=>{t.selected&&(t.selected=!1,e=!0)})),e&&t.onManipulatorSelectionChanged&&t.onManipulatorSelectionChanged()}})),null==i)break;const{manipulator:n,tool:s}=i;if(!n.interactive)break;n.selectable&&s.automaticManipulatorSelection&&(n.selected=!n.selected,s.onManipulatorSelectionChanged&&s.onManipulatorSelectionChanged());const p=t.native.shiftKey;n.events.emit("immediate-click",{screenPoint:o,button:t.button,pointerType:t.pointerType,shiftKey:p,stopPropagation:a}),d(n,a);break}case"click":{const o=r(t),i=l(o,t.pointerType,e.forEachTool),n=i?.manipulator;if(null==n||!n.interactive)break;const s=t.native.shiftKey;n.events.emit(t.type,{screenPoint:o,button:t.button,pointerType:t.pointerType,shiftKey:s}),a();break}case"double-click":{const o=r(t),i=l(o,t.pointerType,e.forEachTool),n=null!=i?i.manipulator:null;if(null==n||!n.interactive)break;const s=t.native.shiftKey;n.events.emit("double-click",{screenPoint:o,button:t.button,pointerType:t.pointerType,shiftKey:s,stopPropagation:a}),d(n,a);break}case"immediate-double-click":{const o=r(t),i=l(o,t.pointerType,e.forEachTool),n=null!=i?i.manipulator:null;if(null==n||!n.interactive)break;const s=t.native.shiftKey;n.events.emit("immediate-double-click",{screenPoint:o,button:t.button,pointerType:t.pointerType,shiftKey:s,stopPropagation:a}),d(n,a);break}}this._onFocusChange(e.forEachTool)}_releaseManipulatorBeforeDragging(t,e,o){t.grabbing=!1,t.events.emit("grab-changed",{action:"end",pointerType:e.pointerType,screenPoint:r(e)}),this._grabbedManipulators.forEach((({manipulator:e},o)=>{e===t&&this._grabbedManipulators.delete(o)})),this._afterManipulatorRelease(o.setActiveTool)}_handlePointerEnd(t,e){const o=this._grabbedManipulators.get(t.pointerId)?.manipulator;null!=o&&o.grabbing&&(o.grabbing=!1,o.events.emit("grab-changed",{action:"end",pointerType:t.pointerType,screenPoint:r(t)}),this._grabbedManipulators.delete(t.pointerId),this._afterManipulatorRelease(e.setActiveTool))}_onFocusChange(t){this._updateCursor(),this._updateFocusedManipulatorTools(t)}_updateCursor(){this._grabbedManipulators.size>0?this._cursor=s(this._grabbedManipulators)||"grabbing":this._hoveredManipulators.size>0?this._cursor=s(this._hoveredManipulators)||"pointer":this._cursor=null}_updateFocusedManipulatorTools(e){const o=new Set,a=new Set;this._grabbedManipulators.forEach((({tool:t})=>{o.add(t)})),this._hoveredManipulators.forEach((({tool:t})=>{a.add(t)})),e((e=>{e.hasGrabbedManipulators=o.has(e),e.hasHoveredManipulators=a.has(e);const i=this._grabbedManipulators.values(),r=t(i,(({tool:t})=>t===e));e.firstGrabbedManipulator=null!=r?r.manipulator:null}))}clearPointers(t,{forEachTool:e,setActiveTool:o},a=!0,i){const r=(e,o)=>e===t&&(null==i||i===o);this._grabbedManipulators.forEach((({tool:t,manipulator:e,pointerType:o},a)=>{r(t,e)&&(this._grabbedManipulators.delete(a),e.grabbing=!1,e.events.emit("grab-changed",{action:"end",screenPoint:null,pointerType:o}))})),this._draggedManipulators.forEach((({tool:t,manipulator:e},o)=>{r(t,e)&&(this._draggedManipulators.delete(o),e.dragging=!1,e.events.emit("drag",{action:"cancel"}))})),a&&this._hoveredManipulators.forEach((({tool:t,manipulator:e},o)=>{r(t,e)&&(this._hoveredManipulators.delete(o),e.hovering=!1)})),this._afterManipulatorRelease(o),this._onFocusChange(e)}updateHoveredStateFromKnownPointers(t){this._pointerLocations.forEach(((e,o)=>{this._updateHoveredStateForPointerAtScreenPosition(a(e.x,e.y),o,e.pointerType,t)}))}handleHoverEvent(t,e){"pointer-up"!==t.type&&"immediate-click"!==t.type&&"pointer-move"!==t.type||!p(t.pointerType)||this._updateHoveredStateForPointerAtScreenPosition(r(t),t.pointerId,t.pointerType,e)}_updateHoveredStateForPointerAtScreenPosition(t,e,o,a){let i=l(t,o,a);const r=this._hoveredManipulators.get(e)?.manipulator;null==i||i.manipulator.interactive||(i=null),null!=i&&r===i.manipulator||(null!=r&&(r.hovering=!1),null!=i?(i.manipulator.hovering=!0,this._hoveredManipulators.set(e,i)):this._hoveredManipulators.delete(e),this._onFocusChange(a))}_afterManipulatorRelease(t){0===this._grabbedManipulators.size&&this._revertToNullActiveTool&&(t(null),this._revertToNullActiveTool=!1)}}function s(t){let o=null;return e(t,(({manipulator:t})=>!(null==t||!t.interactive)&&(t.grabbing&&t.grabCursor?(o=t.grabCursor,!0):!!t.cursor&&(o=t.cursor,!0)))),o}function l(t,e,o){let a=null;return o((o=>{if(null==o.manipulators||!i(o))return!1;const r=o.manipulators.intersect(t,e);return null!=r&&(a={tool:o,manipulator:r},!0)})),a}function p(t){return"mouse"===t}function u(t){return"mouse"!==t.pointerType||0===t.button}function c(t){return!!t.native.shiftKey}function d(t,e){t?.consumesClicks&&e()}export{n as ToolViewManagerManipulatorState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import{remove as e}from"../../core/arrayUtils.js";import{makeHandle as t,handlesGroup as i}from"../../core/handleUtils.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{ViewEventPriorities as r}from"../input/InputManager.js";import{primaryKey as n}from"../input/keys.js";const s="z",a="r",p={redo:a,undo:s,center:"Alt",constraint:"Shift",cancel:"Escape",delete:["Backspace","Delete"],complete:"Enter",vertexAdd:"f",pan:" "},c={toggle:"Control"},f={enterInputMode:"Tab",commit:"Enter",discard:"Escape",next:"Tab"},d={moveUp:{key:"ArrowUp",modifier:"Shift",repeats:!0},moveDown:{key:"ArrowDown",modifier:"Shift",repeats:!0},moveLeft:{key:"ArrowLeft",modifier:"Shift",repeats:!0},moveRight:{key:"ArrowRight",modifier:"Shift",repeats:!0},scaleUp:{key:"+",modifier:"Shift"},scaleDown:{key:"-",modifier:"Shift"},factorModifier:{key:n,continuePropagation:!0},toggleOpacity:"t",preserveAspectRatio:{key:"Shift",continuePropagation:!0},rotateIncrements:{key:"Shift",continuePropagation:!0},undo:s,redo:a};class h{constructor(){this._bindings=new Map}add(e,t){return this.addToggle(e,(e=>{"key-down"===e.type&&t(e)}))}addToggle(i,r){const n=m.fromDefinition(i,r),s=o(this._bindings,n.key,(()=>[]));return s.push(n),t((()=>e(s,n)))}register(e,t=r.WIDGET){return i([e.on("key-down",(t=>this.dispatch(e.inputManager,t)),t),e.on("key-up",(t=>this.dispatch(e.inputManager,t)),t)])}dispatch(e,t){const i=t.key,o=this._bindings.get(i);if(o)for(const r of o)r.process(e,t)}}class m{constructor(e,t,i,o,r){this.key=e,this.modifiers=t,this.repeats=i,this.continuePropagation=o,this.callback=r}process(e,t){if(!(t.key!==this.key||"repeat"in t&&t.repeat&&!this.repeats)){for(const t of this.modifiers)if(!e.isModifierKeyDown(t))return;this.continuePropagation||t.stopPropagation(),this.callback(t)}}static fromDefinition(e,t){if("string"==typeof e)return new m(e,[],!1,!1,t);const{key:i,modifier:o,repeats:r,continuePropagation:n}=e;return new m(i,o?Array.isArray(o)?o:[o]:[],!!r,!!n,t)}}export{h as KeyBindings,d as mediaKeys,p as sketchKeys,c as snappingKeys,f as tooltipKeys};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Logger.js";import{watch as i,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{sqlAnd as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Logger.js";import{watch as i,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{sqlAnd as o}from"../../../core/sql.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as u}from"../../../layers/support/floorFilterUtils.js";import{isSubtypeGroupLayer as p,isFeatureLayer as c}from"../../../layers/support/layerUtils.js";import{isUtilityNetworkWebMap as d}from"./snappingUtils.js";import{scaleBoundsPredicate as y}from"../../support/layerViewUtils.js";let f=class extends r{get layerView(){return this.view?.allLayerViews?.find((e=>e.layer===this.layer))}get valid(){return this._valid}get subtypeFilter(){const{layer:e,snappingSource:r}=this;if(!p(e)||!e.subtypes?.length)return{mode:"not-in-use",filter:null};const t=r.layerSource.sublayerSources.filter((e=>e.enabled&&e.layer.visible&&y(this.view?.scale,e.layer.effectiveScaleRange.minScale,e.layer.effectiveScaleRange.maxScale))).map((e=>e.layer.subtypeCode));if(!t.length)return{mode:"none-visible",filter:null};if(t.length===e.subtypes.length)return{mode:"all-visible",filter:null};const i=e.fieldsIndex.get(e.subtypeField)?.name??e.subtypeField;return 1===t.length?{mode:"in-use",filter:`${i} = ${t.getItemAt(0)}`}:{mode:"in-use",filter:`${i} IN (${t.join(", ")})`}}get floorFilter(){const{view:e,layer:r}=this;return e&&r?u({view:e,layer:r}):null}constructor(e){super(e),this.rulesTable=null,this._valid=!1}initialize(){if(!this.snappingSource||!this.layer)return;const{layer:e,snappingSource:r}=this;if("refresh"in e){const t=e;this.addHandles(t.on("refresh",(()=>r.refresh())))}this.loadRules(),this.addHandles([i((()=>r.updating),(e=>r.layerSource.updating=e),l),i((()=>r.availability),(e=>r.layerSource.availability=e),l)])}getFetchCandidatesParameters(e,r,t){if(!this.valid)return[];const{layer:i,layerView:l,floorFilter:s,rulesTable:a,subtypeFilter:u}=this,y={distance:t,mode:this.view?.type??"2d",point:e,coordinateHelper:r.coordinateHelper,...m(),filter:l&&"filter"in l?l.filter:null};if(s&&(y.filter=h(y.filter,s)),"not-in-use"!==u.mode&&"all-visible"!==u.mode){if("none-visible"===u.mode)return[];y.filter?y.filter.where=o(y.filter.where,u.mode):y.filter=new n({where:u.filter})}const f=r.feature,v="subtype-sublayer"===f?.sourceLayer?.type?f.sourceLayer.parent:f?.sourceLayer;if(a&&f&&d(this.view?.map)&&(c(i)||p(i))&&i.layerId&&(c(v)||p(v))&&this.view.map.utilityNetworks?.find((e=>e.isUtilityLayer(v)))){if("loaded"!==a.loadStatus)return[];const e=[],r=i.layerId,t=a.getFeatureSQL(v,f)?.[r];if(!t)return[];const l=t.anyVertex;let o=t.endVertex;return o&&l&&o===l&&(o=""),o&&e.push({...y,returnEdge:!1,vertexMode:"ends",filter:h(y.filter,o)}),l&&e.push({...y,returnEdge:!1,vertexMode:"all",filter:h(y.filter,l)}),e}return[y]}async loadRules(){const{layer:e,view:r}=this;if(e&&r&&d(r?.map)&&(c(e)||p(e))){const l=r.map.utilityNetworks?.find((r=>r.isUtilityLayer(e)));if(l)try{this.rulesTable=await l.getRulesTable(),await(this.rulesTable?.load())}catch(i){return void t.getLogger("esri.views.interactive.snapping.FeatureSnappingSourceInfo").error("Failed to load rules table for snapping source",e.title)}}this._valid=!0}remove(){this.destroy()}destroy(){this.snappingSource?.destroy()}};function m(){return{returnEdge:!0,vertexMode:"all"}}function h(e,r){return null==e?new n({where:r}):e.where?new n({where:o(e.where,r)}):new n({where:r})}e([s({constructOnly:!0})],f.prototype,"layer",void 0),e([s({constructOnly:!0})],f.prototype,"snappingSource",void 0),e([s({constructOnly:!0})],f.prototype,"view",void 0),e([s()],f.prototype,"layerView",null),e([s()],f.prototype,"rulesTable",void 0),e([s()],f.prototype,"valid",null),e([s()],f.prototype,"subtypeFilter",null),e([s()],f.prototype,"floorFilter",null),e([s()],f.prototype,"_valid",void 0),f=e([a("esri.views.interactive.snapping.FeatureSnappingSourceInfo")],f);export{f as FeatureSnappingSourceInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as r,createAngle as s}from"../../../core/quantityUtils.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as i}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,fromVec3 as a}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as d,squaredScreenDistance as l}from"./snappingUtils.js";import{LineSnappingCandidate as h}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as c}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as
|
|
5
|
+
import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as r,createAngle as s}from"../../../core/quantityUtils.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as i}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,fromVec3 as a}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as d,squaredScreenDistance as l}from"./snappingUtils.js";import{LineSnappingCandidate as h}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as c}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as f,pointFromDistanceAlongAzimuth as g}from"../../support/angularMeasurementUtils.js";import{geodesicDistance as m}from"../../support/geodesicLengthMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";import{LineType as x}from"../../support/geometry2dUtils.js";class j extends p{snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],s=r.edges.length,o=[];if(s<1)return o;const{spatialReference:n}=t,a=c(e,n,i,this.view),{view:p}=this,l=r.edges[s-1];let h=l;do{if(this.edgeExceedsShortLineThreshold(h,t)){const r=d(h,p,t);this._processCandidateProposal(r.left,r.right,e,a,t,o)}h=h.leftVertex.leftEdge}while(h&&h!==l);return o}snapExistingVertex(e,t){const r=[],s=t.vertexHandle,o=s.component;if(o.edges.length<2)return r;const{view:a}=this,{spatialReference:p}=t,l=c(e,p,i,a),h=s.leftEdge,f=s.rightEdge;h&&f&&this.edgeExceedsShortLineThreshold(h,t)&&this.edgeExceedsShortLineThreshold(f,t)&&this._processCandidateProposal(n(h.leftVertex.pos,a,t),n(f.rightVertex.pos,a,t),e,l,t,r);const g=o.edges[0];let m=g;do{if(m!==s.leftEdge&&m!==s.rightEdge&&this.edgeExceedsShortLineThreshold(m,t)){const s=d(m,a,t);this._processCandidateProposal(s.left,s.right,e,l,t,r)}m=m.rightVertex.rightEdge}while(m&&m!==g);return r}_processCandidateProposal(e,t,r,s,n,p){const{spatialReference:d,pointer:f}=n,g=o();E(g,e,t,r,n);const m=a(g);l(s,c(m,d,i,this.view))<this.squaredProximityThreshold(f)&&p.push(new h({lineStart:e,lineEnd:t,targetPoint:m,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function E(e,t,r,s,o){v(e,t,r,s,o)||w(e,s,t,r)}function v(o,i,n,a,{spatialReference:p}){const d=f(i,n,p,p);if(null==d)return!1;const l=f(n,a,p,p);if(null==l)return!1;const h=m(n,a,p);if(null==h)return!1;const c=Math.abs(e.shortestSignedDiff(d,l))>Math.PI/2?t.normalize(d+Math.PI):d;return g(o,n,p,r(h,"meters"),s(c,"radians","geographic"),"geodesic"),o[2]=a[2],!0}function w(e,t,r,s){u(t,{start:r,end:s,type:x.LINE},e),e[2]=t[2]}export{j as LineSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as n}from"./Settings.js";import{SnappingAlgorithm as l}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as a,squaredScreenDistance as c}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as h}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToLine as p}from"../../support/geometry2dUtils.js";class g extends l{snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],o=s.edges.length,n=s.vertices.length,l=[];if(o<2)return l;const{view:c}=this,h=d(e,t.spatialReference,r,c),p=i(s.vertices[n-1].pos,c,t),g=i(s.vertices[0].pos,c,t),f=s.edges[o-1];let m=f;do{if(this.edgeExceedsShortLineThreshold(m,t)){const r=a(m,c,t);this._checkEdgeForParallelLines(r,p,e,h,t,l),this._checkEdgeForParallelLines(r,g,e,h,t,l)}m=m.leftVertex.leftEdge}while(m&&m!==f);return l}snapExistingVertex(e,t){const s=[],o=t.vertexHandle,n=o.component;if(n.edges.length<3)return s;const{view:l}=this,c=d(e,t.spatialReference,r,l),h=o.leftEdge,p=o.rightEdge,g=n.vertices[0],f=i(g.pos,l,t),m=n.vertices.length,u=n.vertices[m-1],v=i(u.pos,l,t),x=n.edges[0];let E=x;do{if(E!==h&&E!==p&&this.edgeExceedsShortLineThreshold(E,t)){const r=a(E,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,c,t,s),p&&this._checkEdgeForParallelLines(r,i(p.rightVertex.pos,l,t),e,c,t,s),o===g?this._checkEdgeForParallelLines(r,v,e,c,t,s):o===u&&this._checkEdgeForParallelLines(r,f,e,c,t,s)}E=E.rightVertex.rightEdge}while(E&&E!==x);return s}_checkEdgeForParallelLines(t,i,l,a,g,
|
|
5
|
+
import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as n}from"./Settings.js";import{SnappingAlgorithm as l}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as a,squaredScreenDistance as c}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as h}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToLine as p}from"../../support/geometry2dUtils.js";class g extends l{snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],o=s.edges.length,n=s.vertices.length,l=[];if(o<2)return l;const{view:c}=this,h=d(e,t.spatialReference,r,c),p=i(s.vertices[n-1].pos,c,t),g=i(s.vertices[0].pos,c,t),f=s.edges[o-1];let m=f;do{if(this.edgeExceedsShortLineThreshold(m,t)){const r=a(m,c,t);this._checkEdgeForParallelLines(r,p,e,h,t,l),this._checkEdgeForParallelLines(r,g,e,h,t,l)}m=m.leftVertex.leftEdge}while(m&&m!==f);return l}snapExistingVertex(e,t){const s=[],o=t.vertexHandle,n=o.component;if(n.edges.length<3)return s;const{view:l}=this,c=d(e,t.spatialReference,r,l),h=o.leftEdge,p=o.rightEdge,g=n.vertices[0],f=i(g.pos,l,t),m=n.vertices.length,u=n.vertices[m-1],v=i(u.pos,l,t),x=n.edges[0];let E=x;do{if(E!==h&&E!==p&&this.edgeExceedsShortLineThreshold(E,t)){const r=a(E,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,c,t,s),p&&this._checkEdgeForParallelLines(r,i(p.rightVertex.pos,l,t),e,c,t,s),o===g?this._checkEdgeForParallelLines(r,v,e,c,t,s):o===u&&this._checkEdgeForParallelLines(r,f,e,c,t,s)}E=E.rightVertex.rightEdge}while(E&&E!==x);return s}_checkEdgeForParallelLines(t,i,l,a,g,u){const v=t.left,x=t.right;if(p(m,s(i),s(v),s(x)),e(m,s(i))<n.parallelLineThreshold)return;p(m,s(l),s(v),s(x),s(i));const{spatialReference:E,pointer:L}=g,P=o(m[0],m[1],l[2]);if(c(a,d(P,E,r,this.view))<this.squaredProximityThreshold(L)){if(this.isVertical(P,i,g)||this.isVertical(v,x,g))return;if(f(t,u))return;u.push(new h({referenceLine:t,lineStart:i,targetPoint:P,isDraped:"on-the-ground"===g.elevationInfo?.mode}))}}}function f(t,r){const i=t.left,o=t.right;for(const l of r)if(p(m,s(o),s(l.constraint.start),s(l.constraint.end),s(i)),e(m,s(o))<n.parallelLineThreshold)return l.addReferenceLine(t),!0;return!1}const m=t();export{g as ParallelLineSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as
|
|
5
|
+
import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as n,squaredLength as s,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{r as c,f as p,s as h}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as d}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as l}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as m,fromValues as u,fromVec3 as x}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as j}from"./SnappingAlgorithm.js";import{squaredScreenDistance as v}from"./snappingUtils.js";import{RightAngleSnappingCandidate as V,OtherVertexType as E}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as S}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as k,pointFromDistanceAlongAzimuth as C}from"../../support/angularMeasurementUtils.js";import{geodesicDistance as F}from"../../support/geodesicLengthMeasurementUtils.js";class _ extends j{snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],i=[];if(r.vertices.length<2)return i;const{view:n}=this,s=S(e,t.spatialReference,d,n),o=r.vertices.at(-1);this._checkForSnappingCandidate(i,o.leftEdge,o,o.leftEdge.leftVertex,e,s,t);const a=r.vertices[0];return this._checkForSnappingCandidate(i,a.rightEdge,a,a.rightEdge.rightVertex,e,s,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.component.vertices.length<3)return r;const{view:n}=this,s=S(e,t.spatialReference,d,n),o=i.leftEdge,a=i.rightEdge;if(o?.leftVertex.leftEdge){const i=o.leftVertex.leftEdge;this._checkForSnappingCandidate(r,i,i.rightVertex,i.leftVertex,e,s,t)}if(a?.rightVertex.rightEdge){const i=a.rightVertex.rightEdge;this._checkForSnappingCandidate(r,i,i.leftVertex,i.rightVertex,e,s,t)}return r}_checkForSnappingCandidate(e,t,r,i,n,s,o){if(!this.edgeExceedsShortLineThreshold(t,o))return;const a=this.view,c=f(r.pos,a,o),p=f(i.pos,a,o);this._checkForSnappingCandidateNormalized(e,p,c,n,s,o)}_checkForSnappingCandidateNormalized(e,t,r,i,n,s){w(U,t,r,i,s),this._checkForSnappingCandidateAlongProjectedRay(e,t,r,U,i,n,s)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,p,h,f){const{spatialReference:j,pointer:k}=f,C=i(P,m(p),m(r)),F=n(a,C)/s(a),_=o(P,m(r),a,F),w=u(_[0],_[1],p[2]);if(v(h,S(w,j,d,this.view))>this.squaredProximityThreshold(k)||this.isVertical(w,r,f)||this.isVertical(r,t,f))return;const R=c(g(),r,a,Math.sign(F));e.push(new V({targetPoint:w,constraint:new l(r,x(R)),previousVertex:t,otherVertex:r,otherVertexType:E.CENTER,isDraped:"on-the-ground"===f.elevationInfo?.mode}))}}function w(e,t,r,i,n){R(e,t,r,i,n)||y(e,t,r)}function R(i,n,s,o,{spatialReference:a}){const c=k(n,s,a,a);if(null==c)return!1;const h=k(s,o,a,a);if(null==h)return!1;const d=Math.sign(e.shortestSignedDiff(c,h))*Math.PI*.5,l=t(c+d,"radians","geographic"),f=g(),m=F(s,o,a);return null!=m&&(C(f,s,a,r(m,"meters"),l,"geodesic"),p(i,f,s),!0)}function y(e,t,r){const n=i(P,m(r),m(t));h(e,n[1],-n[0],0)}const P=a(),U=g();export{_ as RightAngleSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import n from"../../../core/Evented.js";import{isAborted as i}from"../../../core/promiseUtils.js";import{watch as s,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import n from"../../../core/Evented.js";import{isAborted as i}from"../../../core/promiseUtils.js";import{watch as s,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{project as c,initializeProjection as d}from"../../../geometry/projection.js";import{absoluteHeightElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{fromPoint as u,toElevationAlignedDehydratedPoint as l}from"../sketch/normalizedPoint.js";import{defaults as f}from"./Settings.js";import{SnappingDomain as g}from"./SnappingDomain.js";import{defaultSnappingEnginesFactory as _}from"./snappingFactory.js";import m from"./SnappingOptions.js";import{sortCandidatesInPlace as S,squaredScreenDistance as v}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as y}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as C}from"./candidates/EdgeSnappingCandidate.js";import{IntersectionSnappingCandidate as P}from"./candidates/IntersectionSnappingCandidate.js";import{LineSnappingCandidate as E}from"./candidates/LineSnappingCandidate.js";import{ParallelLineSnappingCandidate as j}from"./candidates/ParallelLineSnappingCandidate.js";import{RightAngleSnappingCandidate as w}from"./candidates/RightAngleSnappingCandidate.js";import{RightAngleTriangleSnappingCandidate as T}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as M}from"../support/viewUtils.js";let A=class extends(n.EventedMixin(e)){constructor(t){super(t),this.options=new m,this.snappingEnginesFactory=_,this._engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=R.MAIN}initialize(){this.addHandles([s((()=>{const{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i,constraintsActive:s}=this.options;return{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i,constraintsActive:s}}),(()=>{this.doneSnapping(),this.emit("changed")}),r),s((()=>this.options),(t=>{for(const e of this._engines)e.options=t}),r),s((()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory})),(({viewReady:t,snappingEnginesFactory:e})=>this._recreateEngines(t,e)),a)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some((t=>t.updating))}_recreateEngines(t,e){if(this._destroyEngines(),!t)return;const{view:n,options:i}=this;this._engines=e(n,i)}_destroyEngines(){for(const t of this._engines)t.destroy();this._engines=[]}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:t,touchSensitivityMultiplier:e}=this.options,n=t*e;return n*n}snap(t){return F(t)?this._snapMultiPoint(t):this._snapSinglePoint(t)}update(t){const{point:e,context:n}=t;this._removeVisualization();const i=this._currentMainCandidate;if(null==i)return e;const s=this._selectUpdateInput(t);if(null==s)return e;const{spatialReference:r}=n,a=c(s,r);if(null==a)return e;const{view:o}=this,{elevationInfo:p,visualizer:d}=n,h=[],f=u(a,o,p),g=i.constraint.closestTo(f);if(!this._arePointsWithinScreenThreshold(f,g,n))return this._resetSnappingState(),e;i.targetPoint=g,h.push(...i.hints);for(const c of this._currentOtherActiveCandidates)c.targetPoint=g,h.push(...c.hints);return null!=d&&this.addHandles(d.draw(h,{spatialReference:r,elevationInfo:N(n),view:o,selfSnappingZ:n.selfSnappingZ}),q),l(g,o,e,n)}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:t,scenePoint:e}){switch(this._currentSnappedType){case R.MAIN:return t;case R.SCENE:return e}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=R.MAIN}_removeVisualization(){this.removeHandles(q)}async _snapSinglePoint({point:t,context:e,signal:n}){const{view:i}=this,{elevationInfo:s}=e,r=u(t,i,s),a=await this._fetchCandidates(r,g.ALL,e,n);return this._createSnapResult(r,R.MAIN,a,i,t,e,n)}async _snapMultiPoint({point:t,scenePoint:e,context:n,signal:i}){const{view:s}=this,{coordinateHelper:r,elevationInfo:a,spatialReference:o}=n;await d(e.spatialReference,o);const p=c(e,o),h=u(p,s,a),l=await this._fetchCandidates(h,g.FEATURE,n,i);if(l.length>0){const t=await this._fetchCandidates(h,g.SELF,n,i);return this._createSnapResult(h,R.SCENE,[...l,...t],s,p,n,i)}const f=u(t,s,a),_=await this._fetchCandidates(f,g.SELF,n,i);return this._createSnapResult(f,R.MAIN,_,s,{z:r.hasZ()&&t.hasZ?t.z??0:void 0,m:r.hasM()&&t.hasM?t.m??0:void 0},n,i)}async _fetchCandidates(t,e,n,i){return(await Promise.all(this._engines.map((s=>s.fetchCandidates(t,e,n,i))))).flat()}_createSnapResult(t,e,n,s,r,a,o){return{get valid(){return!i(o)},apply:()=>{const{spatialReference:i}=a,{snappedPoint:o,hints:p}=this._processCandidates(t,e,n,a);return this._removeVisualization(),null!=a.visualizer&&this.addHandles(a.visualizer.draw(p,{spatialReference:i,elevationInfo:h,view:s,selfSnappingZ:a.selfSnappingZ}),q),l(o,s,r,a)}}}_processCandidates(t,e,n,i){if(n.length<1)return this.doneSnapping(),{snappedPoint:t,hints:[]};this._currentSnappedType!==e&&this._resetSnappingState(),S(t,n);const s=this._currentMainCandidate;if(null!=s){const r=x(s,n);if(r>=0){if(!(n[r]instanceof P))return this._intersectWithOtherCandidates(r,n,t,e,i);if(this._arePointsWithinScreenThreshold(t,s.targetPoint,i))return this._updateSnappingCandidate(s,e,n,i)}}return this._intersectWithOtherCandidates(0,n,t,e,i)}_intersectWithOtherCandidates(t,e,n,i,s){const{coordinateHelper:r}=s,a=e[t],o=[];for(let p=0;p<e.length;++p){if(p===t)continue;const i=e[p],s=a.constraint.intersect(i.constraint);if(s)for(const t of s.closestPoints(a.targetPoint))o.push([new P(t,a,i,i.isDraped),this._squaredScreenDistance(n,t,r)])}return o.length>0&&(o.sort(((t,e)=>t[1]-e[1])),o[0][1]<this._squaredPointProximityThreshold(s.pointer))?this._updateSnappingCandidate(o[0][0],i,e,s):this.options.constraintsActive&&(a instanceof y||a instanceof C||a instanceof E||a instanceof j||a instanceof w||a instanceof T)?{snappedPoint:n,hints:[]}:this._updateSnappingCandidate(a,i,e,s)}_updateSnappingCandidate(t,e,n,i){this.doneSnapping(),this._currentMainCandidate=t,this._currentSnappedType=e;const s=this._currentMainCandidate.targetPoint,r=[];r.push(...t.hints);for(const a of n){if(t instanceof P){if(a.constraint.equals(t.first.constraint)||a.constraint.equals(t.second.constraint))continue}else if(a.constraint.equals(t.constraint))continue;const e=a.constraint.closestTo(s);this._squaredScreenDistance(e,s,i.coordinateHelper)<I()&&(a.targetPoint=s,this._currentOtherActiveCandidates.push(a),r.push(...a.hints))}return{snappedPoint:s,hints:r}}_squaredPointProximityThreshold(t){return"touch"===t?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}_arePointsWithinScreenThreshold(t,e,n){return this._squaredScreenDistance(t,e,n.coordinateHelper)<this._squaredPointProximityThreshold(n.pointer)}_squaredScreenDistance(t,e,n){return v(this._toScreen(t,n),this._toScreen(e,n))}_toScreen(t,e){return M(t,e.spatialReference,h,this.view)}get test(){return{visualizationsActive:this.hasHandles(q),engines:this._engines}}};var R;t([o({constructOnly:!0})],A.prototype,"view",void 0),t([o()],A.prototype,"options",void 0),t([o({readOnly:!0})],A.prototype,"updating",null),t([o()],A.prototype,"snappingEnginesFactory",void 0),t([o()],A.prototype,"_engines",void 0),t([o()],A.prototype,"_squaredMouseProximityThreshold",null),t([o()],A.prototype,"_squaredTouchProximityThreshold",null),A=t([p("esri.views.interactive.snapping.SnappingManager")],A),function(t){t[t.MAIN=0]="MAIN",t[t.SCENE=1]="SCENE"}(R||(R={}));const q="visualization-handle";function I(){return f.satisfiesConstraintScreenThreshold*f.satisfiesConstraintScreenThreshold}function x(t,e){return t instanceof P?z(e,t.first)>=0&&z(e,t.second)>=0?0:-1:z(e,t)}function z(t,e){let n=-1;for(let i=0;i<t.length;++i)if(e.constraint.equals(t[i].constraint)){n=i;break}return n}function F(t){return null!=t.scenePoint}function N({coordinateHelper:t,elevationInfo:e}){return t.hasZ()?h:e}export{A as SnappingManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as i}from"../../../core/handleUtils.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as t}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as s}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as o}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as e}from"./hints/RightAngleSnappingHint.js";class r{draw(r,
|
|
5
|
+
import{handlesGroup as i}from"../../../core/handleUtils.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as t}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as s}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as o}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as e}from"./hints/RightAngleSnappingHint.js";class r{draw(r,p){const h=a(r),f=this.sortUniqueHints(h),u=[];for(const i of f)i instanceof n&&u.push(this.visualizeIntersectionPoint(i,p)),i instanceof t&&u.push(this.visualizeLine(i,p)),i instanceof s&&u.push(this.visualizeParallelSign(i,p)),i instanceof e&&u.push(this.visualizeRightAngleQuad(i,p)),i instanceof o&&u.push(this.visualizePoint(i,p));return i(u)}sortUniqueHints(i){return i}}function a(i){const n=[];for(const t of i){let i=!0;for(const s of n)if(t.equals(s)){i=!1;break}i&&n.push(t)}return n}export{r as SnappingVisualizer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as i}from"../../../../../core/arrayUtils.js";import{abortMaybe as o}from"../../../../../core/maybe.js";import{debounce as n,whenOrAbort as a}from"../../../../../core/promiseUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as i}from"../../../../../core/arrayUtils.js";import{abortMaybe as o}from"../../../../../core/maybe.js";import{debounce as n,whenOrAbort as a}from"../../../../../core/promiseUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../../core/support/UpdatingHandles.js";import{WorkerHandle as l}from"../../../../../core/workers/WorkerHandle.js";import{featureGeometryTypeKebabDictionary as p}from"../../../../../geometry/support/typeUtils.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";let h=class extends t{get updating(){return this._updatingHandles.updating||this._workerHandleUpdating}constructor(e){super(e),this._updatingHandles=new d,this._suspendController=null,this.schedule=null,this.hasZ=!1,this.elevationAlignPointsInFeatures=async e=>{const t=[];for(const{points:i}of e.pointsInFeatures)for(const{z:e}of i)t.push(e);return{elevations:t,drapedObjectIds:new Set,failedObjectIds:new Set}},this.queryForSymbologySnapping=async()=>({candidates:[],sourceCandidateIndices:[]}),this.availability=0,this._workerHandleUpdating=!0,this._editId=0,this.updateOutFields=n((async(e,t)=>{await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateOutFields",[...e],t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}))}destroy(){this._suspendController=o(this._suspendController),this._workerHandle.destroy(),this._updatingHandles.destroy()}initialize(){this._workerHandle=new g(this.schedule,{alignElevation:async(e,{signal:t})=>({result:await this.elevationAlignPointsInFeatures(e.query,t)}),getSymbologyCandidates:async(e,{signal:t})=>({result:await this.queryForSymbologySnapping(e,t)})}),this.addHandles([this._workerHandle.on("notify-updating",(({updating:e})=>this._workerHandleUpdating=e)),this._workerHandle.on("notify-availability",(({availability:e})=>this._set("availability",e)))])}async setup(e,t){const i=y(e.layer);if(null==i)return;const o={configuration:c(e.configuration),serviceInfo:i,spatialReference:e.spatialReference.toJSON(),hasZ:this.hasZ,elevationInfo:e.layer.elevationInfo?.toJSON()};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("setup",o,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async configure(e,t){const i=c(e);await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("configure",i,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async refresh(e){await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("refresh",{},e)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},e))}async fetchCandidates(e,t){const{point:i,filter:o,coordinateHelper:n}=e,a={...e,point:u(i[0],i[1],i[2],n.spatialReference.toJSON()),filter:o?.toJSON()};return this._workerHandle.invoke(a,t)}async updateTiles(e,t){const i={tiles:e.tiles,tileInfo:null!=e.tileInfo?e.tileInfo.toJSON():null,tileSize:e.tileSize};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateTiles",i,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async applyEdits(e,t){const o=this._editId++,n={id:o};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("beginApplyEdits",n,t));const s=await this._updatingHandles.addPromise(a(e.result,t)),r={id:o,edits:{addedFeatures:s.addedFeatures?.map((({objectId:e})=>e)).filter(i)??[],deletedFeatures:s.deletedFeatures?.map((({objectId:e,globalId:t})=>({objectId:e,globalId:t})))??[],updatedFeatures:s.updatedFeatures?.map((({objectId:e})=>e)).filter(i)??[]}};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("endApplyEdits",r,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}getDebugInfo(e){return this._workerHandle.invokeMethod("getDebugInfo",{},e)}async notifyElevationSourceChange(){await this._workerHandle.invokeMethod("notifyElevationSourceChange",{})}async notifySymbologyChange(){await this._workerHandle.invokeMethod("notifySymbologyChange",{})}async setSymbologySnappingSupported(e){await this._workerHandle.invokeMethod("setSymbologySnappingSupported",e)}async setSuspended(e){this._suspendController?.abort(),this._suspendController=new AbortController,await this._workerHandle.invokeMethod("setSuspended",e,this._suspendController.signal)}};function c(e){return{filter:null!=e.filter?e.filter.toJSON():null,customParameters:e.customParameters,viewType:e.viewType}}function y(e){return"multipatch"===e.geometryType||"mesh"===e.geometryType?null:{url:e.parsedUrl?.path??"",fieldsIndex:e.fieldsIndex.toJSON(),geometryType:p.toJSON(e.geometryType),capabilities:e.capabilities,objectIdField:e.objectIdField,globalIdField:e.globalIdField,spatialReference:e.spatialReference.toJSON(),timeInfo:e.timeInfo?.toJSON()}}e([s({constructOnly:!0})],h.prototype,"schedule",void 0),e([s({constructOnly:!0})],h.prototype,"hasZ",void 0),e([s({constructOnly:!0})],h.prototype,"elevationAlignPointsInFeatures",void 0),e([s({constructOnly:!0})],h.prototype,"queryForSymbologySnapping",void 0),e([s({readOnly:!0})],h.prototype,"updating",null),e([s({readOnly:!0})],h.prototype,"availability",void 0),e([s()],h.prototype,"_workerHandleUpdating",void 0),h=e([r("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorkerHandle")],h);class g extends l{constructor(e,t){super("FeatureServiceSnappingSourceWorker","fetchCandidates",{},e,{strategy:"dedicated",client:t})}}export{h as FeatureServiceSnappingSourceWorkerHandle};
|