@arcgis/core 5.1.0-next.20 → 5.1.0-next.21
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/applications/Components/OrientedImageryViewer/galleryUtils.d.ts +45 -15
- package/applications/Components/QuantityFormatter.d.ts +11 -11
- package/applications/Components/SelectionOperation.d.ts +11 -11
- package/applications/Components/SketchTooltipControls.d.ts +9 -9
- package/applications/Components/actionUtils.d.ts +2 -1
- package/applications/Components/analysisUtils.d.ts +27 -26
- package/applications/Components/applySetUtils.d.ts +40 -40
- package/applications/Components/arcadeEditorUtils.d.ts +3 -3
- package/applications/Components/arcadeFeatureUtils.d.ts +12 -12
- package/applications/Components/baUtils.d.ts +8 -8
- package/applications/Components/basemapUtils.d.ts +2 -2
- package/applications/Components/clipboard.d.ts +14 -14
- package/applications/Components/drawUtils.d.ts +3 -3
- package/applications/Components/editUtils.d.ts +14 -14
- package/applications/Components/featureUtils.d.ts +10 -10
- package/applications/Components/fieldFormatUtils.d.ts +2 -2
- package/applications/Components/fontUtils.d.ts +2 -2
- package/applications/Components/formatUtils.d.ts +2 -2
- package/applications/Components/getDefaultUnits.d.ts +2 -2
- package/applications/Components/gfxUtils.d.ts +5 -1
- package/applications/Components/imageryUtils.d.ts +35 -35
- package/applications/Components/layerOriginUtils.d.ts +5 -5
- package/applications/Components/layersEffectsJsonUtils.d.ts +2 -2
- package/applications/Components/previewSymbol2D.d.ts +2 -2
- package/applications/Components/rasterFunctionEditorUtils.d.ts +40 -40
- package/applications/Components/reactiveUtils.d.ts +14 -13
- package/applications/Components/sanitizerUtils.d.ts +2 -2
- package/applications/Components/stringUtils.d.ts +5 -5
- package/applications/Components/styleUtils.d.ts +2 -2
- package/applications/Components/svgUtils.d.ts +4 -4
- package/applications/Components/symbolUtils.d.ts +47 -11
- package/applications/Components/templateUtils.d.ts +73 -17
- package/applications/Components/templateUtils.js +1 -1
- package/applications/Components/testUtils.d.ts +3 -3
- package/applications/Components/unitUtils.d.ts +1 -1
- package/applications/Components/viewUtils.d.ts +2 -2
- package/applications/Components/webStyleSymbolUtils.d.ts +2 -2
- package/applications/Excalibur/imageryLayerUtils.d.ts +3 -3
- package/applications/Excalibur/videoViewUtils.d.ts +8 -8
- package/applications/Excalibur/widgetUtils.d.ts +2 -2
- package/applications/ExperienceBuilder/sketchUtils.d.ts +7 -7
- package/applications/KnowledgeStudio/dataModelVisualization.d.ts +20 -8
- package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +21 -21
- package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +35 -35
- package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +9 -9
- package/applications/KnowledgeStudio/reshape.d.ts +40 -40
- package/applications/KnowledgeStudio/resourceSerializationUtils.d.ts +11 -11
- package/applications/MapViewer/layerUtils.d.ts +2 -2
- package/applications/MapViewer/mediaUtils.d.ts +13 -13
- package/applications/MapViewer/templateUtils.d.ts +20 -20
- package/applications/PortalApp/layerUtils.d.ts +2 -2
- package/applications/SceneViewer/colorUtils.d.ts +2 -2
- package/applications/SceneViewer/devEnvironmentUtils.d.ts +4 -3
- package/applications/SceneViewer/layerUtils.d.ts +3 -3
- package/applications/SceneViewer/sceneViewerUtils.d.ts +34 -34
- package/applications/SceneViewer/symbolUtils.d.ts +2 -2
- package/applications/Urban/LineImagePattern3D.d.ts +3 -2
- package/applications/Urban/imagePatternUtils.d.ts +4 -4
- package/applications/Urban/meshUtils.d.ts +2 -2
- package/applications/WebEditor/sketchUtils.d.ts +8 -8
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{df321c37b61099f6e4c2.js → 11058e660139c427c3e7.js} +1 -1
- package/assets/esri/core/workers/chunks/1dcd057695f8db79eca2.js +1 -0
- package/assets/esri/core/workers/chunks/568d32ceee1409809e5a.js +1 -0
- package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +1 -0
- package/assets/esri/core/workers/chunks/7b59ddad3c73f5f44b4d.js +1 -0
- package/assets/esri/core/workers/chunks/a4919dd9963f853a0077.js +1 -0
- package/assets/esri/core/workers/chunks/a7dbd38bc216713044fc.js +1 -0
- package/assets/esri/core/workers/chunks/{b8b2f160518e3a225d99.js → b364ec104dd59faa41b6.js} +1 -1
- package/assets/esri/core/workers/chunks/{0bb3beedae1b73beb1fc.js → b96dce64bdd7487e862a.js} +1 -1
- package/assets/esri/core/workers/chunks/{23c856265dd24ce54fdb.js → bfeab15d7ac9a2559fe5.js} +1 -1
- package/assets/esri/core/workers/chunks/c3e4f8664988e50bda55.js +1 -0
- package/assets/esri/core/workers/chunks/cf100c80b75ba74b479c.js +1 -0
- package/chunks/Clouds.glsl.js +1 -1
- package/config.js +1 -1
- package/geometry/support/curves/curveUtils.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/graphic/graphicOriginUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/support/Sublayer.d.ts +3 -0
- package/package.json +1 -1
- package/renderers/support/DictionaryControlString.js +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/animationUtils.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectDashes.js +1 -1
- package/symbols/cim/effects/EffectDonut.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/symbols/cim/effects/EffectWave.js +1 -1
- package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
- package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
- package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
- package/symbols/cim/placements/PlacementOnLine.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/symbols/cim/types.d.ts +220 -117
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/utils.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/FogTechnique.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/IndexBufferCache.js +2 -0
- package/views/3d/webgl-engine/materials/renderers/IndexLayout.js +2 -0
- package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/View.d.ts +13 -2
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeUtils.js +1 -1
- package/views/draw/support/types.d.ts +8 -1
- package/views/interactive/support/utils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/widgets/Attribution/AttributionViewModel.d.ts +3 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Attribution.d.ts +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +2 -22
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/Workflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.d.ts +10 -15
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +0 -15
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/types.d.ts +0 -1
- package/widgets/FeatureTable.d.ts +1 -19
- package/widgets/FeatureTable.js +1 -1
- package/widgets/HistogramRangeSlider.d.ts +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +4 -22
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/Sketch.d.ts +10 -17
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/0d56e3b3265a4470aaa6.js +0 -1
- package/assets/esri/core/workers/chunks/5a8b3e5977c233d5c9d0.js +0 -1
- package/assets/esri/core/workers/chunks/bbf2afa05314e267893f.js +0 -1
- package/assets/esri/core/workers/chunks/bd2f577cae61facdde4a.js +0 -1
- package/assets/esri/core/workers/chunks/bf2bfc0d78be8c185d58.js +0 -1
- package/assets/esri/core/workers/chunks/c6e0ada6f2ad74fddfec.js +0 -1
- package/assets/esri/core/workers/chunks/dcc8363faa22e6211351.js +0 -1
- package/assets/esri/core/workers/chunks/e081d6f21a2c01ccaf61.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as i}from"tslib";import{on as t}from"../../../core/events.js";import{rad2deg as o}from"../../../core/mathUtils.js";import{EsriPromise as e}from"../../../core/Promise.js";import{throwIfAborted as s,createResolver as r,onAbort as a}from"../../../core/promiseUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{whenVideoPlayable as l}from"../../../layers/support/videoUtils.js";import{fixedImageSize as m}from"../../OrientedImageryViewer/constants.js";import c from"./PanoramicMediaError.js";const d=0,p=0,u=0,z=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),w=new Set(["MRF","TIFF","TIF"]);let y=class extends e{constructor(i){super(i),this._size=[0,0],this._cache=null,this.autoLoad=!1,this.cameraHeading=null,this.extension=null,this.imagePyramid=null,this.type="image",this.uiStrings={}}destroy(){this._cache=null}get horizonPitch(){const{matrix:i}=this;return i?o(Math.asin(-i[6])):d}get horizonRoll(){const{matrix:i}=this;return i?o(Math.atan(i[7]/i[8])):u}get horizonYaw(){const{matrix:i,cameraHeading:t}=this;return i?o(Math.atan2(i[3],i[0])):t?-t:p}get size(){return this._size}async load(i){const{guessExtensionFromURI:t}=await import("../../OrientedImageryViewer/support/urlUtils.js");if(s(i),"video"===this.type)return this.loadVideoMesh(i);let o=this.extension;if(o||(o=t(this.url)),!o||!z.has(o))throw new c("unsupported-format",this.uiStrings["unsupported-format"]??"Unsupported image format: {extension}",{datasetFormat:o??"UNKNOWN FORMAT"});return w.has(o)?this.loadOptimizedImageMesh(i):this.loadImageMesh(i)}async loadOptimizedImageMesh(i){const{loadMeshes:t,loadPyramid:o,loadRaster:e}=await import("../utils.js"),r=await e(this.url,i);s(i),this.imagePyramid=await o(r,{pitch:this.horizonPitch,yaw:this.horizonYaw,roll:this.horizonRoll},i),s(i);const a=this.imagePyramid.getLowResolutionTiles(),h=await t(a,i);return s(i),this._size=this.imagePyramid.imageSize,{meshOrMeshes:h,size:this._size,tileKeys:a?.map(i=>i.key)}}async loadVideoMesh(i){const{createImageSphere:t}=await import("../utils.js");if(s(i),this._cache){const o=await t({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i);return s(i),{meshOrMeshes:o,size:this._size}}const o=await this._resolveMedia(i);s(i),this._cache=o.media,this._size=[...m];const e=await t({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i);return s(i),{meshOrMeshes:e,size:this._size}}async loadImageMesh(i){const{createImageSphere:t}=await import("../utils.js");if(s(i),this._cache){const o=await t({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i);return s(i),{meshOrMeshes:o,size:this._size}}const o=await this._resolveMedia(i);s(i),this._cache=o.media;const e=o.mesh;return this._size=[o.media.width,o.media.height],{meshOrMeshes:e,size:this._size}}async _resolveMedia(i){const o=r(),e=a(i?.signal,o.resolve),h="video"===this.type?document.createElement("video"):document.createElement("img");h.crossOrigin="anonymous",h.src=this.url;let n=null;const m="video"===this.type?l(h,this.addHandles):await new Promise((i,o)=>{n=[t(h,"error",i=>{o(i)}),t(h,"load",i)]}).finally(()=>{n?.forEach(i=>i.remove()),n=null}),d=Promise.race([m,o.promise]);this.addResolvingPromise(d);try{await d}finally{e?.remove()}s(i);const p=h;if(!p)throw new c("unknown","Could not load media",{url:this.url});const{createImageSphere:u}=await import("../utils.js");s(i);const z=await u({data:h,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i);return s(i),{media:p,mesh:z}}};i([h()],y.prototype,"_size",void 0),i([h()],y.prototype,"autoLoad",void 0),i([h()],y.prototype,"cameraHeading",void 0),i([h()],y.prototype,"extension",void 0),i([h()],y.prototype,"horizonPitch",null),i([h()],y.prototype,"horizonRoll",null),i([h()],y.prototype,"horizonYaw",null),i([h()],y.prototype,"id",void 0),i([h()],y.prototype,"imagePyramid",void 0),i([h()],y.prototype,"matrix",void 0),i([h()],y.prototype,"size",null),i([h()],y.prototype,"type",void 0),i([h()],y.prototype,"uiStrings",void 0),i([h()],y.prototype,"url",void 0),y=i([n("esri.widgets.PanoramicViewer.support.PanoramicMedia")],y);const g=y;export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Mesh.js";import s from"../../../geometry/SpatialReference.js";import
|
|
2
|
+
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Mesh.js";import s from"../../../geometry/SpatialReference.js";import o from"../../../geometry/support/MeshMaterial.js";import r from"../../../geometry/support/MeshTexture.js";import{defaultImageSphereCenter as a}from"../constants.js";import{loadMeshDependencies as c}from"./importUtils.js";class l{constructor(i,l,n,h,m,w,p,u,f,d){this.level=i,this.row=l,this.column=n,this.horizontalFieldOfView=h,this.verticalFieldOfView=m,this.yaw=w,this.pitch=p,this.distance=u,this.horizonAngles=f,this.getPixelBlock=d,this._cache=null,this.loadMesh=async i=>{const{level:l,row:n,column:h,horizontalFieldOfView:m,verticalFieldOfView:w,yaw:p,pitch:u,distance:f}=this,{Mesh:d,MeshComponent:g,MeshVertexAttributes:v,panoramicMeshManager:M}=await c(),{faces:x,...y}=await M.getFacesWithVertexAttributes({distance:f,yaw:p,horizontalFieldOfView:m,pitch:u,verticalFieldOfView:w});t(i);const V=await this.getPixelBlock(l,n,h,i);if(t(i),!V)throw new e("panoramic-viewer:missing-tile-data",`Tile data for level ${l}, row ${n}, column ${h} is missing`,{level:l,row:n,column:h});const A=await M.convertPixelBlockToImageData(V);t(i);const F=new d({vertexAttributes:new v(y),components:[new g({faces:x,trustSourceNormals:!0,material:new o({colorTexture:new r({data:A})})})],spatialReference:s.WebMercator});return F.rotate(...this.horizonAngles,{origin:a}),await F.load(i),this._cache=F,this._cache},this.loadMeshAtDistance=async(e,t)=>{const i=this.distance;return this.distance=e,Math.abs(i-e)>1e-6&&this._cache?this._cache:await this.loadMesh(t)}}get loaded(){return null!==this._cache}get key(){return`${this.level}/${this.row}/${this.column}`}clone(){const{level:e,row:t,column:s,horizontalFieldOfView:o,verticalFieldOfView:r,yaw:a,pitch:c,distance:n,getPixelBlock:h,horizonAngles:m}=this,w=new l(e,t,s,o,r,a,c,n,m,h);if(this._cache){const{vertexAttributes:e,components:t,spatialReference:s}=this._cache,o=t?.map(({material:e,faces:t,trustSourceNormals:i})=>({material:e,faces:t?.slice(),trustSourceNormals:i}));w._cache=new i({components:o,vertexAttributes:e.clone(),spatialReference:s})}return w}}export{l as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Error.js";import{property as r,subclass as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Error.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import s from"../../../geometry/Extent.js";import{RasterJobHandlerMixin as a}from"../../../layers/mixins/RasterJobHandlerMixin.js";import{pixelAngleThreshold as n,defaultImageSphereSize as l}from"../constants.js";import h from"./ClosestMap.js";import m from"./getVisibleTiles.js";import p from"./PanoramicTileNode.js";let c=class extends(a(t)){constructor(e){super(e),this._maximumPyramidLevel=-1,this._pixelAngleToLevelMap=new h,this._tileMap=new Map,this.horizonPitch=0,this.horizonYaw=0,this.horizonRoll=0,this.raster=null,this._fetchRawTile=async(e,t,i,r)=>{await this._initJobHandler();const{pyramidBlockWidth:o,pyramidBlockHeight:a}=this.storageInfo,{minCol:n,maxCol:l,minRow:h,maxRow:m}=this.storageInfo.blockBoundary[e],p=l-n+1,c=m-h+1,d=i*this.imageSize[0]/p,g=t*this.imageSize[1]/c,f=Math.min((i+1)*this.imageSize[0]/p,this.imageSize[0]),u=Math.min((t+1)*this.imageSize[1]/c,this.imageSize[1]),x=f-d,w=u-g,y=new s({xmin:d-.5,ymin:.5-u,xmax:f-.5,ymax:.5-g,spatialReference:this.raster.rasterInfo.spatialReference}),{pixelBlock:_}=await this.raster.fetchPixels(y,o??x,a??w,r);return _},this.getLevelTiles=e=>{const t=[],{minCol:i,maxCol:r,minRow:o,maxRow:s}=this.storageInfo.blockBoundary[e];for(let a=o;a<=s;a++)for(let o=i;o<=r;o++){const i=this._tileMap.get(`${e}/${a}/${o}`);i&&t.push(i)}return t.length?t:null},this.getLevelWithPixelAngle=e=>this._pixelAngleToLevelMap.get(e)??0,this.getLowResolutionTiles=()=>{const e=this.maximumPyramidLevel;return e<0?null:this.getLevelTiles(e)},this.getTiles=(e,t,i,r,o)=>{const{minCol:s,minRow:a,maxCol:n,maxRow:l}=this.storageInfo.blockBoundary[e];return m(e,[s,a],[n,l],this._tileMap,t,i,r,o)}}initialize(){this._processLevels()}destroy(){this.raster.rasterJobHandler=null,this.raster=null,this._shutdownJobHandler(),this._tileMap.clear(),this._pixelAngleToLevelMap.clear()}async _initJobHandler(){this._rasterJobHandler||(await super._initJobHandler(),this.raster.rasterJobHandler=this._rasterJobHandler)}_processLevels(){const{blockBoundary:e,tileInfo:t}=this.storageInfo,r=e?.length;if(!r)throw new i("panoramic-viewer:missing-pyramid-resolutions","TIFF/MRF must have pyramid resolutions defined",{rasterId:this.raster.rasterId});this._tileMap.clear();for(let i=0;i<r;i++){const{maxCol:r,maxRow:o,minCol:s,minRow:a}=e[i],h=180/(o-a+1),m=360/(r-s+1),c=m/t.size[0];if(c>n)break;this._pixelAngleToLevelMap.set(c,i);for(let e=a;e<=o;e++){const t=180-(e+.5)*h;for(let o=s;o<=r;o++){const r=(o+.5)*m-180;this._tileMap.set(`${i}/${e}/${o}`,new p(i,e,o,m,h,r,t,l/2,[this.horizonPitch,this.horizonRoll,this.horizonYaw],this._fetchRawTile))}}this._maximumPyramidLevel=i}}get rasterInfo(){return this.raster.rasterInfo}get storageInfo(){return this.rasterInfo.storageInfo}get imageSize(){const{width:e,height:t}=this.rasterInfo;return[e,t]}get maximumPyramidLevel(){return this._maximumPyramidLevel}};e([r()],c.prototype,"horizonPitch",void 0),e([r()],c.prototype,"horizonYaw",void 0),e([r()],c.prototype,"horizonRoll",void 0),e([r()],c.prototype,"raster",void 0),c=e([o("esri.widgets.PanoramicViewer.support.PanoramicTilePyramid")],c);const d=c;export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../Graphic.js";import r from"../../request.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{rad2deg as n,deg2rad as
|
|
2
|
+
import t from"../../Graphic.js";import r from"../../request.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{rad2deg as n,deg2rad as i}from"../../core/mathUtils.js";import{throwIfAborted as s}from"../../core/promiseUtils.js";import a from"../../geometry/Mesh.js";import m from"../../geometry/support/MeshMaterial.js";import c from"../../geometry/support/MeshTexture.js";import l from"../../symbols/FillSymbol3DLayer.js";import u from"../../symbols/MeshSymbol3D.js";import{defaultImageSphereCenter as p,defaultImageSphereSize as f}from"./constants.js";import{loadRasterFactory as h,loadPanoramicTilePyramid as w}from"./support/importUtils.js";function y({data:t,center:r=p,size:e=f,horizonPitch:o=0,horizonYaw:n=0,horizonRoll:i=0}){const s=r.clone();s.z=-e/2;const l=a.createSphere(s,{size:e,densificationFactor:2,vertexSpace:"georeferenced",material:new m({colorTexture:new c({data:t})})});if(l.components[0].trustSourceNormals=!0,l.vertexAttributes.uv){const t=l.vertexAttributes.uv.length??0;for(let r=0;r<t;r++)l.vertexAttributes.uv[2*r+0]=1-l.vertexAttributes.uv[2*r+0]}return l.rotate(o,i,n,{origin:l.extent.center}),l.centerAt(s),l}function j(r){return new t({geometry:r,symbol:new u({symbolLayers:new e([new l])})})}function d(t,r){return 2*n(Math.atan(Math.tan(i(t/2))*Math.sqrt((1/r)**2+1)))}async function g(t,r){const e=await h(),o=await e.open({url:t,ioConfig:{skipExtensions:["jgw","aux.xml"],skipMapInfo:!0},...r});return s(r),x(o,{url:t})}const x=(t,r)=>{if(!t)throw new o("panoramic-viewer:missing-raster","Raster data could not be loaded",r);return t};async function b(t,r,e){const o=await w();return s(e),new o({raster:t,horizonPitch:r.pitch,horizonYaw:r.yaw,horizonRoll:r.roll})}async function v(t,r){return t?.length?await Promise.all(t.map(t=>t.loadMesh(r))):[]}async function M(t,e){try{const o=await r(t,{...e,method:"head"});return s(e),o?.getHeader?.("Content-Type")}catch{return null}}export{y as createImageSphere,d as findDiagonalFOV,M as getContentType,v as loadMeshes,b as loadPyramid,g as loadRaster,j as meshToGraphic};
|
|
@@ -30,7 +30,7 @@ import type { SimpleLineSymbolProperties } from "../../symbols/SimpleLineSymbol.
|
|
|
30
30
|
import type { SketchTooltipOptionsProperties } from "../../views/interactive/sketch/SketchTooltipOptions.js";
|
|
31
31
|
import type { SketchValueOptionsProperties } from "../../views/interactive/sketch/SketchValueOptions.js";
|
|
32
32
|
|
|
33
|
-
export interface SketchViewModelProperties extends Partial<Pick<SketchViewModel, "creationMode" | "layer" | "updateOnGraphicClick" | "view">> {
|
|
33
|
+
export interface SketchViewModelProperties extends Partial<Pick<SketchViewModel, "creationMode" | "layer" | "updateOnGraphicClick" | "useLegacyCreateTools" | "view">> {
|
|
34
34
|
/**
|
|
35
35
|
* The [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleFillSymbol/) displayed when actively creating a new `polygon` graphic using the [polygon](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#activeTool) tool.
|
|
36
36
|
*
|
|
@@ -170,25 +170,6 @@ export interface SketchViewModelProperties extends Partial<Pick<SketchViewModel,
|
|
|
170
170
|
* @since 4.24
|
|
171
171
|
*/
|
|
172
172
|
tooltipOptions?: SketchTooltipOptionsProperties;
|
|
173
|
-
/**
|
|
174
|
-
* Starting at version 5.0, Editor is transitioning to a next generation geometry
|
|
175
|
-
* creation experience. This new experience provides advanced curve creation tools
|
|
176
|
-
* and allows multiple tools to be used in combination to define a single geometry.
|
|
177
|
-
*
|
|
178
|
-
* As of 5.0, this experience is only available in 2D (e.g., [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/), [`arcgis-map`](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map)).
|
|
179
|
-
*
|
|
180
|
-
* This property is available to allow 2D applications to temporarily
|
|
181
|
-
* opt out of this experience.
|
|
182
|
-
*
|
|
183
|
-
* > [!CAUTION]
|
|
184
|
-
* >
|
|
185
|
-
* > This option will be removed in an upcoming release.
|
|
186
|
-
*
|
|
187
|
-
* @deprecated
|
|
188
|
-
* @default true
|
|
189
|
-
* @since 5.0
|
|
190
|
-
*/
|
|
191
|
-
useLegacyCreateTools?: boolean;
|
|
192
173
|
/**
|
|
193
174
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
194
175
|
*
|
|
@@ -794,7 +775,8 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
794
775
|
*/
|
|
795
776
|
accessor updateOnGraphicClick: boolean;
|
|
796
777
|
/**
|
|
797
|
-
* Starting at version 5.0,
|
|
778
|
+
* Starting at version 5.0, `arcgis-sketch` and [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/)
|
|
779
|
+
* are transitioning to a next generation geometry
|
|
798
780
|
* creation experience. This new experience provides advanced curve creation tools
|
|
799
781
|
* and allows multiple tools to be used in combination to define a single geometry.
|
|
800
782
|
*
|
|
@@ -811,7 +793,7 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
811
793
|
* @default true
|
|
812
794
|
* @since 5.0
|
|
813
795
|
*/
|
|
814
|
-
|
|
796
|
+
accessor useLegacyCreateTools: boolean;
|
|
815
797
|
/**
|
|
816
798
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
817
799
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import{drainHandles as s,destroyHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import p from"../../core/Logger.js";import{destroyMaybe as l,abortMaybe as h}from"../../core/maybe.js";import{createAbortError as c,whenOrAbort as d,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{watch as g,syncAndInitial as y,on as m,when as v,whenOnce as f}from"../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as G}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as T,isLoaded as O,load as S,project as E}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as M}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as k}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as H}from"../../support/elevationInfoUtils.js";import D from"../../symbols/FillSymbol3DLayer.js";import I from"../../symbols/MeshSymbol3D.js";import P from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import R from"../../symbols/SimpleMarkerSymbol.js";import U from"../../symbols/TextSymbol.js";import{symbolTypes as x}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as L}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as F}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as V}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as K}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as W}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Z}from"../../views/input/InputManager.js";import{sketchKeys as q}from"../../views/interactive/keybindings.js";import N from"../../views/interactive/sketch/SketchLabelOptions.js";import z from"../../views/interactive/sketch/SketchOptions.js";import B from"../../views/interactive/sketch/SketchTooltipOptions.js";import $ from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as Y}from"../../views/interactive/snapping/SnappingManager.js";import J from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as Q}from"../../views/interactive/snapping/snappingUtils.js";import{defaultHighlightName as X}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ee}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as te}from"../../views/support/screenUtils.js";import oe from"./adapters/layer/GraphicsLayerAdapter.js";import ie from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,DrawToolOperationHandle as re,UpdateOperationHandle as se}from"./support/OperationHandle.js";import{getLegacyTool as ne,graphicsHaveTooFewVerticesForBox as pe,getModeFromCreateOptions as le,getDrawToolGeometryTypeFromCreateTool as he}from"./support/sketchUtils.js";const ce={defaultZ:0},de={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:X},tool:"transform"},ue=Symbol(),ge=Symbol();let ye=class extends r{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._updatingHandles=new w,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new R({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new P({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new I({symbolLayers:new i([new D])}),this.updateGraphics=new i,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new R({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new z,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ge),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),g(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},y)].filter(o);this.addHandles(t,ge)},this._originalPopupEnabled=null,this.defaultCreateOptions=ce,this.defaultUpdateOptions=de,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new J,this.textSymbol=new U({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),g(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),y),g(()=>this.view,e=>{this._defaultSnappingManager=l(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new Y({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},y),g(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),Q(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=l(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._pluginManager=l(this.pluginManager),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new oe(e);case"map-notes":return new ie(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(o).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ce,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...de,...e,reshapeOptions:{...de.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...de.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=l(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new Y({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(v(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},y),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(o)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),c();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");W(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=ne(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(u(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(u(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),c();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Se(s)||(W(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||M(o.geometry.spatialReference,t.spatialReference)||(T(o.geometry.spatialReference,t.spatialReference)||O()||await S(),o.geometry=E(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ee(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{k(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?G(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Z.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(te(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t};await this._setupAdvancedDrawToolIntegrationMaybe();const a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=ne(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=le(p,e),c=he(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,g={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(g):this._makeDrawGraphicTool3D(g)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Se(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:fe(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Se(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,n=[o.on("key-down",t=>{if(t.key===q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==q.vertexAdd||t.repeat)t.key===q.undo?(t.stopPropagation(),p.undo()):t.key===q.redo?(t.stopPropagation(),p.redo()):t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===q.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Z.WIDGET),o.on("key-up",t=>{t.key===q.pan?e.enabled=!0:t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===q.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Z.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),g(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{s(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_setupDrawToolOperationHandle(e,t){const i=this.view;if(!i)return this._logMissingView(),null;let a=null;const r=[i.on("key-down",t=>{t.key===q.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},Z.WIDGET),i.on("key-up",t=>{t.key===q.pan&&(e.editable=!0)},Z.WIDGET),e.on("before-vertex-add",t=>{const o=e.mostUpstreamPlugin?.configuration;if(o&&"legacyCreateTool"in o&&("point"===o?.legacyCreateTool||"text"===o.legacyCreateTool)){const e=t.detail.originalEvent;return void(e&&"key"in e&&e.key===q.vertexAdd&&t.preventDefault())}}),e.on("before-complete",t=>{const o=e.editGeometry,i=o?.allVertices.length??0;(i<1||"polyline"===o?.type&&i<2||"polygon"===o?.type&&i<2)&&t.preventDefault()}),e.on("vertex-add",i=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),a=null==a?"start":"active",i.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:a,tool:this.activeTool,toolEventInfo:i,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(o),tool:t});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(o),tool:t})}}),e.on("cursor-update",t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",i=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),i.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:i,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(o),tool:t});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(o),tool:t})}}),e.on("complete",({geometry:e})=>{const t=this.createGraphic;t&&e&&(t.geometry=e),n.complete()})],n=new re({activeComponent:e,type:"create",onEnd:()=>{s(r),i.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return r.push(e.on("cancel",()=>n.cancel())),n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let a=i.tool??de.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return pe(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Se(r))return r;const{ManipulatedObject3DGraphic:n,MoveTool3D:p}=r.module,l=new Map,h=()=>{l.forEach(e=>e.destroy()),l.clear()};for(const s of e){const e=new n({view:o,graphic:s}),t=F(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${L(t)}).`),null;l.set(s,e)}const c=new p({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),c.objects.addMany(Array.from(l.values())),a||this.updateGraphics.addMany(e);const d=[],u=new se({activeComponent:c,tool:i,type:"update",onEnd:()=>{s(d),Oe(o,c),h()},undo:()=>{Ge(this.view,c),_e(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{be(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new n({view:o,graphic:e});l.set(e,t),c.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=l.get(e);o&&(c.objects.remove(o),o.destroy(),l.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Se(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Z.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===K(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Se(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:a,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],g=new se({activeComponent:d,tool:i,type:"update",onEnd:()=>{s(u),Oe(o,d),c.destroy()},undo:()=>{Ge(this.view,d),_e(g,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{be(g,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Se(h))return h;const{ManipulatedObject3DGraphic:c,ExtentTransformTool:d}=h.module,u=this.view?.inputManager?.isModifierKeyDown(q.constraint),g=new c({view:o,graphic:e}),y=new d({object:g,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!u,sketchOptions:this.sketchOptions});o.tools.add(y),i||this.updateGraphics.add(e);const m=[],v=new se({activeComponent:y,tool:a,type:"update",onEnd:()=>{s(m),Oe(o,y),g.destroy()},canUndo:()=>!y.destroyed&&y.canUndo,undo:()=>{y.destroyed||(y.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!y.destroyed&&y.canRedo,redo:()=>{y.destroyed||(y.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Se(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return m.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Z.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Z.WIDGET),o.on("key-down",e=>{e.key!==q.constraint||e.repeat||(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Z.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Se(a))return a;const r=new se({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),s(l),s(p),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();_e(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();be(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==q.constraint||e.repeat||(n=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&n&&(n=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Se(r))return r;const{ManipulatedObject3DGraphic:n,ReshapeTool3D:p}=r.module,l=new n({view:o,graphic:e}),h=V(l);if(0!==h)return l.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${L(h)}).`),null;const c=t.reshapeOptions,d=new p({view:o,object:l,enableZVertex:t.enableZ&&"move"===c?.vertexOperation,enableZShape:t.enableZ&&"move"===c?.shapeOperation,enableMoveObject:"move"===c?.shapeOperation||"move-xy"===c?.shapeOperation,enableMidpoints:"split"===c?.edgeOperation,enableEdgeOffset:"offset"===c?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(l.graphic);const u=[],g=new se({activeComponent:d,tool:a,type:"update",onEnd:()=>{s(u),Oe(o,d),l.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Se(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Se(a))return a;const r=new se({activeComponent:a,type:"update",onEnd:()=>{s(p),s(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{_e(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{be(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Se(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():pe(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],o,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],o,i))),Se(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(s(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Z.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===q.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET),i.on("key-up",e=>{if(e.key===q.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Se(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Se(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(q.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Se(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Te(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Te(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Te(t.graphics))),o.on("scale-start",t=>e.addToHistory(Te(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Te([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Te([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Te([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Te([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=te(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=l(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(ue)}_displayCursor(e){this.removeHandles(ue),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),ue)}_logError(e,t,o){p.getLogger(this).error(new a(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){if(this.isUsingLegacyCreateTools||this.pluginManager)return;const{PluginManager:e}=await import("./support/PluginManager.js");this.isUsingLegacyCreateTools||(this._pluginManager=new e({sketchViewModel:this}))}async _setupDrawTool(e,o,i){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js"),s=await(this.pluginManager?.makeRenderer({useTextSymbol:"text"===i})),p=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??H("3d"===a.type),hasZ:!!o.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:o.defaultZ??0,directionOptions:o.directionOptions,snappingManager:this.snappingManager});p.addHandles(n(s));const l=new t({...o.graphicProperties,attributes:{...o.graphicProperties?.attributes},symbol:this._getGraphicSymbolFromTool(i)});return this._set("createGraphic",l),a.addAndActivateTool(p),p.begin(e),p}get test(){}wait(){return f(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await d(f(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",ve("view"))}_logMissingLayer(){this._logError(me,ve("layer"))}};e([_()],ye.prototype,"_defaultSnappingManager",void 0),e([_()],ye.prototype,"_layerAdapter",null),e([_()],ye.prototype,"_pluginManager",void 0),e([_()],ye.prototype,"_operationHandle",void 0),e([_({readOnly:!0})],ye.prototype,"_updatingHandles",void 0),e([_({readOnly:!0})],ye.prototype,"activeTool",null),e([_({readOnly:!0})],ye.prototype,"activeCreateToolDrawMode",null),e([_()],ye.prototype,"activeTooltip",null),e([_({types:x})],ye.prototype,"activeFillSymbol",void 0),e([_()],ye.prototype,"activeLineSymbol",void 0),e([_()],ye.prototype,"activeVertexSymbol",void 0),e([_()],ye.prototype,"allowDeleteKey",void 0),e([_({readOnly:!0})],ye.prototype,"createGraphic",null),e([_()],ye.prototype,"defaultCreateOptions",null),e([_()],ye.prototype,"defaultUpdateOptions",null),e([_({type:N,nonNullable:!0})],ye.prototype,"labelOptions",null),e([_()],ye.prototype,"layer",void 0),e([_({types:x})],ye.prototype,"pointSymbol",void 0),e([_({types:x})],ye.prototype,"polygonSymbol",void 0),e([_({types:x})],ye.prototype,"polylineSymbol",void 0),e([_()],ye.prototype,"meshSymbol",void 0),e([_({type:U})],ye.prototype,"textSymbol",null),e([_({type:J,nonNullable:!0})],ye.prototype,"snappingOptions",null),e([_()],ye.prototype,"snappingManager",null),e([_({readOnly:!0})],ye.prototype,"state",null),e([_({type:B,nonNullable:!0})],ye.prototype,"tooltipOptions",null),e([_({readOnly:!0})],ye.prototype,"updateGraphics",void 0),e([_()],ye.prototype,"updateOnGraphicClick",void 0),e([_()],ye.prototype,"updating",null),e([_()],ye.prototype,"creationMode",void 0),e([_({type:$,nonNullable:!0})],ye.prototype,"valueOptions",null),e([_({types:x})],ye.prototype,"vertexSymbol",void 0),e([_({value:null})],ye.prototype,"view",null),e([_({constructOnly:!0,type:z})],ye.prototype,"sketchOptions",void 0),e([_({constructOnly:!0})],ye.prototype,"useLegacyCreateTools",void 0),e([_()],ye.prototype,"isUsingLegacyCreateTools",null),e([_()],ye.prototype,"pluginManager",null),e([_()],ye.prototype,"drawTool",null),e([_()],ye.prototype,"rootPlugins",null),e([_()],ye.prototype,"effectiveAvailablePlugins",null),e([_()],ye.prototype,"firstPluginWithSwappableLeaf",null),e([_()],ye.prototype,"multiplePluginsActive",null),ye=e([b("esri.widgets.Sketch.SketchViewModel")],ye);const me="sketch:missing-property",ve=e=>`Property '${e}' is missing on SketchViewModel.`;function fe(e){return"polygon"===e||"rectangle"===e||"circle"===e}function _e(e,t){we("undo",e.history.undo,e.history.redo,t)}function be(e,t){we("redo",e.history.redo,e.history.undo,t)}function we(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function Ge(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Te(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Oe(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Se(e){return"requireError"in e&&"aborted"===e.requireError}export{ye as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import{drainHandles as s,destroyHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import p from"../../core/Logger.js";import{destroyMaybe as l,abortMaybe as h}from"../../core/maybe.js";import{createAbortError as c,whenOrAbort as d,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{watch as g,syncAndInitial as y,on as m,when as v,whenOnce as f}from"../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as G}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as T,isLoaded as O,load as S,project as E}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as M}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as k}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as H}from"../../support/elevationInfoUtils.js";import D from"../../symbols/FillSymbol3DLayer.js";import I from"../../symbols/MeshSymbol3D.js";import P from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import R from"../../symbols/SimpleMarkerSymbol.js";import U from"../../symbols/TextSymbol.js";import{symbolTypes as x}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as L}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as F}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as V}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as K}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as W}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Z}from"../../views/input/InputManager.js";import{sketchKeys as q}from"../../views/interactive/keybindings.js";import N from"../../views/interactive/sketch/SketchLabelOptions.js";import z from"../../views/interactive/sketch/SketchOptions.js";import B from"../../views/interactive/sketch/SketchTooltipOptions.js";import $ from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as Y}from"../../views/interactive/snapping/SnappingManager.js";import J from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as Q}from"../../views/interactive/snapping/snappingUtils.js";import{defaultHighlightName as X}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ee}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as te}from"../../views/support/screenUtils.js";import oe from"./adapters/layer/GraphicsLayerAdapter.js";import ie from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,DrawToolOperationHandle as re,UpdateOperationHandle as se}from"./support/OperationHandle.js";import{PluginManager as ne}from"./support/PluginManager.js";import{getLegacyTool as pe,graphicsHaveTooFewVerticesForBox as le,getModeFromCreateOptions as he,getDrawToolGeometryTypeFromCreateTool as ce}from"./support/sketchUtils.js";const de={defaultZ:0},ue={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:X},tool:"transform"},ge=Symbol(),ye=Symbol();let me=class extends r{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ne,this._operationHandle=null,this._updatingHandles=new w,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new R({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new P({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new I({symbolLayers:new i([new D])}),this.updateGraphics=new i,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new R({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new z,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ye),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),g(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},y)].filter(o);this.addHandles(t,ye)},this._originalPopupEnabled=null,this.defaultCreateOptions=de,this.defaultUpdateOptions=ue,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new J,this.textSymbol=new U({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),g(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),y),g(()=>this.view,e=>{this._defaultSnappingManager=l(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new Y({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},y),g(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),Q(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=l(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new oe(e);case"map-notes":return new ie(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(o).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...de,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ue,...e,reshapeOptions:{...ue.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ue.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=l(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new Y({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(v(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},y),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(o)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),c();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");W(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=pe(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(u(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(u(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),c();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Ee(s)||(W(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||M(o.geometry.spatialReference,t.spatialReference)||(T(o.geometry.spatialReference,t.spatialReference)||O()||await S(),o.geometry=E(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ee(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{k(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?G(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Z.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(te(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=pe(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=he(p,e),c=ce(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,g={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(g):this._makeDrawGraphicTool3D(g)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Ee(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:_e(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Ee(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,n=[o.on("key-down",t=>{if(t.key===q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==q.vertexAdd||t.repeat)t.key===q.undo?(t.stopPropagation(),p.undo()):t.key===q.redo?(t.stopPropagation(),p.redo()):t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===q.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Z.WIDGET),o.on("key-up",t=>{t.key===q.pan?e.enabled=!0:t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===q.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Z.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),g(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{s(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_setupDrawToolOperationHandle(e,t){const i=this.view;if(!i)return this._logMissingView(),null;let a=null;const r=[i.on("key-down",t=>{t.key===q.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},Z.WIDGET),i.on("key-up",t=>{t.key===q.pan&&(e.editable=!0)},Z.WIDGET),e.on("before-vertex-add",t=>{const o=e.mostUpstreamPlugin?.configuration;if(o&&"legacyCreateTool"in o&&("point"===o?.legacyCreateTool||"text"===o.legacyCreateTool)){const e=t.detail.originalEvent;return void(e&&"key"in e&&e.key===q.vertexAdd&&t.preventDefault())}}),e.on("before-complete",t=>{const o=e.editGeometry,i=o?.allVertices.length??0;(i<1||"polyline"===o?.type&&i<2||"polygon"===o?.type&&i<2)&&t.preventDefault()}),e.on("vertex-add",i=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),a=null==a?"start":"active",i.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:a,tool:this.activeTool,toolEventInfo:i,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(o),tool:t});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(o),tool:t})}}),e.on("cursor-update",t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",i=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),i.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:i,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(o),tool:t});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(o),tool:t})}}),e.on("complete",({geometry:e})=>{const t=this.createGraphic;t&&e&&(t.geometry=e),n.complete()})],n=new re({activeComponent:e,type:"create",onEnd:()=>{s(r),i.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return r.push(e.on("cancel",()=>n.cancel())),n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let a=i.tool??ue.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return le(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ee(r))return r;const{ManipulatedObject3DGraphic:n,MoveTool3D:p}=r.module,l=new Map,h=()=>{l.forEach(e=>e.destroy()),l.clear()};for(const s of e){const e=new n({view:o,graphic:s}),t=F(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${L(t)}).`),null;l.set(s,e)}const c=new p({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),c.objects.addMany(Array.from(l.values())),a||this.updateGraphics.addMany(e);const d=[],u=new se({activeComponent:c,tool:i,type:"update",onEnd:()=>{s(d),Se(o,c),h()},undo:()=>{Te(this.view,c),be(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{we(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new n({view:o,graphic:e});l.set(e,t),c.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=l.get(e);o&&(c.objects.remove(o),o.destroy(),l.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Ee(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Z.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===K(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ee(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:a,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],g=new se({activeComponent:d,tool:i,type:"update",onEnd:()=>{s(u),Se(o,d),c.destroy()},undo:()=>{Te(this.view,d),be(g,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{we(g,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ee(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ee(h))return h;const{ManipulatedObject3DGraphic:c,ExtentTransformTool:d}=h.module,u=this.view?.inputManager?.isModifierKeyDown(q.constraint),g=new c({view:o,graphic:e}),y=new d({object:g,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!u,sketchOptions:this.sketchOptions});o.tools.add(y),i||this.updateGraphics.add(e);const m=[],v=new se({activeComponent:y,tool:a,type:"update",onEnd:()=>{s(m),Se(o,y),g.destroy()},canUndo:()=>!y.destroyed&&y.canUndo,undo:()=>{y.destroyed||(y.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!y.destroyed&&y.canRedo,redo:()=>{y.destroyed||(y.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ee(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Ee(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return m.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Z.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Z.WIDGET),o.on("key-down",e=>{e.key!==q.constraint||e.repeat||(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Z.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Ee(a))return a;const r=new se({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),s(l),s(p),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();be(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();we(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==q.constraint||e.repeat||(n=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&n&&(n=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ee(r))return r;const{ManipulatedObject3DGraphic:n,ReshapeTool3D:p}=r.module,l=new n({view:o,graphic:e}),h=V(l);if(0!==h)return l.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${L(h)}).`),null;const c=t.reshapeOptions,d=new p({view:o,object:l,enableZVertex:t.enableZ&&"move"===c?.vertexOperation,enableZShape:t.enableZ&&"move"===c?.shapeOperation,enableMoveObject:"move"===c?.shapeOperation||"move-xy"===c?.shapeOperation,enableMidpoints:"split"===c?.edgeOperation,enableEdgeOffset:"offset"===c?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(l.graphic);const u=[],g=new se({activeComponent:d,tool:a,type:"update",onEnd:()=>{s(u),Se(o,d),l.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ee(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Ee(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Ee(a))return a;const r=new se({activeComponent:a,type:"update",onEnd:()=>{s(p),s(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{be(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{we(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Ee(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():le(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],o,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],o,i))),Ee(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(s(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Z.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===q.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET),i.on("key-up",e=>{if(e.key===q.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ee(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Ee(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(q.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Ee(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Oe(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Oe(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Oe(t.graphics))),o.on("scale-start",t=>e.addToHistory(Oe(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Oe([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Oe([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Oe([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Oe([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=te(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=l(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(ge)}_displayCursor(e){this.removeHandles(ge),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),ge)}_logError(e,t,o){p.getLogger(this).error(new a(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,o,i){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({useTextSymbol:"text"===i}),p=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??H("3d"===a.type),hasZ:!!o.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:o.defaultZ??0,directionOptions:o.directionOptions,snappingManager:this.snappingManager});p.addHandles(n(s));const l=new t({...o.graphicProperties,attributes:{...o.graphicProperties?.attributes},symbol:this._getGraphicSymbolFromTool(i)});return this._set("createGraphic",l),a.addAndActivateTool(p),p.begin(e),p}get test(){}wait(){return f(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await d(f(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",fe("view"))}_logMissingLayer(){this._logError(ve,fe("layer"))}};e([_()],me.prototype,"_defaultSnappingManager",void 0),e([_()],me.prototype,"_layerAdapter",null),e([_()],me.prototype,"_pluginManager",void 0),e([_()],me.prototype,"_operationHandle",void 0),e([_({readOnly:!0})],me.prototype,"_updatingHandles",void 0),e([_({readOnly:!0})],me.prototype,"activeTool",null),e([_({readOnly:!0})],me.prototype,"activeCreateToolDrawMode",null),e([_()],me.prototype,"activeTooltip",null),e([_({types:x})],me.prototype,"activeFillSymbol",void 0),e([_()],me.prototype,"activeLineSymbol",void 0),e([_()],me.prototype,"activeVertexSymbol",void 0),e([_()],me.prototype,"allowDeleteKey",void 0),e([_({readOnly:!0})],me.prototype,"createGraphic",null),e([_()],me.prototype,"defaultCreateOptions",null),e([_()],me.prototype,"defaultUpdateOptions",null),e([_({type:N,nonNullable:!0})],me.prototype,"labelOptions",null),e([_()],me.prototype,"layer",void 0),e([_({types:x})],me.prototype,"pointSymbol",void 0),e([_({types:x})],me.prototype,"polygonSymbol",void 0),e([_({types:x})],me.prototype,"polylineSymbol",void 0),e([_()],me.prototype,"meshSymbol",void 0),e([_({type:U})],me.prototype,"textSymbol",null),e([_({type:J,nonNullable:!0})],me.prototype,"snappingOptions",null),e([_()],me.prototype,"snappingManager",null),e([_({readOnly:!0})],me.prototype,"state",null),e([_({type:B,nonNullable:!0})],me.prototype,"tooltipOptions",null),e([_({readOnly:!0})],me.prototype,"updateGraphics",void 0),e([_()],me.prototype,"updateOnGraphicClick",void 0),e([_()],me.prototype,"updating",null),e([_()],me.prototype,"creationMode",void 0),e([_({type:$,nonNullable:!0})],me.prototype,"valueOptions",null),e([_({types:x})],me.prototype,"vertexSymbol",void 0),e([_({value:null})],me.prototype,"view",null),e([_({constructOnly:!0,type:z})],me.prototype,"sketchOptions",void 0),e([_()],me.prototype,"useLegacyCreateTools",void 0),e([_()],me.prototype,"isUsingLegacyCreateTools",null),e([_()],me.prototype,"pluginManager",null),e([_()],me.prototype,"drawTool",null),e([_()],me.prototype,"rootPlugins",null),e([_()],me.prototype,"effectiveAvailablePlugins",null),e([_()],me.prototype,"firstPluginWithSwappableLeaf",null),e([_()],me.prototype,"multiplePluginsActive",null),me=e([b("esri.widgets.Sketch.SketchViewModel")],me);const ve="sketch:missing-property",fe=e=>`Property '${e}' is missing on SketchViewModel.`;function _e(e){return"polygon"===e||"rectangle"===e||"circle"===e}function be(e,t){Ge("undo",e.history.undo,e.history.redo,t)}function we(e,t){Ge("redo",e.history.redo,e.history.undo,t)}function Ge(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function Te(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Oe(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Se(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ee(e){return"requireError"in e&&"aborted"===e.requireError}export{me as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{handlesGroup as o}from"../../../core/handleUtils.js";import l from"../../../core/Logger.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{BezierSegmentPlugin as u}from"../../../views/draw/plugins/BezierSegmentPlugin.js";import{CircularArcSegmentPlugin as c}from"../../../views/draw/plugins/CircularArcSegmentPlugin.js";import{FreehandSegmentPlugin as g}from"../../../views/draw/plugins/FreehandSegmentPlugin.js";import{MultipointPlugin as p}from"../../../views/draw/plugins/MultipointPlugin.js";import{PointPlugin as y}from"../../../views/draw/plugins/PointPlugin.js";import{PolygonPlugin as m}from"../../../views/draw/plugins/PolygonPlugin.js";import{PolylinePlugin as d}from"../../../views/draw/plugins/PolylinePlugin.js";import{ShapePlugin as P}from"../../../views/draw/plugins/ShapePlugin.js";let h=class extends t{constructor(e){super(e),this.sketch=null}get _simplePointPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-leaf-point"),localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>new y,[Symbol.toStringTag]:"Point"}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create(){const e=new y;return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-text-point"),localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>new y,[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0};return{uniqueId:Symbol.for("esri-builtin-plugin-multipoint"),localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>new p,availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-freehand"),localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create(){const e=new g;return e.completeOnDragEnd=!0,e},[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-bezier-segment"),localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",icon:"bezier-curve",excludedViews:["3d"],create:()=>new u,[Symbol.toStringTag]:"Bezier"}}get _endpointArcPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>new c({arcDrawingMode:"end-first"}),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",icon:"arc-segment",excludedViews:["3d"],create:()=>new c({arcDrawingMode:"interior-first"}),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,o=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline;return{uniqueId:Symbol.for("esri-builtin-plugin-simple-polyline"),localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:o?"line":"freehand",create:()=>new d,availableDownstreamPlugins:o?[this._simplePointPlugin,t?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(i):[t?this._freehandPlugin:null].filter(i),defaultDownstreamPlugin:o?this._simplePointPlugin:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,o=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon;return{uniqueId:Symbol.for("esri-builtin-plugin-simple-polygon"),localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:o?"polygon":"freehand-area",create:()=>new m,availableDownstreamPlugins:o?[this._simplePointPlugin,t?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(i):[t?this._freehandPlugin:null].filter(i),defaultDownstreamPlugin:o?this._simplePointPlugin:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-simple-rectangle"),localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>new P,[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){return{uniqueId:Symbol.for("esri-builtin-plugin-simple-ellipse"),localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create(){const e=new P;return e.shapeType="circle",e.defaultUniform=!0,e.defaultCentered=!0,e},[Symbol.toStringTag]:"Circle"}}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return t||i?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return t||i?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(i),t=this.sketch?.availableCreateTools;if(!t)return e;const o=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const i=t.indexOf(e.legacyCreateTool);return-1===i?Number.MAX_SAFE_INTEGER:i};return e.map((e,t)=>({plugin:e,index:t,order:o(e)})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({plugin:e})=>e)}getPluginsEquivalentToCreateTool(e,t){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":return"freehand"===t?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":return"freehand"===t?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const t=e.at(-1);if(t===this._freehandPlugin)return"freehand";return t===this._rectanglePlugin||t===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const t=this.sketchViewModel;if(!t?.view)return null;const{abortOptions:i,useTextSymbol:o}=e;return"2d"===t.view.type?await this._makeDrawToolRenderer2D({view:t.view,svm:t,useTextSymbol:o,abortOptions:i}):await this._makeDrawToolRenderer3D({view:t.view,svm:t,useTextSymbol:o,abortOptions:i})}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:t}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:i,svm:o,useTextSymbol:l,abortOptions:r}=e;n(r);const s=l?o.textSymbol??o.pointSymbol:o.pointSymbol,a=new t({symbolOverrides:{polyline:{outputGeometry:{default:o.polylineSymbol},outline:{active:o.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:o.activeFillSymbol??o.polygonSymbol}},point:{outputGeometry:{default:s},vertex:{default:o.vertexSymbol,active:o.activeVertexSymbol??void 0}}},view:i}),u=this._setupSymbolWatcher(a,o,l);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:t,svm:i,useTextSymbol:o,abortOptions:n}=e;return l.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:t,svm:i,useTextSymbol:o,abortOptions:n})}_setupSymbolWatcher(e,t,i){const l=(t,i,o)=>(l,n)=>{l!==n&&e.overrideSymbol({symbol:l,geometryType:t,role:i,state:o})};return o([r(()=>t.polylineSymbol,l("polyline","outputGeometry")),r(()=>t.activeLineSymbol,l("polyline","outline","active")),r(()=>t.activeFillSymbol??t.polygonSymbol,l("polygon","outputGeometry")),r(()=>i?t.textSymbol??t.pointSymbol:t.pointSymbol,l("point","outputGeometry")),r(()=>t.vertexSymbol,l("point","vertex")),r(()=>t.activeVertexSymbol,l("point","vertex","active"))])}};e([s()],h.prototype,"_simplePointPlugin",null),e([s()],h.prototype,"_simplePointPluginRoot",null),e([s()],h.prototype,"_textPointPlugin",null),e([s()],h.prototype,"_multipointPlugin",null),e([s()],h.prototype,"_freehandPlugin",null),e([s()],h.prototype,"_bezierPlugin",null),e([s()],h.prototype,"_endpointArcPlugin",null),e([s()],h.prototype,"_interiorArcPlugin",null),e([s()],h.prototype,"_singlePartPolylinePlugin",null),e([s()],h.prototype,"_singlePartPolygonPlugin",null),e([s()],h.prototype,"_rectanglePlugin",null),e([s()],h.prototype,"_circlePlugin",null),e([s()],h.prototype,"sketch",void 0),e([s()],h.prototype,"sketchViewModel",null),e([s()],h.prototype,"effectiveRootPoint",null),e([s()],h.prototype,"effectiveRootText",null),e([s()],h.prototype,"effectiveRootMultipoint",null),e([s()],h.prototype,"effectiveRootPolyline",null),e([s()],h.prototype,"effectiveRootPolygon",null),e([s()],h.prototype,"effectiveRootRectangle",null),e([s()],h.prototype,"effectiveRootCircle",null),e([s()],h.prototype,"availablePlugins",null),h=e([a("esri.widgets.Sketch.support.PluginManager")],h);export{h as PluginManager};
|
|
2
|
+
import{__decorate as e}from"tslib";import i from"../../../core/Accessor.js";import{isSome as t}from"../../../core/arrayUtils.js";import l from"../../../core/Error.js";import{handlesGroup as o}from"../../../core/handleUtils.js";import n from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";let c=class extends i{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _simplePointPlugin(){const e=Symbol.for("esri-builtin-plugin-leaf-point");return{uniqueId:e,localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Point"}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create:()=>{const e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){const e=Symbol.for("esri-builtin-plugin-text-point");return{uniqueId:e,localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0},i=Symbol.for("esri-builtin-plugin-multipoint");return{uniqueId:i,localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>this._createPlugin(i),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{uniqueId:e,localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i},[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){const e=Symbol.for("esri-builtin-plugin-bezier-segment");return{uniqueId:e,localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",curveTypes:["cubic-bezier"],icon:"bezier-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Bezier"}}get _endpointArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first");return{uniqueId:e,localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>this._createPlugin(e,{arcDrawingMode:"end-first"}),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first");return{uniqueId:e,localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>this._createPlugin(e,{arcDrawingMode:"interior-first"}),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,l=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,o=Symbol.for("esri-builtin-plugin-simple-polyline");return{uniqueId:o,localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:l?"line":"freehand",create:()=>this._createPlugin(o),availableDownstreamPlugins:l?[this._simplePointPlugin,i?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:l?this._simplePointPlugin:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,l=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,o=Symbol.for("esri-builtin-plugin-simple-polygon");return{uniqueId:o,localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:l?"polygon":"freehand-area",create:()=>this._createPlugin(o),availableDownstreamPlugins:l?[this._simplePointPlugin,i?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:l?this._simplePointPlugin:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-rectangle");return{uniqueId:e,localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-ellipse");return{uniqueId:e,localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create:()=>{const i=this._createPlugin(e);return i.shapeType="circle",i.defaultUniform=!0,i.defaultCentered=!0,i},[Symbol.toStringTag]:"Circle"}}set sketch(e){this._set("sketch",e)}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return i||t?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return i||t?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(t),i=this.sketch?.availableCreateTools;if(!i)return e;const l=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const t=i.indexOf(e.legacyCreateTool);return-1===t?Number.MAX_SAFE_INTEGER:t};return e.map((e,i)=>({plugin:e,index:i,order:l(e)})).sort((e,i)=>e.order-i.order||e.index-i.index).map(({plugin:e})=>e)}get loaded(){return null!=this._pluginConstructors}getPluginsEquivalentToCreateTool(e,i){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":return"freehand"===i?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":return"freehand"===i?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const i=e.at(-1);if(i===this._freehandPlugin)return"freehand";return i===this._rectanglePlugin||i===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const i=this.sketchViewModel;if(!i?.view)return null;const{abortOptions:t,useTextSymbol:l}=e;return"2d"===i.view.type?await this._makeDrawToolRenderer2D({view:i.view,svm:i,useTextSymbol:l,abortOptions:t}):await this._makeDrawToolRenderer3D({view:i.view,svm:i,useTextSymbol:l,abortOptions:t})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||(this._pluginLoadPromise=(async()=>{const[{PointPlugin:e},{MultipointPlugin:i},{PolylinePlugin:t},{PolygonPlugin:l},{FreehandSegmentPlugin:o},{BezierSegmentPlugin:n},{CircularArcSegmentPlugin:r},{ShapePlugin:s}]=await Promise.all([import("../../../views/draw/plugins/PointPlugin.js"),import("../../../views/draw/plugins/MultipointPlugin.js"),import("../../../views/draw/plugins/PolylinePlugin.js"),import("../../../views/draw/plugins/PolygonPlugin.js"),import("../../../views/draw/plugins/FreehandSegmentPlugin.js"),import("../../../views/draw/plugins/BezierSegmentPlugin.js"),import("../../../views/draw/plugins/CircularArcSegmentPlugin.js"),import("../../../views/draw/plugins/ShapePlugin.js")]);this._pluginConstructors=new Map([[Symbol.for("esri-builtin-plugin-leaf-point"),e],[Symbol.for("esri-builtin-plugin-text-point"),e],[Symbol.for("esri-builtin-plugin-multipoint"),i],[Symbol.for("esri-builtin-plugin-freehand"),o],[Symbol.for("esri-builtin-plugin-bezier-segment"),n],[Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),r],[Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),r],[Symbol.for("esri-builtin-plugin-simple-polyline"),t],[Symbol.for("esri-builtin-plugin-simple-polygon"),l],[Symbol.for("esri-builtin-plugin-simple-rectangle"),s],[Symbol.for("esri-builtin-plugin-simple-ellipse"),s]])})().catch(e=>{throw this._pluginLoadPromise=null,e})),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}_createPlugin(e,...i){const t=this._pluginConstructors?.get(e);if(!t)throw new l("Sketch:PluginManager","Plugin implementations are not loaded. Call loadPlugins() before creating plugins.");return new t(...i)}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:i}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:t,svm:l,useTextSymbol:o,abortOptions:n}=e;r(n);const s=o?l.textSymbol??l.pointSymbol:l.pointSymbol,a=new i({symbolOverrides:{polyline:{outputGeometry:{default:l.polylineSymbol},outline:{active:l.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:l.activeFillSymbol??l.polygonSymbol}},point:{outputGeometry:{default:s},vertex:{default:l.vertexSymbol,active:l.activeVertexSymbol??void 0}}},view:t}),u=this._setupSymbolWatcher(a,l,o);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:i,svm:t,useTextSymbol:l,abortOptions:o}=e;return n.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:i,svm:t,useTextSymbol:l,abortOptions:o})}_setupSymbolWatcher(e,i,t){const l=(i,t,l)=>(o,n)=>{o!==n&&e.overrideSymbol({symbol:o,geometryType:i,role:t,state:l})};return o([s(()=>i.polylineSymbol,l("polyline","outputGeometry")),s(()=>i.activeLineSymbol,l("polyline","outline","active")),s(()=>i.activeFillSymbol??i.polygonSymbol,l("polygon","outputGeometry")),s(()=>t?i.textSymbol??i.pointSymbol:i.pointSymbol,l("point","outputGeometry")),s(()=>i.vertexSymbol,l("point","vertex")),s(()=>i.activeVertexSymbol,l("point","vertex","active"))])}};e([a()],c.prototype,"_simplePointPlugin",null),e([a()],c.prototype,"_simplePointPluginRoot",null),e([a()],c.prototype,"_textPointPlugin",null),e([a()],c.prototype,"_multipointPlugin",null),e([a()],c.prototype,"_freehandPlugin",null),e([a()],c.prototype,"_bezierPlugin",null),e([a()],c.prototype,"_endpointArcPlugin",null),e([a()],c.prototype,"_interiorArcPlugin",null),e([a()],c.prototype,"_singlePartPolylinePlugin",null),e([a()],c.prototype,"_singlePartPolygonPlugin",null),e([a()],c.prototype,"_rectanglePlugin",null),e([a()],c.prototype,"_circlePlugin",null),e([a()],c.prototype,"sketch",null),e([a()],c.prototype,"sketchViewModel",null),e([a()],c.prototype,"effectiveRootPoint",null),e([a()],c.prototype,"effectiveRootText",null),e([a()],c.prototype,"effectiveRootMultipoint",null),e([a()],c.prototype,"effectiveRootPolyline",null),e([a()],c.prototype,"effectiveRootPolygon",null),e([a()],c.prototype,"effectiveRootRectangle",null),e([a()],c.prototype,"effectiveRootCircle",null),e([a()],c.prototype,"availablePlugins",null),e([a()],c.prototype,"loaded",null),c=e([u("esri.widgets.Sketch.support.PluginManager")],c);export{c as PluginManager};
|
package/widgets/Sketch.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ import type { LineSymbol3DProperties } from "../symbols/LineSymbol3D.js";
|
|
|
31
31
|
import type { SimpleLineSymbolProperties } from "../symbols/SimpleLineSymbol.js";
|
|
32
32
|
import type { VisibleElementsProperties } from "./Sketch/VisibleElements.js";
|
|
33
33
|
|
|
34
|
-
export interface SketchProperties extends WidgetProperties, Partial<Pick<Sketch, "availableCreateTools" | "creationMode" | "layer" | "layout" | "scale" | "toolbarKind" | "view">> {
|
|
34
|
+
export interface SketchProperties extends WidgetProperties, Partial<Pick<Sketch, "availableCreateTools" | "creationMode" | "layer" | "layout" | "scale" | "toolbarKind" | "useLegacyCreateTools" | "view">> {
|
|
35
35
|
/**
|
|
36
36
|
* Default create options set for the Sketch widget.
|
|
37
37
|
*
|
|
@@ -158,19 +158,6 @@ export interface SketchProperties extends WidgetProperties, Partial<Pick<Sketch,
|
|
|
158
158
|
* @since 4.24
|
|
159
159
|
*/
|
|
160
160
|
tooltipOptions?: SketchTooltipOptionsProperties;
|
|
161
|
-
/**
|
|
162
|
-
* Starting with 5.0, `arcgis-sketch` and [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/)
|
|
163
|
-
* ara transitioning to a next generation geometry creation experience. This
|
|
164
|
-
* new experience enables the use of advanced curve creation tools and the
|
|
165
|
-
* combination of multiple create tools to define a single geometry.
|
|
166
|
-
*
|
|
167
|
-
* As of 5.0, this experience is only available in 2D (`arcgis-map`).
|
|
168
|
-
*
|
|
169
|
-
* @deprecated
|
|
170
|
-
* @default false
|
|
171
|
-
* @since 5.0
|
|
172
|
-
*/
|
|
173
|
-
useLegacyCreateTools?: boolean;
|
|
174
161
|
/**
|
|
175
162
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
176
163
|
*
|
|
@@ -678,13 +665,19 @@ export default class Sketch extends Widget<SketchProperties> {
|
|
|
678
665
|
* new experience enables the use of advanced curve creation tools and the
|
|
679
666
|
* combination of multiple create tools to define a single geometry.
|
|
680
667
|
*
|
|
681
|
-
* As of 5.0, this experience is only available in 2D (`arcgis-map`).
|
|
668
|
+
* As of 5.0, this experience is only available in 2D (e.g., [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/), [`arcgis-map`](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map)).
|
|
669
|
+
*
|
|
670
|
+
* This property is available to allow 2D applications to temporarily
|
|
671
|
+
* opt out of this experience.
|
|
672
|
+
*
|
|
673
|
+
* > [!CAUTION]
|
|
674
|
+
* >
|
|
675
|
+
* > This option will be removed in an upcoming release.
|
|
682
676
|
*
|
|
683
677
|
* @deprecated
|
|
684
|
-
* @default false
|
|
685
678
|
* @since 5.0
|
|
686
679
|
*/
|
|
687
|
-
|
|
680
|
+
accessor useLegacyCreateTools: boolean;
|
|
688
681
|
/**
|
|
689
682
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
690
683
|
*
|