@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 4.19 kB
JavaScript
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{isSome as s}from"../../../../../core/maybe.js";import{createScreenPointArray as r}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/Error.js";import"../../../../../core/has.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as a,d as o}from"../../../../../chunks/vec2.js";import{a as n}from"../../../../../chunks/vec2f64.js";import{b as m,l as c,n as h,e as p,g as _,a as l,o as u,c as C,h as P}from"../../../../../chunks/vec3.js";import{c as D,f}from"../../../../../chunks/vec3f64.js";import{create as j,fromPositionAndNormal as y}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as g,applyAll as v}from"../../../camera/constraintUtils.js";import{ConstraintTypes as d}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as M}from"../../../camera/constraintUtils/InteractionType.js";import{TiltMode as w}from"../../../camera/constraintUtils/TiltMode.js";import{InteractiveController as O}from"../InteractiveController.js";import{normalizeCoordinate as b,contentIntersectorOptions as U,DISTANCE_CLAMP_VALUES as N,PIVOT_DISTANCE_MODIFIER as R,SCREEN_PIXEL_AREA as k,intersectPlaneFromScreenPoint as A}from"../../utils/navigationUtils.js";let T=class extends O{constructor(){super(...arguments),this._tmpP=D(),this._tmpDir=D(),this._tmpN=D(),this._tmpP0=n(),this._tmpPoi=D(),this._tmpRayDir=D(),this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions={selection:d.ALL,interactionType:M.ZOOM,interactionFactor:0,interactionStartCamera:null,interactionDirection:D(),tiltMode:w.TUMBLE},this._plane=j()}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;a(this.dragBeginPoint,t),b(this.startCamera,t,this._normalizedAnchorPoint);const r=this._intersectionHelper.intersectScreenFreePointFallback(t,this._tmpP,0===this.view.map.ground.opacity?U:{});m(this._tmpDir,this._tmpP,this.startCamera.eye);const e=c(this._tmpDir);h(this._tmpDir,this._tmpDir);const o=Math.abs(this.view.camera.position.z);let n=i(Math.min(R,1/Math.abs(p(B,this._tmpDir)))*o,N[0],N[1]);const C=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,t[0],t[1],this.view.state.camera,k);n=s(C)?C:n,n=r?Math.min(n,e):n,_(this._tmpDir,this._tmpDir,n),l(this._tmpP,this.startCamera.eye,this._tmpDir),m(this._tmpN,this.startCamera.eye,this.startCamera.center),h(this._tmpN,this._tmpN),this._tmpN[1]<0&&u(this._tmpN,this._tmpN),y(this._tmpP,this._tmpN,this._plane),this._constraintOptions.interactionStartCamera=this.startCamera}update(t){if(!this.active)return;A(this._plane,this.currentCamera,this.dragBeginPoint,this._tmpPoi)||C(this._tmpPoi,this.currentCamera.center),b(this.currentCamera,t,this._tmpP0);let i=4*(this._tmpP0[1]-this._normalizedAnchorPoint[1]);a(this._normalizedAnchorPoint,this._tmpP0),m(this._tmpRayDir,this._tmpPoi,this.currentCamera.eye);const s=c(this._tmpRayDir);let r=s*(1-i);this._constraintOptions.interactionDirection&&(C(this._constraintOptions.interactionDirection,this._tmpRayDir),_(this._constraintOptions.interactionDirection,this._constraintOptions.interactionDirection,Math.sign(i)/s));const e=this.view.state.constraints.minimumPoiDistance;i>=0&&r<e&&(r=e,i=-(r-s)/s),Math.abs(s-r)<1e-6||(_(this._tmpRayDir,this._tmpRayDir,i),this.currentCamera.eye=l(z,this.currentCamera.eye,this._tmpRayDir),P(z,this.currentCamera.center,this._tmpPoi,i),this._tmpPoi[2]>this.startCamera.center[2]?z[2]=Math.max(this.startCamera.center[2],z[2]):z[2]=Math.min(this.startCamera.center[2],z[2]),this.currentCamera.center=z,this._constraintOptions.interactionFactor=g(o(this.dragBeginPoint,t)),v(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}end(){this.active&&this.finishController()}};T=t([e("esri.views.3d.state.controllers.local.ZoomController")],T);const z=D(),B=f(0,0,1);export{T as ZoomController};