@arcgis/core 5.2.0-next.149 → 5.2.0-next.150

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.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Camera.js";import{clock as n}from"../../../../core/clock.js";import r from"../../../../core/Logger.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{onAbort as a}from"../../../../core/promiseUtils.js";import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{property as s,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{subtract as l,add as u,copy as d,cross as f,normalize as p,scale as m,dot as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../../../../geometry/Point.js";import{shortenTranslation as v}from"../../state/utils/groundNavigationUtils.js";import{OffsetCorrectionController as y}from"../../state/utils/OffsetCorrectionController.js";import b from"../../webgl/RenderCamera.js";import{InteractiveToolBase as x}from"../../../interactive/InteractiveToolBase.js";let S=class extends x{constructor(e){super(e),this.isGroundNavigationPlacementTool=!0,this._internalAbortController=new AbortController,this._tmpMouseDirection=g(),this._tmpWorldUp=g(),this._tmpHorizontalForward=g(),this._tmpTranslation=g(),this._tmpScratchVector=g(),this._hasErrorCursor=!1}initialize(){this.signal&&this.addHandles([a(this.signal,()=>{this.cancel(),this.active&&(this.view.activeTool=null)})]),this.finishToolCreation()}cancel(){super.cancel(),this._internalAbortController?.abort()}onDeactivate(){this.emit(`cancel`)}get cursor(){return this.active?this._hasErrorCursor?`not-allowed`:`crosshair`:null}async onInputEvent(e){if(!this.active||e.type!==`immediate-click`)return;e.stopPropagation();let n=this.view.state.camera,i=this.view.sceneIntersectionHelper,a=g();if(!i.intersectScreen(o(e.x,e.y),a)){r.getLogger(this).warn(`The clicked location did not produce a valid target. Try again by clicking in a different location.`),this._showErrorCursor();return}if(l(this._tmpTranslation,a,n.eye),v(this._tmpTranslation,this._tmpTranslation,.999,.5),u(a,n.eye,this._tmpTranslation),this.groundMode?.offset){let e=new b().copyFrom(n);e.eye=a,new y(this.view).immediatelyCorrectGroundElevation({camera:e,navigationModeOverride:this.groundMode}),d(a,e.eye)}let s=this.cameraTurningEnabled?this._computeHeadingOffset(n,a):0,c=this.view.renderCoordsHelper.fromRenderCoords(a,new _({spatialReference:this.view.spatialReference})),f=new t({position:c,heading:this.view.camera.heading+s,tilt:85});this.emit(`success`,f),this.view.activeTool=null}_computeHeadingOffset(e,t){let n=this.view.renderCoordsHelper.worldUpAtPosition(t,this._tmpWorldUp),r=f(this._tmpHorizontalForward,n,e.viewRight);l(this._tmpMouseDirection,t,e.eye),p(this._tmpMouseDirection,this._tmpMouseDirection),l(this._tmpMouseDirection,this._tmpMouseDirection,m(this._tmpScratchVector,n,h(n,this._tmpMouseDirection))),p(this._tmpMouseDirection,this._tmpMouseDirection);let a=f(g(),this._tmpMouseDirection,r),o=Math.sign(h(a,n)),s=Math.acos(h(this._tmpMouseDirection,r));return o*i(s)}_showErrorCursor(){this._hasErrorCursor=!0,this._errorTimeout?.remove(),this._errorTimeout=n.setTimeout(()=>{this._hasErrorCursor=!1,this._errorTimeout=void 0},500)}};e([s({constructOnly:!0})],S.prototype,`view`,void 0),e([s({constructOnly:!0})],S.prototype,`signal`,void 0),e([s({constructOnly:!0})],S.prototype,`cameraTurningEnabled`,void 0),e([s({constructOnly:!0})],S.prototype,`groundMode`,void 0),e([s()],S.prototype,`_hasErrorCursor`,void 0),e([s({readOnly:!0})],S.prototype,`cursor`,null),S=e([c(`esri.views.3d.interactive.placementTools.GroundNavigationPlacementTool3D`)],S);export{S as GroundNavigationPlacementTool3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Camera.js";import{clock as n}from"../../../../core/clock.js";import r from"../../../../core/Logger.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{removeMaybe as a}from"../../../../core/maybe.js";import{onAbort as o}from"../../../../core/promiseUtils.js";import{createScreenPointArray as s}from"../../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{subtract as u,add as d,copy as f,cross as p,normalize as m,scale as h,dot as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../geometry/Point.js";import{shortenTranslation as y}from"../../state/utils/groundNavigationUtils.js";import{OffsetCorrectionController as b}from"../../state/utils/OffsetCorrectionController.js";import x from"../../webgl/RenderCamera.js";import{InteractiveToolBase as S}from"../../../interactive/InteractiveToolBase.js";let C=class extends S{constructor(e){super(e),this.isGroundNavigationPlacementTool=!0,this._internalAbortController=new AbortController,this._tmpMouseDirection=_(),this._tmpWorldUp=_(),this._tmpHorizontalForward=_(),this._tmpTranslation=_(),this._tmpScratchVector=_(),this._hasErrorCursor=!1,this._errorTimeout=null}initialize(){this.signal&&this.addHandles([o(this.signal,()=>{this.cancel(),this.active&&(this.view.activeTool=null)})]),this.finishToolCreation()}cancel(){super.cancel(),this._internalAbortController?.abort()}onDeactivate(){this.emit(`cancel`)}get cursor(){return this.active?this._hasErrorCursor?`not-allowed`:`crosshair`:null}async onInputEvent(e){if(!this.active||e.type!==`immediate-click`)return;e.stopPropagation();let n=this.view.state.camera,i=this.view.sceneIntersectionHelper,a=_();if(!i.intersectScreen(s(e.x,e.y),a,{include:this.groundMode?.include,exclude:this.groundMode?.exclude})){r.getLogger(this).warn(`The clicked location did not produce a valid target. Try again by clicking in a different location.`),this._showErrorCursor();return}if(u(this._tmpTranslation,a,n.eye),y(this._tmpTranslation,this._tmpTranslation,.999,.5),d(a,n.eye,this._tmpTranslation),this.groundMode?.offset){let e=new x().copyFrom(n);e.eye=a,new b(this.view).immediatelyCorrectGroundElevation({camera:e,navigationModeOverride:this.groundMode}),f(a,e.eye)}let o=this.cameraTurningEnabled?this._computeHeadingOffset(n,a):0,c=this.view.renderCoordsHelper.fromRenderCoords(a,new v({spatialReference:this.view.spatialReference})),l=new t({position:c,heading:this.view.camera.heading+o,tilt:85});this.emit(`success`,l),this.view.activeTool=null}_computeHeadingOffset(e,t){let n=this.view.renderCoordsHelper.worldUpAtPosition(t,this._tmpWorldUp),r=p(this._tmpHorizontalForward,n,e.viewRight);u(this._tmpMouseDirection,t,e.eye),m(this._tmpMouseDirection,this._tmpMouseDirection),u(this._tmpMouseDirection,this._tmpMouseDirection,h(this._tmpScratchVector,n,g(n,this._tmpMouseDirection))),m(this._tmpMouseDirection,this._tmpMouseDirection);let a=p(_(),this._tmpMouseDirection,r),o=Math.sign(g(a,n)),s=Math.acos(g(this._tmpMouseDirection,r));return o*i(s)}_showErrorCursor(){this._hasErrorCursor=!0,this._errorTimeout=a(this._errorTimeout),this._errorTimeout=n.setTimeout(()=>{this._hasErrorCursor=!1,this._errorTimeout=null},500)}};e([c({constructOnly:!0})],C.prototype,`view`,void 0),e([c({constructOnly:!0})],C.prototype,`signal`,void 0),e([c({constructOnly:!0})],C.prototype,`cameraTurningEnabled`,void 0),e([c({constructOnly:!0})],C.prototype,`groundMode`,void 0),e([c()],C.prototype,`_hasErrorCursor`,void 0),e([c({readOnly:!0})],C.prototype,`cursor`,null),C=e([l(`esri.views.3d.interactive.placementTools.GroundNavigationPlacementTool3D`)],C);export{C as GroundNavigationPlacementTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as i,add as a,crossAndNormalize as o,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as d,length as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as h}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPositionAndNormal as _,distance as v,projectPoint as y,projectVector as b,intersectLineSegment as x}from"../../../../geometry/support/plane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as w}from"../../webgl.js";import{getVoxelWasm as T}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ee}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as A}from"../../webgl-engine/lib/Intersector.js";const j=1.5,M={xSpeedMultiplier:j,ySpeedMultiplier:j,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},N=p(),P=p(),re=t(),F=p(),I=g(),L=p(),R=p(),z=p(),B=p(),V=p(),ie=p(),H=p(),U=p(),W=p(),G=p(),K=t(),q=S(),J=new C,Y=p(),ae=g(),X=p(),oe=p();function se(e,t){return b(t,e.viewForward,N),a(P,e.eye,N),e.projectToScreen(P,re),re[1]}function ce(e,t,d){let f=e.eye;if(n(t.center,f)<t.radius)return r(V,f),i(ie,V,e.viewRight),a(P,f,ie),e.projectToScreen(P,K),K[1];let p=e.up;te(e,d,q);let m=t.radius;if(o(F,p,q.direction),_(f,F,I),v(I,t.center)>m)return null;y(I,t.center,L);let h=n(t.center,L),g=Math.sqrt(m**2-h**2);s(R,f,L),r(z,R),o(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),C=Math.sqrt(S**2-g**2),w=g**2/S**2,T=g/S**2*C,E=w*b,D=T*-x,O=w*x,k=T*b,ee=E+D,ne=E-D,A=O+k,j=O-k;return a(H,L,l(H,u(H,z,ee),B,A)),a(U,L,l(U,u(U,z,ne),B,j)),s(W,H,f),r(W,W),s(G,U,f),r(G,G),c(e.viewForward,W)>=c(e.viewForward,G)?e.projectToScreen(H,K):e.projectToScreen(U,K),K[1]}function le(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function ue(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(M.minimumHorizonPadding,M.relativeHorizonPadding*r)}function de(e,t){return[fe(e,t),pe(e,t)]}function fe(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function pe(e,t){return Math.max(0,t-Q(e,t))}function me(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function he(e){let{view:t}=e;return t.viewingMode===`global`?ge(e):_e(e)}function ge(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:f}=e,p=t.state.camera,h=me(s,c,l);J.radius=m(t.spatialReference).radius;let g=E(t,p,i,J.radius,1,u);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;d(Y,g.scenePickPoint),d(h.location,Y);let v=g.sphere;h.normal&&g.normal&&d(h.normal,g.normal);let y=ye(i,a,o,_),b=_?n(Y,p.eye):1/0;return y.wasAdjusted&&be({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let i=D(v,p,e,t);return i&&n&&r(n,t),i},output:h,intersectionOptions:u}),Se({view:t,screenPoint:y.adjustedScreenPoint,camera:p,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function _e(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,g=$(t),v=me(s,c,u);m.intersectIntersectorScreen(i,g,f);let y=g.results.min.getIntersectionPoint(Y),b=y?n(Y,h.eye):1/0;y&&(d(v.location,Y),v.normal&&d(v.normal,g.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),_(X,V,ae);let x=ye(i,a,o,y);return x.wasAdjusted&&be({view:t,screenAdjustment:x,intersector:g,fallbackCheck:(e,t,n)=>{let i=O(ae,h,e,t);return i&&n&&r(n,V),i},output:v,intersectionOptions:f}),Se({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function ve(e,t,n,r){return!r&&le(e,t)||r&&ue(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ye(e,n,r,i){let a=ve(e[1],n,r,i);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],a??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new A(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function be(e){let{view:t,screenAdjustment:n,fallbackCheck:r,intersector:i,output:a,intersectionOptions:o}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,i,{...o,requiresGroundFeedback:!0});let c=i.results.min.getIntersectionPoint(a.location);if(c){a.normal&&d(a.normal,i.results.min.normal);return}let l=xe(n);if(s.intersectIntersectorScreen(l,i,{...o,requiresGroundFeedback:!0}),c=i.results.min.getIntersectionPoint(a.location),c){a.normal&&d(a.normal,i.results.min.normal);return}c=r(n.adjustedScreenPoint,a.location,a.normal),!c&&r(l,a.location,a.normal)}function xe(e){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=e,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return t(r[0],o)}function Se(e){Ce(e),we(e)}function Ce(e){let{view:t,camera:n,output:r}=e,{offset:i}=t.navigation.mode;if(!i)return;let{translation:a,location:o}=r;t.renderCoordsHelper.worldUpAtPosition(n.eye,V),l(X,n.eye,V,-i),_(X,V,I),x(I,h(n.eye,s(N,o,n.eye)),X)&&(d(o,X),s(a,o,n.eye))}function we(e){let{view:t,screenPoint:n,camera:i,initialDistance:o,depthSearchSize:c,output:l}=e,d=c>0?t.stage.renderView.getMinimalDepthForArea(T(t),n[0],n[1],i,c):null;s(l.translation,l.location,i.eye);let p=Math.min(f(l.translation),o);d&&d<=p&&(p=d),r(l.translation,l.translation),u(l.translation,l.translation,p),a(l.location,l.translation,i.eye)}async function Te(t,r){if(t.navigation.mode.type!==`ground`){e.getLogger(`esri`).warn(`Can only advance while in ground navigation mode!`);return}let{camera:i}=t.state;t.renderCoordsHelper.worldUpAtPosition(i.eye,V);let c=t.sceneIntersectionHelper,l=$(t),p=o(N,V,i.viewRight);d(q.origin,i.eye),u(q.direction,p,r);let m=c.intersectRay(q,l,Y),h=new ne().copyFrom(i),g=s(oe,i.center,i.eye);return!m||n(Y,i.eye)>r?h.eye=a(N,q.origin,q.direction):(s(N,Y,i.eye),f(N)>2&&(Ee(N,N,.25,2),h.eye=a(N,i.eye,N))),h.center=a(N,h.eye,g),new ee(t).immediatelyCorrectGroundElevation({camera:h,correctionLimit:100}),t.goTo(w(t,h),{duration:500,liftOffDisabled:!0})}function Ee(e,t,n,r){let i=f(e),a=Math.min(n,Math.max(i-r,0)/i);u(t,e,a)}export{Q as computeHorizonPadding,de as computeHorizonPaddingLimits,he as findGroundNavigationGrabLocation,se as findPlaneHorizonY,ce as findSphereHorizonY,Te as groundNavigationAdvance,M as groundNavigationConstants,le as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,ue as shouldClampScreenY};
2
+ import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as i,add as a,crossAndNormalize as o,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as d,length as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as h}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPositionAndNormal as _,distance as v,projectPoint as y,projectVector as b,intersectLineSegment as x}from"../../../../geometry/support/plane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as w}from"../../webgl.js";import{getVoxelWasm as T}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ee}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as A}from"../../webgl-engine/lib/Intersector.js";const j=1.5,M={xSpeedMultiplier:j,ySpeedMultiplier:j,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},N=p(),P=p(),re=t(),F=p(),I=g(),L=p(),R=p(),z=p(),B=p(),V=p(),ie=p(),H=p(),U=p(),W=p(),G=p(),K=t(),q=S(),J=new C,Y=p(),ae=g(),X=p(),oe=p();function se(e,t){return b(t,e.viewForward,N),a(P,e.eye,N),e.projectToScreen(P,re),re[1]}function ce(e,t,d){let f=e.eye;if(n(t.center,f)<t.radius)return r(V,f),i(ie,V,e.viewRight),a(P,f,ie),e.projectToScreen(P,K),K[1];let p=e.up;te(e,d,q);let m=t.radius;if(o(F,p,q.direction),_(f,F,I),v(I,t.center)>m)return null;y(I,t.center,L);let h=n(t.center,L),g=Math.sqrt(m**2-h**2);s(R,f,L),r(z,R),o(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),C=Math.sqrt(S**2-g**2),w=g**2/S**2,T=g/S**2*C,E=w*b,D=T*-x,O=w*x,k=T*b,ee=E+D,ne=E-D,A=O+k,j=O-k;return a(H,L,l(H,u(H,z,ee),B,A)),a(U,L,l(U,u(U,z,ne),B,j)),s(W,H,f),r(W,W),s(G,U,f),r(G,G),c(e.viewForward,W)>=c(e.viewForward,G)?e.projectToScreen(H,K):e.projectToScreen(U,K),K[1]}function le(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function ue(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(M.minimumHorizonPadding,M.relativeHorizonPadding*r)}function de(e,t){return[fe(e,t),pe(e,t)]}function fe(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function pe(e,t){return Math.max(0,t-Q(e,t))}function me(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function he(e){let{view:t}=e;return t.viewingMode===`global`?ge(e):_e(e)}function ge(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:f}=e,p=t.state.camera,h=me(s,c,l);J.radius=m(t.spatialReference).radius;let g=E(t,p,i,J.radius,1,u);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;d(Y,g.scenePickPoint),d(h.location,Y);let v=g.sphere;h.normal&&g.normal&&d(h.normal,g.normal);let y=ye(i,a,o,_),b=_?n(Y,p.eye):1/0;return y.wasAdjusted&&be({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let i=D(v,p,e,t);return i&&n&&r(n,t),i},output:h,intersectionOptions:u}),Se({view:t,screenPoint:y.adjustedScreenPoint,camera:p,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function _e(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,g=$(t),v=me(s,c,u);m.intersectIntersectorScreen(i,g,f);let y=g.results.min.getIntersectionPoint(Y),b=y?n(Y,h.eye):1/0;y&&(d(v.location,Y),v.normal&&d(v.normal,g.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),_(X,V,ae);let x=ye(i,a,o,y);return x.wasAdjusted&&be({view:t,screenAdjustment:x,intersector:g,fallbackCheck:(e,t,n)=>{let i=O(ae,h,e,t);return i&&n&&r(n,V),i},output:v,intersectionOptions:f}),Se({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function ve(e,t,n,r){return!r&&le(e,t)||r&&ue(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ye(e,n,r,i){let a=ve(e[1],n,r,i);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],a??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new A(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function be(e){let{view:t,screenAdjustment:n,fallbackCheck:r,intersector:i,output:a,intersectionOptions:o}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,i,{...o,requiresGroundFeedback:!0});let c=i.results.min.getIntersectionPoint(a.location);if(c){a.normal&&d(a.normal,i.results.min.normal);return}let l=xe(n);if(s.intersectIntersectorScreen(l,i,{...o,requiresGroundFeedback:!0}),c=i.results.min.getIntersectionPoint(a.location),c){a.normal&&d(a.normal,i.results.min.normal);return}c=r(n.adjustedScreenPoint,a.location,a.normal),!c&&r(l,a.location,a.normal)}function xe(e){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=e,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return t(r[0],o)}function Se(e){Ce(e),we(e)}function Ce(e){let{view:t,camera:n,output:r}=e,{offset:i}=t.navigation.mode;if(!i)return;let{translation:a,location:o}=r;t.renderCoordsHelper.worldUpAtPosition(n.eye,V),l(X,n.eye,V,-i),_(X,V,I),x(I,h(n.eye,s(N,o,n.eye)),X)&&(d(o,X),s(a,o,n.eye))}function we(e){let{view:t,screenPoint:n,camera:i,initialDistance:o,depthSearchSize:c,output:l}=e,d=c>0?t.stage.renderView.getMinimalDepthForArea(T(t),n[0],n[1],i,c):null;s(l.translation,l.location,i.eye);let p=Math.min(f(l.translation),o);d&&d<=p&&(p=d),r(l.translation,l.translation),u(l.translation,l.translation,p),a(l.location,l.translation,i.eye)}async function Te(t,r){let i=t.navigation.mode;if(i.type!==`ground`){e.getLogger(`esri`).warn(`Can only advance while in ground navigation mode!`);return}let{camera:c}=t.state;t.renderCoordsHelper.worldUpAtPosition(c.eye,V);let l=t.sceneIntersectionHelper,p=$(t),m=o(N,V,c.viewRight);d(q.origin,c.eye),u(q.direction,m,r);let h=l.intersectRay(q,p,Y,{include:i.include,exclude:i.exclude}),g=new ne().copyFrom(c),_=s(oe,c.center,c.eye);return!h||n(Y,c.eye)>r?g.eye=a(N,q.origin,q.direction):(s(N,Y,c.eye),f(N)>2&&(Ee(N,N,.25,2),g.eye=a(N,c.eye,N))),g.center=a(N,g.eye,_),new ee(t).immediatelyCorrectGroundElevation({camera:g,correctionLimit:100}),t.goTo(w(t,g),{duration:500,liftOffDisabled:!0})}function Ee(e,t,n,r){let i=f(e),a=Math.min(n,Math.max(i-r,0)/i);u(t,e,a)}export{Q as computeHorizonPadding,de as computeHorizonPaddingLimits,he as findGroundNavigationGrabLocation,se as findPlaneHorizonY,ce as findSphereHorizonY,Te as groundNavigationAdvance,M as groundNavigationConstants,le as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,ue as shouldClampScreenY};
package/views/View2D.d.ts CHANGED
@@ -896,31 +896,31 @@ export default abstract class View2D extends View2DSuperclass {
896
896
  */
897
897
  goTo(target: GoToTarget2D, options?: GoToOptions2D): Promise<void>;
898
898
  /**
899
- * Returns [hit test results](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHitTestResult) from each layer that intersects the specified screen point or screen rectangle.
900
- * The results are organized as an array of objects containing different [result types](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHit) such as graphics, raster pixels, media elements, or routes.
899
+ * Returns [hit test results](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHitTestResult) from each layer that intersects the specified hit target.
900
+ * The returned object contains an array of different [result types](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHit) such as
901
+ * graphics, raster pixels, media elements, or routes.
901
902
  *
902
903
  * **2D hitTest() behavior by layer type**
903
904
  * | Layer type | Hit test behavior |
904
905
  * | :--- | :--- |
905
- * | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [CatalogFootprintLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/catalog/CatalogFootprintLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/), [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/), [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/), [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/), [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/) | Returns all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) at the hit location. |
906
- * | [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [MapNotesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/), [SketchLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SketchLayer/) | Returns all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) at the hit location. |
907
- * | [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/), [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/)| Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RasterHit) containing raster pixel value used in rendering and bandId info on intersecting pixels. Support was added in version 5.1. The `screenRect` hitTarget returns hit result at the center of the rectangle. |
906
+ * | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [CatalogFootprintLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/catalog/CatalogFootprintLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/), [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/), [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/), [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/), [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/) | Returns all [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) that intersect the hit target. |
907
+ * | [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [SketchLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SketchLayer/) | Returns all [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) that intersect the hit target. |
908
+ * | [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/), [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/)| Returns a [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RasterHit) containing raster pixel value used in rendering and bandId info on intersecting pixels. Support was added in version 5.1. For a `ScreenRect` hit target, the hit result is returned for the center of the specified shape. |
908
909
  * | [VectorTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/) | Returns a result for all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) containing attributes of style layers (as of version 4.29; in prior releases, only the topmost style layer result was returned). In addition, the graphic's [origin](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#origin) contains the style layer's [id](https://maplibre.org/maplibre-style-spec/layers/#id) and layer index within the [vector tile style](https://doc.arcgis.com/en/arcgis-online/reference/tile-layers.htm#ESRI_SECTION1_8F68399EB47B48FF9EF46719FCC96978). Spatial information about the actual feature represented in the style layer is returned only if the style layer is a [symbol layer](https://maplibre.org/maplibre-style-spec/layers/#symbol). Otherwise, the graphic's geometry is `null`. |
909
- * | [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) | Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#MediaHit) containing all media elements if the hit is made on intersecting elements. |
910
- * | [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/) | Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RouteHit) containing all intersecting route elements if the hit is made on intersecting elements. |
910
+ * | [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) | Returns a [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#MediaHit) for each media element that intersects the hit target. |
911
+ * | [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/) | Returns a [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RouteHit) for each route element that intersects the hit target. |
911
912
  *
912
913
  * **Note:** If the [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) feature's symbol [style](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleFillSymbol/#style) is set to "none", the hitTest method will not
913
914
  * return results when the fill is clicked. However, it will return results when the outline is clicked. To get results when clicking the fill, set the
914
915
  * [SimpleFillSymbol.color](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleFillSymbol/#color) to a transparent color instead.
915
916
  *
916
917
  * Release-specific changes:
917
- * * At version 5.1, **[beta](https://developers.arcgis.com/javascript/latest/faq/#what-does-the-beta-tag-mean)** support was added for [ScreenRect](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenRect), allowing hit tests across rectangular screen areas.
918
- * * At version 4.24, [ViewHitTestResult](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHitTestResult) returns an array of objects containing [graphic](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit), [media element](https://developers.arcgis.com/javascript/latest/references/core/views/types/#MediaHit), and [route](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RouteHit).
919
- * * At version 4.23, all hit test features from feature layers are returned in the result. In prior releases, only the top most feature was returned.
918
+ * * At version 5.2, support for [ScreenPolygon](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenPolygon) hit targets was added.
919
+ * * At version 5.1, support for [ScreenRect](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenRect) hit targets was added.
920
920
  *
921
- * @param hitTarget - The screen point, screen rectangle, or native mouse event identifying where to perform the hit test.
922
- * @param options - Options to specify what is included in or excluded from the hitTest. Supported since 4.16.
923
- * @returns When resolved, returns an array of objects containing different [result types](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHit).
921
+ * @param hitTarget - The screen point, screen rectangle, screen polygon, or native mouse event identifying where to perform the hit test.
922
+ * @param options - Options to specify what is included in or excluded from the hitTest.
923
+ * @returns When resolved, returns an object containing an array of [hit test results](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHit).
924
924
  * @see [Sample - Access features with hitTest](https://developers.arcgis.com/javascript/latest/sample-code/map-component-hittest/)
925
925
  * @see [Sample - Hit test features by screen rectangle](https://developers.arcgis.com/javascript/latest/sample-code/map-hittest-screen-rectangle/)
926
926
  * @see [Sample - VectorTileLayer hitTest](https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer-hittest/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{memoize as r}from"../../../core/memoize.js";import{ignoreAbortErrors as i}from"../../../core/promiseUtils.js";import{valueInUnit as a}from"../../../core/quantity.js";import{createScreenPoint as o}from"../../../core/screenUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromArray as l,create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import f from"../../../geometry/Point.js";import{pointEquals as p}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as m}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as h}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as g,getPointConstraint as _,pointToConstraintSpace as v,constraintSpaceToPoint as y}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as b}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as x}from"../../interactive/snapping/SnappingOperation.js";let S=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=r((e,t,n,r,i,a)=>n?new b({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&p(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:a,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,a?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let h=this.firstPointZ,g=a?.screenToMap(d,{firstPointZ:h});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=m(g.x,g.y,g.z,g?.spatialReference),v=a?.screenToScene?.(d,{firstPointZ:h}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return p(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new f({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),i(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let s=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!s)return null;let c=o(s.x+e,s.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:a,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,a?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,p=a?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&p){let o=u.snap({point:m(p.x,p.y,p.z,p?.spatialReference),scenePoint:a?.screenToScene?.(e,{firstPointZ:d})},r,l);return i(o.then(()=>{let e=u.stagedPoint?new f({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,p,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=p,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=d(u(),l(s)),[f,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(f,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=h(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,o=t.editGeometryOperations?.data?.coordinateHelper;if(!o)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&o.vectorToPoint(s.pos),u=c&&o.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?g(l,u,r):_(r);if(!n||!r||!d)return n;let{context:p}=r,m=v(n,p),h=m?d.closestTo(m):void 0;if(!h)return n;let b=y(h,n,p),x=t.surfaceManager?.view?.type===`2d`||p.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return b!=null&&x&&S!=null&&C&&w&&(b.z=a(S,`meters`)/w),b?new f({x:b.x,y:b.y,z:b.z,hasM:b.hasM,hasZ:b.hasZ,m:b.m,spatialReference:b.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||(e.z==null||!e.hasZ)&&(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new x({view:e})}};e([s()],S.prototype,`_snappingOperation`,void 0),e([s()],S.prototype,`role`,void 0),e([s()],S.prototype,`name`,void 0),e([s()],S.prototype,`captureMode`,void 0),e([s()],S.prototype,`defaultCaptureMode`,void 0),e([s()],S.prototype,`grabbable`,null),e([s()],S.prototype,`following`,null),e([s()],S.prototype,`snappingEnabled`,void 0),e([s()],S.prototype,`selfSnappingEnabled`,void 0),e([s()],S.prototype,`editSession`,void 0),e([s()],S.prototype,`outputMapPosition`,null),e([s()],S.prototype,`outputMapPositionOfDragStart`,void 0),e([s()],S.prototype,`selectedSnappingResult`,void 0),e([s()],S.prototype,`screenPosition`,void 0),e([s()],S.prototype,`inputMapPosition`,void 0),e([s()],S.prototype,`dragging`,null),e([s()],S.prototype,`drawToolDragging`,void 0),e([s()],S.prototype,`manipulatorDragging`,void 0),e([s()],S.prototype,`activePointerId`,void 0),e([s()],S.prototype,`activePointerType`,void 0),e([s({readOnly:!0})],S.prototype,`firstPointZ`,null),S=e([c(`esri.views.draw.support.InteractiveHandle`)],S);export{S as InteractiveHandle};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||(e.z==null||!e.hasZ)&&(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
package/views/types.d.ts CHANGED
@@ -784,6 +784,8 @@ export type HitTestOptionsItem = HitTestItem | Iterable<HitTestItem | Iterable<H
784
784
  * Options for specifying which [HitTestItem](https://developers.arcgis.com/javascript/latest/references/core/views/types/#HitTestItem) are included or excluded when calling the MapView’s [hitTest](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest) method.
785
785
  *
786
786
  * @since 5.0
787
+ * @see [MapView.hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest)
788
+ * @see [Map component hitTest](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/#hitTest)
787
789
  */
788
790
  export interface HitTestOptions {
789
791
  /**
@@ -801,7 +803,7 @@ export interface HitTestOptions {
801
803
  */
802
804
  exclude?: HitTestOptionsItem | null;
803
805
  /**
804
- * Exclude labels from intersection testing.
806
+ * Indicates whether labels are included in or excluded from hit results.
805
807
  *
806
808
  * @since 5.2
807
809
  */