@arcgis/core 5.0.0-next.54 → 5.0.0-next.55
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/Ground.d.ts +4 -6
- package/Ground.js +1 -1
- package/WebScene.js +1 -1
- package/applications/Components/drawUtils.d.ts +8 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -2
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{18cc131fd63d8c15df54.js → 14765f98b8ea447498a1.js} +4 -4
- package/assets/esri/core/workers/chunks/{308fb48d080e01499a26.js → 436f206898306df019ac.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2e8abb556a380cc2941.js → 492d575894c7905bb70c.js} +1 -1
- package/assets/esri/core/workers/chunks/5873c7b65d0fb04998fb.js +1 -0
- package/assets/esri/core/workers/chunks/d9736c783513e9c9b22f.js +1 -0
- package/assets/esri/core/workers/chunks/{cc67f066c3c0c2a1a37c.js → dd99b77a7c0a052507bb.js} +1 -1
- package/chunks/ChapmanAtmosphere.glsl.js +12 -9
- package/chunks/GlowComposition.glsl.js +1 -1
- package/chunks/Haze.glsl.js +4 -4
- package/chunks/RasterColorizer.glsl.js +10 -10
- package/chunks/Viewshed.glsl.js +1 -1
- package/config.js +1 -1
- package/geometry/projection/projectPointToVector.js +1 -1
- package/geometry/types.d.ts +10 -1
- package/interfaces.d.ts +21 -26
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +6 -3
- package/layers/support/SubtypeSublayer.d.ts +13 -0
- package/package.json +1 -1
- package/smartMapping/labels/clusters.d.ts +1 -1
- package/support/groundUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/types.d.ts +6 -0
- package/views/2d/types.d.ts +3 -1
- package/views/3d/environment/ChapmanApproximation.glsl.js +9 -10
- package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
- package/views/3d/environment/ChapmanRaymarching.glsl.js +1 -2
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.d.ts +1 -1
- package/views/3d/environment/types.d.ts +13 -0
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/webgl/ManagedFBO.d.ts +4 -5
- package/views/3d/webgl/RenderNode.d.ts +1 -1
- package/views/3d/{webgl-engine/lighting/SceneLighting.d.ts → webgl/types.d.ts} +4 -6
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +5 -5
- package/views/SceneView.d.ts +14 -17
- package/views/VideoView.d.ts +1 -2
- package/views/View.d.ts +2 -3
- package/views/View2D.d.ts +1 -2
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/PolygonDrawAction.d.ts +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.d.ts +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/types.d.ts +3 -1
- package/views/interactive/sketch/Units.d.ts +5 -1
- package/views/layers/ImageryLayerViewMixin.d.ts +2 -3
- package/views/layers/support/highlightUtils.js +1 -1
- package/views/types.d.ts +69 -1
- package/views/ui/types.d.ts +12 -1
- package/webscene/Environment.d.ts +2 -2
- package/webscene/support/FeatureReference.d.ts +1 -1
- package/webscene/types.d.ts +5 -1
- package/widgets/BasemapGallery.d.ts +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -1
- package/widgets/BasemapLayerList.d.ts +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +1 -1
- package/widgets/BatchAttributeForm.d.ts +1 -1
- package/widgets/Bookmarks.d.ts +1 -2
- package/widgets/BuildingExplorer.d.ts +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +1 -1
- package/widgets/CatalogLayerList.d.ts +1 -1
- package/widgets/Compass.d.ts +1 -1
- package/widgets/CoordinateConversion.d.ts +1 -2
- package/widgets/Daylight.d.ts +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -2
- package/widgets/DirectionalPad/{utils.d.ts → types.d.ts} +3 -1
- package/widgets/Directions.d.ts +1 -2
- package/widgets/Editor/EditorViewModel.d.ts +1 -2
- package/widgets/Editor/SplitFeatureWorkflow.d.ts +1 -2
- package/widgets/Editor/SplitFeatureWorkflowData.d.ts +1 -1
- package/widgets/Editor/types.d.ts +8 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.d.ts +2 -3
- package/widgets/Feature/types.d.ts +5 -1
- package/widgets/Feature.d.ts +1 -1
- package/widgets/FeatureForm/FieldInput.d.ts +1 -1
- package/widgets/FeatureForm.d.ts +1 -1
- package/widgets/FeatureTemplates.d.ts +1 -1
- package/widgets/Features/FeaturesViewModel.d.ts +1 -1
- package/widgets/Features.d.ts +1 -2
- package/widgets/FloorFilter.d.ts +1 -1
- package/widgets/Home.d.ts +1 -1
- package/widgets/LayerList/ListItemPanel.d.ts +1 -1
- package/widgets/LayerList/types.d.ts +2 -2
- package/widgets/LayerList.d.ts +1 -1
- package/widgets/Legend.d.ts +1 -1
- package/widgets/Locate.d.ts +1 -1
- package/widgets/Popup/types.d.ts +2 -0
- package/widgets/Popup.d.ts +1 -2
- package/widgets/Print.d.ts +1 -1
- package/widgets/Search.d.ts +1 -1
- package/widgets/ShadowCast/DurationOptions.d.ts +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.d.ts +1 -1
- package/widgets/ShadowCast/{ShadowVisualizationType.d.ts → types.d.ts} +4 -1
- package/widgets/ShadowCast.d.ts +1 -1
- package/widgets/Sketch/types.d.ts +1 -1
- package/widgets/Slice.d.ts +1 -1
- package/widgets/TableList.d.ts +1 -1
- package/widgets/Track.d.ts +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.d.ts +1 -1
- package/widgets/UtilityNetworkTrace/{support/ResultAreaHandler.d.ts → types.d.ts} +2 -2
- package/widgets/Weather/WeatherViewModel.d.ts +2 -2
- package/widgets/Weather.d.ts +1 -1
- package/widgets/support/GoTo.d.ts +1 -1
- package/widgets/support/forms/types.d.ts +2 -0
- package/widgets/support/{goToUtils.d.ts → types.d.ts} +8 -1
- package/assets/esri/core/workers/chunks/316f3e93aa0db48ef129.js +0 -1
- package/assets/esri/core/workers/chunks/ec7e6427d99cf3148a61.js +0 -1
- package/views/2d/ViewStateManager.d.ts +0 -2
- package/views/2d/layers/support/clusterUtils.d.ts +0 -6
- package/views/3d/environment/lightingUtils.d.ts +0 -4
- package/views/3d/environment/weather.d.ts +0 -9
- package/views/3d/glTF/internal/resourceUtils.d.ts +0 -10
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.d.ts +0 -2
- package/views/3d/support/QualityProfile.d.ts +0 -2
- package/views/SceneViewHitTestResult.d.ts +0 -64
- package/views/ViewingMode.d.ts +0 -2
- package/views/draw/DrawingMode.d.ts +0 -2
- package/views/draw/support/drawUtils.d.ts +0 -7
- package/views/ui/Padding.d.ts +0 -11
- package/views/viewType.d.ts +0 -2
- package/views/webgl/enums.d.ts +0 -38
- package/webscene/support/featureReferenceUtils.d.ts +0 -4
- package/widgets/DirectionalPad/constants.d.ts +0 -2
- package/widgets/Editor/support/splitFeatureUtils.d.ts +0 -7
- package/widgets/Feature/support/arcadeFeatureUtils.d.ts +0 -4
- package/widgets/Popup/actions.d.ts +0 -4
- package/widgets/ShadowCast/DurationMode.d.ts +0 -3
- package/widgets/support/Heading.d.ts +0 -7
- package/widgets/support/forms/formUtils.d.ts +0 -2
- /package/views/animation/{easing.d.ts → types.d.ts} +0 -0
- /package/views/draw/{DrawingMode.js → drawingModes.js} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{lerp as t,
|
|
5
|
+
import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{b as m}from"../../../../../chunks/vec32.js";import{earth as h}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as d}from"../TransparentEnvironment.js";import{H as u}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as p}from"./HazeCompositingTechnique.js";import{HazePassParameters as f,HazeTechnique as l}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as _}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as b}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as g}from"../../lib/textureUtils.js";import{DepthStencilAttachment as w,PrimitiveType as P}from"../../../../webgl/enums.js";let v=class extends d{constructor(e){super(e),this._compositingPassParameters=new u,this._passParameters=new f,this._hazeConfiguration=new _,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(l,new _);const i=new _;i.reduced=!0,t.precompile(l,i),t.precompile(p)}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(e){const i=e.find(({name:e})=>e===c.TRANSPARENT_ENVIRONMENT);if(!this.bindParameters.mainDepth)return i;const r=this.techniques.get(l,this._hazeConfiguration);if(!r.compiled)return i;const s=this.renderingContext,o=i.getAttachment(w);if(this._update(),!this._hazeConfiguration.reduced)return i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),i.attachDepth(o),i;const n=this.techniques.get(p);if(!n.compiled)return i;const a=s.getViewport(),d=this.camera,u=m(d.eye)-h.radius;let f;const _=h.atmosphereHeight;if(u<_){const e=Math.min(1,Math.max(0,u/_));f=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(u-_)/(15*_)));f=t(.5,1,e)}const b=this.renderingContext.parameters.maxTextureSize,P=g(Math.round(f*d.fullViewport[2]),b),v=g(Math.round(f*d.fullViewport[3]),b);s.setViewport(0,0,P,v);const A=this.fboCache.acquire(P,v,"haze",5);return s.bindFramebuffer(A.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),s.setViewport(a.x,a.y,a.width,a.height),this._compositingPassParameters.color=A.getTexture(),i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(n,this.bindParameters,this._compositingPassParameters),s.screen.draw(),i.attachDepth(o),A.release(),i}_renderCommon(e){this._vao??=b(e,1),e.bindVAO(this._vao),e.drawArrays(P.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;a(this._passParameters.radii,e,e+h.atmosphereHeight);const r=m(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-h.radius)),1,this._amount)}};v=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],v);export{v as Haze};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ChapmanApproximationPassParameters as t}from"../../../environment/ChapmanApproximation.glsl.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{H as i}from"../../../../../chunks/Haze.glsl.js";import{Pos2TexF16 as n}from"../../lib/DefaultVertexBufferLayouts.js";import{PrimitiveType as a}from"../../../../webgl/enums.js";import{makePipelineState as m,defaultColorWrite as l,copySource as c,separateBlendingParams as p}from"../../../../webgl/renderState.js";class h extends t{constructor(){super(...arguments),this.hazeStrength=1}}let u=class extends s{constructor(e,r){super(e,r,n),this.shader=new o(i,()=>import("./Haze.glsl.js")),this.primitiveType=a.TRIANGLE_STRIP}initializePipeline(e){return e.reduced?m({blending:c,depthTest:{func:519},colorWrite:l}):m({blending:p(1,0,769,1),colorWrite:l})}};u=e([r("esri.views.3d.webgl-engine.effects.haze.HazeTechnique")],u);export{h as HazePassParameters,u as HazeTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as t}from"../../../support/buffer/glUtil.js";import{newLayout as o}from"../../../support/buffer/InterleavedLayout.js";import{ReloadableShader as i}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as t}from"../../../support/buffer/glUtil.js";import{newLayout as o}from"../../../support/buffer/InterleavedLayout.js";import{ReloadableShader as i}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as c}from"../../core/shaderTechnique/ShaderTechnique.js";import{LaserlinePassParameters as a}from"./LaserlineTechnique.js";import{L as f}from"../../../../../chunks/LaserlinePath.glsl.js";class n extends a{constructor(){super(...arguments),this.origin=s()}}let l=class extends c{constructor(e,r){super(e,r,t(r.spherical?p:m)),this.shader=new i(f,()=>import("../../shaders/LaserlinePath.glsl.js"))}};l=e([r("esri.views.3d.webgl-engine.effects.laserlines.LaserlinePathTechnique")],l);const p=o().vec3f("start").vec3f("end").vec2f("extrude").vec3f("startUp").vec3f("endUp"),m=o().vec3f("start").vec3f("end").vec2f("extrude");export{n as LaserlinePathPassParameters,l as LaserlinePathTechnique,m as layoutPlanar,p as layoutSpherical};
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{smoothstep as e}from"../../../../core/mathUtils.js";import{
|
|
5
|
+
import{smoothstep as e}from"../../../../core/mathUtils.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as a}from"../../../../chunks/vec32.js";import{Float2BindUniform as o}from"../core/shaderModules/Float2BindUniform.js";import{Float3BindUniform as s}from"../core/shaderModules/Float3BindUniform.js";import{glsl as n}from"../core/shaderModules/glsl.js";import{SphereIntersect as i}from"./SphereIntersect.glsl.js";function c(t,c){t.fragment.uniforms.add(new o("cameraHeights",t=>{const o=t.camera,s=a(o.eye),n=Math.sqrt(s),i=c.radius,m=s-i*i;let h=e(4e6,5e6,n-i);return h=Math.min(h,.98),r(l,h,m)}),new s("cameraPosition",e=>e.camera.eye)),t.fragment.include(i),t.fragment.code.add(n`float sphereFade() {return cameraHeights[0];}
|
|
6
6
|
float sphereDepthInterpolate(vec3 worldRay, vec3 viewRay, float currentLinearDepth) {
|
|
7
|
-
vec2 rayPlanetIntersect = sphereIntersect(cameraPosition, worldRay,
|
|
7
|
+
vec2 rayPlanetIntersect = sphereIntersect(cameraPosition, worldRay, cameraHeights[1]);
|
|
8
8
|
bool hitsPlanet = (rayPlanetIntersect.x <= rayPlanetIntersect.y) && rayPlanetIntersect.x > 0.0;
|
|
9
9
|
if (hitsPlanet) {
|
|
10
10
|
float sphereDepth = rayPlanetIntersect.x;
|
|
11
11
|
viewRay *= viewRay.z*sphereDepth;
|
|
12
12
|
float linearDepth = length(viewRay);
|
|
13
|
-
float sphereFade =
|
|
14
|
-
return (-linearDepth)*sphereFade + currentLinearDepth*(1.0-sphereFade);
|
|
13
|
+
float sphereFade = cameraHeights[0];
|
|
14
|
+
return (-linearDepth) * sphereFade + currentLinearDepth * (1.0 - sphereFade);
|
|
15
15
|
}
|
|
16
16
|
return currentLinearDepth;
|
|
17
|
-
}`)}export{
|
|
17
|
+
}`)}const l=t();export{c as sphereDepthInterpolate};
|
package/views/SceneView.d.ts
CHANGED
|
@@ -24,14 +24,11 @@ import type { BreakpointsOwner, BreakpointsOwnerProperties } from "./Breakpoints
|
|
|
24
24
|
import type { DOMContainer, DOMContainerProperties } from "./DOMContainer.js";
|
|
25
25
|
import type { HitTestOptions3D } from "./HitTestItem3D.js";
|
|
26
26
|
import type { PopupView, PopupViewProperties } from "./PopupView.js";
|
|
27
|
-
import type { SceneViewHitTestResult } from "./
|
|
28
|
-
import type { GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
29
|
-
import type { ViewingModeString } from "./ViewingMode.js";
|
|
27
|
+
import type { SceneViewHitTestResult, GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
30
28
|
import type { LayerView3DFor } from "./3d/types.js";
|
|
31
29
|
import type { AnalysisView3DFor } from "./3d/analysis/types.js";
|
|
32
30
|
import type { Constraints, ConstraintsProperties } from "./3d/constraints/Constraints.js";
|
|
33
31
|
import type { SceneViewEnvironmentProperties } from "./3d/environment/SceneViewEnvironment.js";
|
|
34
|
-
import type { QualityProfileName } from "./3d/support/QualityProfile.js";
|
|
35
32
|
import type { PointProperties } from "../geometry/Point.js";
|
|
36
33
|
import type { ExtentProperties } from "../geometry/Extent.js";
|
|
37
34
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
@@ -371,7 +368,7 @@ export interface SceneViewProperties extends ViewProperties, DOMContainerPropert
|
|
|
371
368
|
* @see [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clippingArea)
|
|
372
369
|
* @see [Sample - Create a local scene](https://developers.arcgis.com/javascript/latest/sample-code/scene-local/)
|
|
373
370
|
*/
|
|
374
|
-
viewingMode?:
|
|
371
|
+
viewingMode?: "global" | "local" | null;
|
|
375
372
|
/**
|
|
376
373
|
* Represents the current view as a [Viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html)
|
|
377
374
|
* or point of observation on the view. In SceneViews, [camera](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#camera)
|
|
@@ -1218,7 +1215,7 @@ export default class SceneView extends SceneViewSuperclass {
|
|
|
1218
1215
|
* qualityProfile: "high"
|
|
1219
1216
|
* });
|
|
1220
1217
|
*/
|
|
1221
|
-
accessor qualityProfile:
|
|
1218
|
+
accessor qualityProfile: "low" | "medium" | "high";
|
|
1222
1219
|
/**
|
|
1223
1220
|
* Represents an approximation of the map scale.
|
|
1224
1221
|
* Setting the scale immediately changes the current view. For animating
|
|
@@ -1280,8 +1277,8 @@ export default class SceneView extends SceneViewSuperclass {
|
|
|
1280
1277
|
* @see [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clippingArea)
|
|
1281
1278
|
* @see [Sample - Create a local scene](https://developers.arcgis.com/javascript/latest/sample-code/scene-local/)
|
|
1282
1279
|
*/
|
|
1283
|
-
get viewingMode():
|
|
1284
|
-
set viewingMode(value:
|
|
1280
|
+
get viewingMode(): "global" | "local";
|
|
1281
|
+
set viewingMode(value: "global" | "local" | null | undefined);
|
|
1285
1282
|
/**
|
|
1286
1283
|
* Represents the current view as a [Viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html)
|
|
1287
1284
|
* or point of observation on the view. In SceneViews, [camera](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#camera)
|
|
@@ -1429,10 +1426,10 @@ export default class SceneView extends SceneViewSuperclass {
|
|
|
1429
1426
|
*/
|
|
1430
1427
|
goTo(target: GoToTarget3D, options?: GoToOptions3D): Promise<void>;
|
|
1431
1428
|
/**
|
|
1432
|
-
* Returns
|
|
1433
|
-
* The results are organized as an array of objects containing different
|
|
1429
|
+
* Returns {@link views/SceneViewHitTestResult!SceneViewHitTestResult hit test results} from each layer that intersects the specified screen coordinates.
|
|
1430
|
+
* The results are organized as an array of objects containing different {@link views/SceneViewHitTestResult!SceneViewHit result types}.
|
|
1434
1431
|
*
|
|
1435
|
-
* The following layer types will return all
|
|
1432
|
+
* The following layer types will return all {@link views/SceneViewHitTestResult!SceneViewGraphicHit features} if a hit is made on intersecting features:
|
|
1436
1433
|
* [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html),
|
|
1437
1434
|
* [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html),
|
|
1438
1435
|
* [SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html),
|
|
@@ -1443,25 +1440,25 @@ export default class SceneView extends SceneViewSuperclass {
|
|
|
1443
1440
|
* [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html),
|
|
1444
1441
|
* [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-OGCFeatureLayer.html), and [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#graphics).
|
|
1445
1442
|
*
|
|
1446
|
-
* The [MediaLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MediaLayer.html) hit test
|
|
1447
|
-
* The [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html) hit test
|
|
1443
|
+
* The [MediaLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MediaLayer.html) hit test {@link views/SceneViewHitTestResult!SceneViewMediaHit result} contains all media elements if the hit is made on intersecting elements.
|
|
1444
|
+
* The [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html) hit test {@link views/SceneViewHitTestResult!SceneViewRouteHit result} contains all route elements if the hit is made on intersecting elements.
|
|
1448
1445
|
*
|
|
1449
|
-
* The [VoxelLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VoxelLayer.html) hit test
|
|
1446
|
+
* The [VoxelLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VoxelLayer.html) hit test {@link views/SceneViewHitTestResult!SceneViewGraphicHit result} contains information about the intersecting voxel if a hit is made.
|
|
1450
1447
|
*
|
|
1451
1448
|
* If no options are specified, graphics that are behind the ground surface will not be returned unless the ground surface is
|
|
1452
1449
|
* semi-transparent. Otherwise, using the [Map#ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) in the include and exclude options determines
|
|
1453
1450
|
* whether the ground surface prevents hit testing graphics that are under it.
|
|
1454
1451
|
*
|
|
1455
1452
|
* Release specific changes:
|
|
1456
|
-
* * At version 4.24,
|
|
1457
|
-
*
|
|
1453
|
+
* * At version 4.24, {@link views/SceneViewHitTestResult!SceneViewHitTestResult} returns an array of objects containing {@link views/SceneViewHitTestResult!SceneViewGraphicHit graphic},
|
|
1454
|
+
* {@link views/SceneViewHitTestResult!SceneViewMediaHit media element}, and {@link views/SceneViewHitTestResult!SceneViewRouteHit route}.
|
|
1458
1455
|
* * Starting with version 4.11, if a label intersects the specified screen coordinates then the result of the hitTest will
|
|
1459
1456
|
* contain the graphic associated with that label.
|
|
1460
1457
|
*
|
|
1461
1458
|
* @param screenPoint - The screen coordinates (or native mouse event) of the click on the view.
|
|
1462
1459
|
* @param options - Intersection test options. By default the [Map#ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) is excluded if its opacity
|
|
1463
1460
|
* is smaller than one.
|
|
1464
|
-
* @returns When resolved, returns an array of objects containing different
|
|
1461
|
+
* @returns When resolved, returns an array of objects containing different {@link views/SceneViewHitTestResult!SceneViewHit result types}.
|
|
1465
1462
|
* @see [Sample: Access features with click events](https://developers.arcgis.com/javascript/latest/sample-code/view-hittest/)
|
|
1466
1463
|
* @see [Sample: SceneView - hitTest](https://developers.arcgis.com/javascript/latest/sample-code/sceneview-hittest/)
|
|
1467
1464
|
* @example
|
package/views/VideoView.d.ts
CHANGED
|
@@ -91,8 +91,7 @@ export default class VideoView extends VideoViewSuperclass {
|
|
|
91
91
|
*
|
|
92
92
|
* - [width](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-VideoView.html#width)
|
|
93
93
|
* - [height](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-VideoView.html#height)
|
|
94
|
-
* -
|
|
95
|
-
* - {@link views/VideoView#videoHeight}
|
|
94
|
+
* - [videoSize](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-VideoView.html#videoSize)
|
|
96
95
|
* - The [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-VideoView.html#layer) is [ready](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VideoLayer.html#state).
|
|
97
96
|
*
|
|
98
97
|
* When a view becomes ready it will resolve itself and invoke
|
package/views/View.d.ts
CHANGED
|
@@ -19,8 +19,7 @@ import type { EventedMixin, EventedMixinProperties } from "../core/Evented.js";
|
|
|
19
19
|
import type { EsriPromise, EsriPromiseMixinProperties } from "../core/Promise.js";
|
|
20
20
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
21
21
|
import type { SceneViewEventTypes } from "./ISceneView.js";
|
|
22
|
-
import type {
|
|
23
|
-
import type { Padding } from "./ui/Padding.js";
|
|
22
|
+
import type { Padding } from "./ui/types.js";
|
|
24
23
|
import type { GraphicProperties } from "../Graphic.js";
|
|
25
24
|
import type { HighlightOptionsProperties } from "./support/HighlightOptions.js";
|
|
26
25
|
import type { MapProperties } from "../Map.js";
|
|
@@ -694,7 +693,7 @@ export default abstract class View<TLayerView extends LayerView = LayerView> ext
|
|
|
694
693
|
* [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html)) or `3d`
|
|
695
694
|
* (indicating a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html)).
|
|
696
695
|
*/
|
|
697
|
-
get type():
|
|
696
|
+
get type(): "2d" | "3d";
|
|
698
697
|
/**
|
|
699
698
|
* Indicates whether the view is being updated by additional data requests to the network,
|
|
700
699
|
* or by processing received data.
|
package/views/View2D.d.ts
CHANGED
|
@@ -28,8 +28,7 @@ import type { GoToOptions2D, GoToTarget2D, ToScreenOptions2D } from "./types.js"
|
|
|
28
28
|
import type { Viewport2DBaseMixin, Viewport2DBaseMixinProperties } from "./Viewport2DBaseMixin.js";
|
|
29
29
|
import type { Viewport2DMixin, Viewport2DMixinProperties } from "./Viewport2DMixin.js";
|
|
30
30
|
import type { MapViewConstraintsProperties } from "./2d/MapViewConstraints.js";
|
|
31
|
-
import type { LayerView2DFor } from "./2d/types.js";
|
|
32
|
-
import type { ResizeAlign } from "./2d/ViewStateManager.js";
|
|
31
|
+
import type { LayerView2DFor, ResizeAlign } from "./2d/types.js";
|
|
33
32
|
import type { AnalysisView2DUnion } from "./2d/analysis/types.js";
|
|
34
33
|
import type { ColorBackgroundProperties } from "../webmap/background/ColorBackground.js";
|
|
35
34
|
import type { PointProperties } from "../geometry/Point.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{equalsMaybe as n,destroyMaybe as r}from"../../core/maybe.js";import{memoize as s}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import a from"../../core/ReactiveSet.js";import{watch as p,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{property as d,subclass as h}from"../../core/accessorSupport/decorators.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as m,pointNear as y}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./DrawingMode.js";import{LegacyDrawManipulator as f}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,sceneSnappingAtLocation as b}from"../interactive/dragEventPipeline.js";import{EditGeometry as T,Part as S}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as V}from"../interactive/sketch/constraints.js";import{getPointConstraint as w,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as M,constraintSpaceToPoint as D}from"../interactive/sketch/constraintUtils.js";import E from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as I}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as H}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as G}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as j}from"../interactive/snapping/snappingUtils.js";const k="crosshair",Z="progress",L=Symbol(),U=Symbol();let A=class extends e{constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new a,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=s(w),this._getPolylineOrPolygonConstraint=s(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new E,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,null==t.elevationInfo&&(this.elevationInfo=_(!!t.hasZ))}initializePointer(){const t=this.view.inputManager?.latestPointerInfo;null!=t&&this._updatePointer(t.location,t.id,t.type)}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,r="viewingMode"in e.state?e.state.viewingMode:2,s="segment"===t||"multipoint"===t?"polyline":t;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new C(new T(s,this.coordinateHelper),r),this._snappingOperation=new G({view:e}),this.addHandles([p(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:t,constraint:e},i)=>{const{snappingOptions:n}=this;n&&(n.forceDisabled=null!=e&&V(e));if(null!=i&&t===i.stagedPoint&&e!==i.constraint)return this._onKeyboardBasedChange();this._processCursor(t??this._screenToMap(this._stagedScreenPoint))},{equals:(t,e)=>t.stagedPoint===e.stagedPoint&&n(t.constraint,e.constraint)}),p(()=>this.view.viewpoint,(t,e)=>{t&&e&&u(t,e)&&this._onKeyboardBasedChange()})]),this._activePart=new S(i,r),this._editGeometryOperations.data.parts.push(this._activePart);const a=this.segmentLabels;null!=a&&(a.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},this.addHandles(p(()=>this.labelOptions.enabled,t=>{a.visible=t},l))),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],t=>{const e=t.vertices.map(t=>({componentIndex:0,vertexIndex:t.index,coordinates:this.coordinateHelper.vectorToArray(t.pos)})),i=e.map(t=>t.coordinates),n=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;m(n,this.firstVertex)||(this.firstVertex=n);const r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;m(r,this.lastVertex)||(this.lastVertex=r);const s=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(m(s,this.secondToLastVertex)||(this.secondToLastVertex=s),this._processCursor(this.cursorVertex),t.type){case"vertex-add":this.emit(t.type,{...t,added:i,vertices:e});break;case"vertex-update":this.emit(t.type,{...t,updated:i,vertices:e});break;case"vertex-remove":this.emit(t.type,{...t,removed:i,vertices:e})}}));const c=this._manipulator=new f({consumesClicks:!1,grabbableForEvent:t=>"click"!==this.drawingMode||"touch"===t.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(c),c.grabbable="point"!==t&&"multipoint"!==t,this.addHandles([c.events.on("immediate-click",t=>this._onImmediateClick(t)),c.events.on("immediate-double-click",t=>this._onImmediateDoubleClick(t)),p(()=>this.drawingMode,()=>{this.removeHandles(L),this.addHandles(this._createManipulatorDragPipeline(c),L)},l),p(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:t})=>{c.cursor=t},l)]),j(this,()=>{const t=this.view.inputManager.latestPointerInfo?.type??"mouse",e=this._getSnappingContext(t);if(null!=this.snappingManager){const t=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,e);this._updatingHandles.addPromise(o(t))}})}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){const{_stagedPointerId:t,_manipulator:e}=this;return null!=t&&this._pointerDownStates.has(t)||e.grabbing||!e.interactive}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._updateAndGetEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}get _constraint(){const{constraints:t,constraintsEnabled:e}=this;if(t&&e)switch(this.geometryType){case"point":case"multipoint":return this._getPointConstraint(t);case"polygon":case"polyline":return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,t)}}set drawingMode(t){this._set("drawingMode",t??v)}get effectiveCursor(){return this.loading?Z:this._hideDefaultCursor?null:this.cursor||k}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get cursorVertex(){return this._get("cursorVertex")}get visualizationCursorVertex(){return"mouse"===this._stagedPointerType?this.cursorVertex:null}get committableVertex(){const{cursorVertex:t,lastVertex:e,firstVertex:i,geometryType:n}=this;return"polygon"===n&&y(t,i)||y(t,e)?null:t}get updating(){return this._updatingHandles.updating}get geometryIncludingUncommittedVertices(){const{committedVertices:t,committableVertex:e,coordinateHelper:i}=this,n=t.slice();return null!=e&&n.push(i.pointToArray(e)),n}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();const{committableVertex:t}=this;null!=t&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t),this._activePart)}complete(t){const e=t?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();const{geometryType:i,numCommittedVertices:n}=this,r="multipoint"===i&&0===n||"polyline"===i&&n<2||"polygon"===i&&n<3;"segment"!==i&&"point"!==i||this.commitStagedVertex(),this._createOperationCompleted=!r,(this.isCompleted||e)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit("complete",{vertices:this.committedVertices.map((t,e)=>({componentIndex:0,vertexIndex:e,coordinates:t})),aborted:e,type:"complete"}))}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(t){const e=i(this.cursorVertex),n=i(t),r=n&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(n)??n),s=this._snapToClosingVertex(r),o=this._applyConstraints(s);y(e,o)||(this._set("cursorVertex",o),this.segmentLabels?.set("stagedVertex",null!=o?this.coordinateHelper.pointToVector(o):null),null==o||"mouse"!==this._stagedPointerType?this.emit("cursor-remove"):this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:"apply",type:"vertex-update"}))}_snapToClosingVertex(t){if(null==t||this._isDragging||"polygon"!==this.geometryType||this.numCommittedVertices<=2)return t;const e=this._mapToScreen(t);if(!e)return t;const i=this._activePart;return this._vertexWithinPointerDistance(i.vertices[0].pos,e)?this.firstVertex:this._vertexWithinPointerDistance(i.vertices.at(-1).pos,e)?this.lastVertex:t}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return P(t,(t,e,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:s,cancelSnapping:o}=H({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:n,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next(t=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),t)).next(o),e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._processCursor(t.mapStart),("segment"===this.geometryType||r&&!this.numCommittedVertices)&&this.commitStagedVertex()),t)).next(b(this.view,this.elevationInfo)).next(...s).next(t=>(r&&(this._processCursor(t.mapEnd),"end"===t.action&&this.commitStagedVertex()),t)).next(t=>("end"===t.action&&("mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),t))})}_createManipulatorDragPipelineFreehand(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),null==this.committableVertex&&this._processCursor(t.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return t})})}_createManipulatorDragPipelineHybrid(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),U),this._processCursor(t.mapStart),this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),this.removeHandles(U),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return t})})}get _drawAtFixedElevation(){const{constraintsEnabled:t,constraintZ:e,geometryType:i,numCommittedVertices:n}=this;return t?null!=e||"segment"===i&&n>0:("segment"===i||"polygon"===i)&&n>0}_updateAndGetEffectiveDrawSurface(){const{constraintsEnabled:t,coordinateHelper:e,drawSurface:i,elevationDrawSurface:n,snapToSceneEnabled:r}=this;if(null==n)return i;if(!this.hasZ)return n.defaultZ=null,n;const s=this.elevationInfo?.mode;let o=this.defaultZ,a=t||"absolute-height"===s;if(null!=r&&(a=r),"on-the-ground"===s&&(a=!1),this._drawAtFixedElevation){o=(t?this.constraintZ:null)??e.getZ(this._activePart.vertices[0].pos),a=!1}return a?i:(n.defaultZ=o,n)}_mapToScreen(t){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===t.pointerType&&this._snappingEnabled&&this._processCursor(t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(!("mouse"===t.pointerType&&2===t.button||this._manipulator.dragging))try{const{drawingMode:e,geometryType:i}=this;this._stagedPointerType=t.pointerType,this._stagedScreenPoint=t.screenPoint;const n=this._screenToMap(t.screenPoint);if(null==n)return;if(null==n||"freehand"===e&&"point"!==i&&"multipoint"!==i)return;if(this._snappingEnabled&&null!=this.cursorVertex||this._processCursor(n),null==this.committableVertex)return void this.complete();this.commitStagedVertex(),"mouse"!==t.pointerType&&this._processCursor(null),("freehand"===e&&"multipoint"!==this.geometryType||"point"===i||"segment"===i&&2===this.numCommittedVertices||"segment"===i&&"hybrid"===e&&1===this.numCommittedVertices)&&this.complete()}finally{t.stopPropagation()}}_onImmediateDoubleClick(t){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=c(t.x,t.y);this._updatePointer(e,t.pointerId,t.pointerType)&&t.stopPropagation()}_updatePointer(t,e,i){return this._stagedScreenPoint=t,this._stagedPointerType=i,this._stagedPointerId=e,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(t,i),!0)}_onKeyboardBasedChange(){"mouse"===this._stagedPointerType&&this._stagedScreenPoint&&null!=this._stagedPointerId&&!this._isDragging?this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType):this._snappingOperation.abort()}_processCursorMovementRelativeToSurface(t,e){const i=this._snappingOperation,n=this._screenToMap(t),r=this._requiresScenePoint?this.drawSurface?.screenToMap(t):null;if(null==n)return this._hideDefaultCursor=!0,this._processCursor(null),void i.abort();this._hideDefaultCursor=!1;const s=this.snappingManager;if(null==s)return this._processCursor(n),void i.abort();const a=this._getSnappingContext(e);this._updatingHandles.addPromise(o(i.snap({point:n,scenePoint:r},s,a)))}_applyConstraints(t){const{_constraint:e,constraints:i}=this;if(!t||!i||!e)return t;const{context:n}=i,r=M(t,n),s=r?e.closestTo(r):void 0;if(!s)return t;const o=D(s,t,n),a="2d"===this.view.type||"absolute-height"!==n.elevationInfo.mode;return null!=o&&a&&null!=this.constraintZ&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(t){return t?this._updateAndGetEffectiveDrawSurface()?.screenToMap(t):null}_screenToMapDragEventStep(){let t=null;return e=>{if("start"===e.action&&(t=this._screenToMap(e.screenStart)),null==t)return null;const i=this._screenToMap(e.screenEnd);return null!=i?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return null!=n&&z(n,e,i)}_getSnappingContext(t){const e=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:null!=e?{value:e,elevationInfo:this.elevationInfo}:null,drawConstraints:this.constraints})}};function z(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=i}t([d()],A.prototype,"_hideDefaultCursor",void 0),t([d()],A.prototype,"_stagedPointerId",void 0),t([d()],A.prototype,"_isDragging",null),t([d()],A.prototype,"_snappingOperation",void 0),t([d()],A.prototype,"_snappingEnabled",null),t([d({constructOnly:!0})],A.prototype,"graphic",void 0),t([d()],A.prototype,"constraintsEnabled",void 0),t([d()],A.prototype,"constraints",void 0),t([d()],A.prototype,"_constraint",null),t([d()],A.prototype,"constraintZ",void 0),t([d()],A.prototype,"defaultZ",void 0),t([d()],A.prototype,"isDraped",void 0),t([d({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([d({value:v})],A.prototype,"drawingMode",null),t([d({constructOnly:!0})],A.prototype,"elevationDrawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"elevationInfo",void 0),t([d({constructOnly:!0,type:E})],A.prototype,"labelOptions",void 0),t([d({constructOnly:!0})],A.prototype,"geometryType",void 0),t([d({constructOnly:!0})],A.prototype,"hasM",void 0),t([d({constructOnly:!0})],A.prototype,"hasZ",void 0),t([d()],A.prototype,"cursor",void 0),t([d()],A.prototype,"effectiveCursor",null),t([d()],A.prototype,"loading",void 0),t([d({constructOnly:!0})],A.prototype,"manipulators",void 0),t([d({constructOnly:!0})],A.prototype,"drawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"segmentLabels",void 0),t([d({constructOnly:!0})],A.prototype,"snappingManager",void 0),t([d({constructOnly:!0})],A.prototype,"snappingVisualizer",void 0),t([d()],A.prototype,"snapToSceneEnabled",void 0),t([d({readOnly:!0})],A.prototype,"cursorVertex",null),t([d({readOnly:!0})],A.prototype,"visualizationCursorVertex",null),t([d()],A.prototype,"committableVertex",null),t([d()],A.prototype,"firstVertex",void 0),t([d()],A.prototype,"lastVertex",void 0),t([d()],A.prototype,"secondToLastVertex",void 0),t([d()],A.prototype,"updating",null),t([d({constructOnly:!0})],A.prototype,"view",void 0),A=t([h("esri.views.draw.DrawOperation")],A);export{A as DrawOperation,k as defaultCursor,Z as defaultLoadingCursor};
|
|
5
|
+
import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{equalsMaybe as n,destroyMaybe as r}from"../../core/maybe.js";import{memoize as s}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import a from"../../core/ReactiveSet.js";import{watch as p,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{property as d,subclass as h}from"../../core/accessorSupport/decorators.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as m,pointNear as y}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as f}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,sceneSnappingAtLocation as b}from"../interactive/dragEventPipeline.js";import{EditGeometry as T,Part as S}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as V}from"../interactive/sketch/constraints.js";import{getPointConstraint as w,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as M,constraintSpaceToPoint as D}from"../interactive/sketch/constraintUtils.js";import E from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as I}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as H}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as G}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as j}from"../interactive/snapping/snappingUtils.js";const k="crosshair",Z="progress",L=Symbol(),U=Symbol();let A=class extends e{constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new a,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=s(w),this._getPolylineOrPolygonConstraint=s(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new E,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,null==t.elevationInfo&&(this.elevationInfo=_(!!t.hasZ))}initializePointer(){const t=this.view.inputManager?.latestPointerInfo;null!=t&&this._updatePointer(t.location,t.id,t.type)}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,r="viewingMode"in e.state?e.state.viewingMode:2,s="segment"===t||"multipoint"===t?"polyline":t;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new C(new T(s,this.coordinateHelper),r),this._snappingOperation=new G({view:e}),this.addHandles([p(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:t,constraint:e},i)=>{const{snappingOptions:n}=this;n&&(n.forceDisabled=null!=e&&V(e));if(null!=i&&t===i.stagedPoint&&e!==i.constraint)return this._onKeyboardBasedChange();this._processCursor(t??this._screenToMap(this._stagedScreenPoint))},{equals:(t,e)=>t.stagedPoint===e.stagedPoint&&n(t.constraint,e.constraint)}),p(()=>this.view.viewpoint,(t,e)=>{t&&e&&u(t,e)&&this._onKeyboardBasedChange()})]),this._activePart=new S(i,r),this._editGeometryOperations.data.parts.push(this._activePart);const a=this.segmentLabels;null!=a&&(a.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},this.addHandles(p(()=>this.labelOptions.enabled,t=>{a.visible=t},l))),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],t=>{const e=t.vertices.map(t=>({componentIndex:0,vertexIndex:t.index,coordinates:this.coordinateHelper.vectorToArray(t.pos)})),i=e.map(t=>t.coordinates),n=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;m(n,this.firstVertex)||(this.firstVertex=n);const r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;m(r,this.lastVertex)||(this.lastVertex=r);const s=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(m(s,this.secondToLastVertex)||(this.secondToLastVertex=s),this._processCursor(this.cursorVertex),t.type){case"vertex-add":this.emit(t.type,{...t,added:i,vertices:e});break;case"vertex-update":this.emit(t.type,{...t,updated:i,vertices:e});break;case"vertex-remove":this.emit(t.type,{...t,removed:i,vertices:e})}}));const c=this._manipulator=new f({consumesClicks:!1,grabbableForEvent:t=>"click"!==this.drawingMode||"touch"===t.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(c),c.grabbable="point"!==t&&"multipoint"!==t,this.addHandles([c.events.on("immediate-click",t=>this._onImmediateClick(t)),c.events.on("immediate-double-click",t=>this._onImmediateDoubleClick(t)),p(()=>this.drawingMode,()=>{this.removeHandles(L),this.addHandles(this._createManipulatorDragPipeline(c),L)},l),p(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:t})=>{c.cursor=t},l)]),j(this,()=>{const t=this.view.inputManager.latestPointerInfo?.type??"mouse",e=this._getSnappingContext(t);if(null!=this.snappingManager){const t=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,e);this._updatingHandles.addPromise(o(t))}})}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){const{_stagedPointerId:t,_manipulator:e}=this;return null!=t&&this._pointerDownStates.has(t)||e.grabbing||!e.interactive}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._updateAndGetEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}get _constraint(){const{constraints:t,constraintsEnabled:e}=this;if(t&&e)switch(this.geometryType){case"point":case"multipoint":return this._getPointConstraint(t);case"polygon":case"polyline":return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,t)}}set drawingMode(t){this._set("drawingMode",t??v)}get effectiveCursor(){return this.loading?Z:this._hideDefaultCursor?null:this.cursor||k}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get cursorVertex(){return this._get("cursorVertex")}get visualizationCursorVertex(){return"mouse"===this._stagedPointerType?this.cursorVertex:null}get committableVertex(){const{cursorVertex:t,lastVertex:e,firstVertex:i,geometryType:n}=this;return"polygon"===n&&y(t,i)||y(t,e)?null:t}get updating(){return this._updatingHandles.updating}get geometryIncludingUncommittedVertices(){const{committedVertices:t,committableVertex:e,coordinateHelper:i}=this,n=t.slice();return null!=e&&n.push(i.pointToArray(e)),n}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();const{committableVertex:t}=this;null!=t&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t),this._activePart)}complete(t){const e=t?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();const{geometryType:i,numCommittedVertices:n}=this,r="multipoint"===i&&0===n||"polyline"===i&&n<2||"polygon"===i&&n<3;"segment"!==i&&"point"!==i||this.commitStagedVertex(),this._createOperationCompleted=!r,(this.isCompleted||e)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit("complete",{vertices:this.committedVertices.map((t,e)=>({componentIndex:0,vertexIndex:e,coordinates:t})),aborted:e,type:"complete"}))}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(t){const e=i(this.cursorVertex),n=i(t),r=n&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(n)??n),s=this._snapToClosingVertex(r),o=this._applyConstraints(s);y(e,o)||(this._set("cursorVertex",o),this.segmentLabels?.set("stagedVertex",null!=o?this.coordinateHelper.pointToVector(o):null),null==o||"mouse"!==this._stagedPointerType?this.emit("cursor-remove"):this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:"apply",type:"vertex-update"}))}_snapToClosingVertex(t){if(null==t||this._isDragging||"polygon"!==this.geometryType||this.numCommittedVertices<=2)return t;const e=this._mapToScreen(t);if(!e)return t;const i=this._activePart;return this._vertexWithinPointerDistance(i.vertices[0].pos,e)?this.firstVertex:this._vertexWithinPointerDistance(i.vertices.at(-1).pos,e)?this.lastVertex:t}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return P(t,(t,e,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:s,cancelSnapping:o}=H({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:n,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next(t=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),t)).next(o),e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._processCursor(t.mapStart),("segment"===this.geometryType||r&&!this.numCommittedVertices)&&this.commitStagedVertex()),t)).next(b(this.view,this.elevationInfo)).next(...s).next(t=>(r&&(this._processCursor(t.mapEnd),"end"===t.action&&this.commitStagedVertex()),t)).next(t=>("end"===t.action&&("mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),t))})}_createManipulatorDragPipelineFreehand(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),null==this.committableVertex&&this._processCursor(t.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return t})})}_createManipulatorDragPipelineHybrid(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),U),this._processCursor(t.mapStart),this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),this.removeHandles(U),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return t})})}get _drawAtFixedElevation(){const{constraintsEnabled:t,constraintZ:e,geometryType:i,numCommittedVertices:n}=this;return t?null!=e||"segment"===i&&n>0:("segment"===i||"polygon"===i)&&n>0}_updateAndGetEffectiveDrawSurface(){const{constraintsEnabled:t,coordinateHelper:e,drawSurface:i,elevationDrawSurface:n,snapToSceneEnabled:r}=this;if(null==n)return i;if(!this.hasZ)return n.defaultZ=null,n;const s=this.elevationInfo?.mode;let o=this.defaultZ,a=t||"absolute-height"===s;if(null!=r&&(a=r),"on-the-ground"===s&&(a=!1),this._drawAtFixedElevation){o=(t?this.constraintZ:null)??e.getZ(this._activePart.vertices[0].pos),a=!1}return a?i:(n.defaultZ=o,n)}_mapToScreen(t){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===t.pointerType&&this._snappingEnabled&&this._processCursor(t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(!("mouse"===t.pointerType&&2===t.button||this._manipulator.dragging))try{const{drawingMode:e,geometryType:i}=this;this._stagedPointerType=t.pointerType,this._stagedScreenPoint=t.screenPoint;const n=this._screenToMap(t.screenPoint);if(null==n)return;if(null==n||"freehand"===e&&"point"!==i&&"multipoint"!==i)return;if(this._snappingEnabled&&null!=this.cursorVertex||this._processCursor(n),null==this.committableVertex)return void this.complete();this.commitStagedVertex(),"mouse"!==t.pointerType&&this._processCursor(null),("freehand"===e&&"multipoint"!==this.geometryType||"point"===i||"segment"===i&&2===this.numCommittedVertices||"segment"===i&&"hybrid"===e&&1===this.numCommittedVertices)&&this.complete()}finally{t.stopPropagation()}}_onImmediateDoubleClick(t){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=c(t.x,t.y);this._updatePointer(e,t.pointerId,t.pointerType)&&t.stopPropagation()}_updatePointer(t,e,i){return this._stagedScreenPoint=t,this._stagedPointerType=i,this._stagedPointerId=e,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(t,i),!0)}_onKeyboardBasedChange(){"mouse"===this._stagedPointerType&&this._stagedScreenPoint&&null!=this._stagedPointerId&&!this._isDragging?this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType):this._snappingOperation.abort()}_processCursorMovementRelativeToSurface(t,e){const i=this._snappingOperation,n=this._screenToMap(t),r=this._requiresScenePoint?this.drawSurface?.screenToMap(t):null;if(null==n)return this._hideDefaultCursor=!0,this._processCursor(null),void i.abort();this._hideDefaultCursor=!1;const s=this.snappingManager;if(null==s)return this._processCursor(n),void i.abort();const a=this._getSnappingContext(e);this._updatingHandles.addPromise(o(i.snap({point:n,scenePoint:r},s,a)))}_applyConstraints(t){const{_constraint:e,constraints:i}=this;if(!t||!i||!e)return t;const{context:n}=i,r=M(t,n),s=r?e.closestTo(r):void 0;if(!s)return t;const o=D(s,t,n),a="2d"===this.view.type||"absolute-height"!==n.elevationInfo.mode;return null!=o&&a&&null!=this.constraintZ&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(t){return t?this._updateAndGetEffectiveDrawSurface()?.screenToMap(t):null}_screenToMapDragEventStep(){let t=null;return e=>{if("start"===e.action&&(t=this._screenToMap(e.screenStart)),null==t)return null;const i=this._screenToMap(e.screenEnd);return null!=i?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return null!=n&&z(n,e,i)}_getSnappingContext(t){const e=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:null!=e?{value:e,elevationInfo:this.elevationInfo}:null,drawConstraints:this.constraints})}};function z(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=i}t([d()],A.prototype,"_hideDefaultCursor",void 0),t([d()],A.prototype,"_stagedPointerId",void 0),t([d()],A.prototype,"_isDragging",null),t([d()],A.prototype,"_snappingOperation",void 0),t([d()],A.prototype,"_snappingEnabled",null),t([d({constructOnly:!0})],A.prototype,"graphic",void 0),t([d()],A.prototype,"constraintsEnabled",void 0),t([d()],A.prototype,"constraints",void 0),t([d()],A.prototype,"_constraint",null),t([d()],A.prototype,"constraintZ",void 0),t([d()],A.prototype,"defaultZ",void 0),t([d()],A.prototype,"isDraped",void 0),t([d({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([d({value:v})],A.prototype,"drawingMode",null),t([d({constructOnly:!0})],A.prototype,"elevationDrawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"elevationInfo",void 0),t([d({constructOnly:!0,type:E})],A.prototype,"labelOptions",void 0),t([d({constructOnly:!0})],A.prototype,"geometryType",void 0),t([d({constructOnly:!0})],A.prototype,"hasM",void 0),t([d({constructOnly:!0})],A.prototype,"hasZ",void 0),t([d()],A.prototype,"cursor",void 0),t([d()],A.prototype,"effectiveCursor",null),t([d()],A.prototype,"loading",void 0),t([d({constructOnly:!0})],A.prototype,"manipulators",void 0),t([d({constructOnly:!0})],A.prototype,"drawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"segmentLabels",void 0),t([d({constructOnly:!0})],A.prototype,"snappingManager",void 0),t([d({constructOnly:!0})],A.prototype,"snappingVisualizer",void 0),t([d()],A.prototype,"snapToSceneEnabled",void 0),t([d({readOnly:!0})],A.prototype,"cursorVertex",null),t([d({readOnly:!0})],A.prototype,"visualizationCursorVertex",null),t([d()],A.prototype,"committableVertex",null),t([d()],A.prototype,"firstVertex",void 0),t([d()],A.prototype,"lastVertex",void 0),t([d()],A.prototype,"secondToLastVertex",void 0),t([d()],A.prototype,"updating",null),t([d({constructOnly:!0})],A.prototype,"view",void 0),A=t([h("esri.views.draw.DrawOperation")],A);export{A as DrawOperation,k as defaultCursor,Z as defaultLoadingCursor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { DrawingMode } from "./
|
|
2
|
+
import type { DrawingMode } from "./types.js";
|
|
3
3
|
import type { CursorUpdateEvent } from "./input/CursorUpdateEvents.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/CursorUpdateEvents.js";import{DrawCompleteEvent as d}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as h}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as p}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles(this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))},l.TOOL))}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",e=>{e.stopPropagation()},l.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())},l.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()},l.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},l.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}},l.TOOL),this.view.on("drag",e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()},l.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},l.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)},l.TOOL),this.view.on("key-up",e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)},l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new p(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}})])}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),i.on("vertex-add",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new h(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new h(t,o,r))}}),i.on("vertex-remove",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new p(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new p(t,o,r))}}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_dragEnabled",null),e([t()],u.prototype,"_clickEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolygonDrawAction")],u);const m=u;export{m as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { DrawingMode } from "./
|
|
2
|
+
import type { DrawingMode } from "./types.js";
|
|
3
3
|
import type { CursorUpdateEvent } from "./input/CursorUpdateEvents.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/CursorUpdateEvents.js";import{DrawCompleteEvent as d}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as h}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as p}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))},l.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",e=>{e.stopPropagation()},l.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())},l.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()},l.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},l.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}},l.TOOL),this.view.on("drag",e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()},l.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},l.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)},l.TOOL),this.view.on("key-up",e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)},l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new p(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}})])}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("vertex-add",e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new h(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new h(t,o,r))}),i.on("vertex-remove",e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new p(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new p(t,o,r))}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()})]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_clickEnabled",null),e([t()],u.prototype,"_dragEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolylineDrawAction")],u);const m=u;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h,subclass as
|
|
5
|
+
import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h,subclass as o}from"../../../core/accessorSupport/decorators.js";import a from"../../../layers/GraphicsLayer.js";import n from"../../../symbols/SimpleFillSymbol.js";import c from"../../../symbols/SimpleLineSymbol.js";import l from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as p}from"./drawUtils.js";import d from"./HighlightHelper.js";import{addUniqueLayer as g,findLayerView as v}from"./layerUtils.js";import{GraphicClickEvent as y,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as m,GraphicPointerUpEvent as f,GraphicPointerOutEvent as u,GraphicPointerOverEvent as w,GraphicMoveStartEvent as G,GraphicMoveEvent as b,GraphicMoveStopEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{createScreenPointFromEvent as x}from"../../support/screenUtils.js";const H="indicator-symbols";let M=class extends t{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!1,this.indicatorsEnabled=!1,this._defaultLayer=new a({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.layer=this._defaultLayer,this.view=null}initialize(){g(this.view,this.layer),this._highlightHelper=new d({view:this.view}),this.refresh(),this.addHandles([s(()=>this.graphics.length,()=>this.refresh()),r(()=>this.view?.ready,()=>{this.addHandles([this.view.on("immediate-click",i=>this._clickHandler(i),O.TOOL),this.view.on("double-click",i=>this._doubleClickHandler(i),O.TOOL),this.view.on("pointer-down",i=>this._pointerDownHandler(i),O.TOOL),this.view.on("pointer-move",i=>this._pointerMoveHandler(i),O.TOOL),this.view.on("pointer-up",i=>this._pointerUpHandler(i),O.TOOL),this.view.on("drag",i=>this._dragHandler(i),O.TOOL),this.view.on("key-down",i=>this._keyDownHandler(i),O.TOOL)])},{once:!0,initial:!0}),s(()=>this.view,i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}),s(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this._defaultLayer.destroy(),this.reset()}get state(){const i=this.view.ready,t=this.graphics.length>0,e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick?.(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(x(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new m(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown?.(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new f(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp?.(r),this._hoverGraphic=this._activeGraphic}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(x(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new u(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut?.(h)}const r=this.graphics.indexOf(t),h=new w(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void this.callbacks.onGraphicPointerOver?.(h)}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new u(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut?.(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic?.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:s,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?s-this._dragEvent.x:0,a=this._dragEvent?r-this._dragEvent.y:0,n=s-i.origin.x,c=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,d=p(l,n,c,this.view);if(this._activeGraphic.geometry=d,this.enableMoveAllGraphics&&this.graphics.forEach(i=>{i!==this._activeGraphic&&(i.geometry=p(i.geometry,o,a,this.view))}),this._dragEvent=i,"start"===t){this._initialDragGeometry=e(l);const t=new G(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart?.(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new b(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove?.(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new k(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop?.(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i),e=this.graphics;this._syncLayerViews();const s=this._layerViews.flatMap(i=>"graphicsViews"in i?Array.from(i.graphicsViews(),i=>i.hitTest(t)).flat():i.graphicsView.hitTest(t)).filter(i=>e.includes(i)).sort((i,t)=>e.indexOf(i)-e.indexOf(t));return s.length?s[0]:null}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=v(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper.add(this.graphics,this.highlightName)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=E(i),this._indicators.push(t),this.addHandles(s(()=>i.symbol,()=>this._setUpIndicators()),H)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(H),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(i=>i.destroy()),this._indicators=[])}};function E(i){const t=12;if(null==i.symbol)return null;switch(i.symbol.type){case"cim":return new l({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new l({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new l({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new n({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new c({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new l({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}i([h()],M.prototype,"_activeGraphic",void 0),i([h({readOnly:!0})],M.prototype,"type",void 0),i([h()],M.prototype,"callbacks",void 0),i([h()],M.prototype,"enableMoveAllGraphics",void 0),i([h()],M.prototype,"graphics",void 0),i([h()],M.prototype,"highlightName",void 0),i([h()],M.prototype,"highlightsEnabled",void 0),i([h()],M.prototype,"indicatorsEnabled",void 0),i([h()],M.prototype,"_defaultLayer",void 0),i([h()],M.prototype,"layer",void 0),i([h({readOnly:!0})],M.prototype,"state",null),i([h()],M.prototype,"view",void 0),M=i([o("esri.views.draw.support.GraphicMover")],M);const U=M;export{U as default};
|
package/views/draw/types.d.ts
CHANGED
|
@@ -3,7 +3,11 @@ import type { SystemOrAreaUnit, SystemOrLengthUnit } from "../../../core/units.j
|
|
|
3
3
|
|
|
4
4
|
export interface UnitsProperties extends Partial<Pick<Units, "area" | "length" | "verticalLength">> {}
|
|
5
5
|
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Units used for displaying or interpreting values in the UI.
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
7
11
|
export default abstract class Units extends Accessor {
|
|
8
12
|
/**
|
|
9
13
|
* Area units.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type Graphic from "../../Graphic.js";
|
|
2
|
-
import type Collection from "../../core/Collection.js";
|
|
3
1
|
import type HighlightOptions from "../support/HighlightOptions.js";
|
|
4
2
|
import type { ResourceHandle } from "../../core/Handles.js";
|
|
5
3
|
import type { PixelData } from "../../layers/support/types.js";
|
|
4
|
+
import type { PixelHighlightTarget, HighlightTarget } from "../types.js";
|
|
6
5
|
import type { LayerViewHighlightOptions } from "./HighlightableLayerView.js";
|
|
7
6
|
import type { HighlightOptionsProperties } from "../support/HighlightOptions.js";
|
|
8
7
|
|
|
@@ -122,5 +121,5 @@ export abstract class ImageryLayerViewMixin {
|
|
|
122
121
|
* });
|
|
123
122
|
* });
|
|
124
123
|
*/
|
|
125
|
-
abstract highlight(target:
|
|
124
|
+
abstract highlight(target: HighlightTarget | PixelHighlightTarget, options?: LayerViewHighlightOptions): ResourceHandle;
|
|
126
125
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as r}from"../../../core/arrayUtils.js";import
|
|
5
|
+
import{isSome as r}from"../../../core/arrayUtils.js";import e from"../../../core/Collection.js";import{isGraphic as t}from"../../../support/guards.js";function o(o){if(!o)return[];let i=t(o)?[o]:e.isCollection(o)?o.toArray():Array.isArray(o)?o:[];return i=i?.filter(r),0===(i?.length??0)?[]:i}function i(r){return!!(r&&"object"==typeof r&&"pixelRanges"in r&&r.pixelRanges)}function n(r){return Array.isArray(r.pixelRanges)&&0===r.pixelRanges.length}export{o as getHighlightGraphics,n as isEmptyPixelRanges,i as isPixelHighlightTarget};
|