@arcgis/core 4.33.0-next.20250313 → 4.33.0-next.20250315
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/065ae931b5891847a06f.js +1 -0
- package/assets/esri/core/workers/chunks/{08bfceab05b5ea02bb4e.js → 23aa7254fffe67e3f1bc.js} +3 -3
- package/assets/esri/core/workers/chunks/29ba2022c2978e9bd53e.js +1 -0
- package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +1 -0
- package/assets/esri/core/workers/chunks/7ded83eb64eff069b761.js +1 -0
- package/assets/esri/core/workers/chunks/a7a1832274892e99c388.js +1 -0
- package/assets/esri/core/workers/chunks/{6388fdacb434a266b039.js → c43c273725b1a33712ec.js} +5 -5
- package/chunks/FocusAreaMask.glsl.js +2 -1
- package/interfaces.d.ts +4 -327
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +5 -0
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/ImagerySubView3D.js +5 -0
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWasm.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SubView3D.js +5 -0
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/WMSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/SceneViewPerformanceInfo.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/checkWebGLError.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/025f8b72d7d8b5cccb0f.js +0 -1
- package/assets/esri/core/workers/chunks/0e5c77d043ed4641556f.js +0 -1
- package/assets/esri/core/workers/chunks/10fc47b441ae49ef4db8.js +0 -1
- package/assets/esri/core/workers/chunks/4908b36ef448bfe1f448.js +0 -1
- package/assets/esri/core/workers/chunks/fe6e7ac83cd2293d576e.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import _ from"../../../geometry/Extent.js";import y from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as E,toExtent as A,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return E(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=A(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view._stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?._stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof _){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:y})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:_})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import _ from"../../../geometry/Extent.js";import y from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as E,toExtent as A,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return E(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=A(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof _){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:y})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:_})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import r from"../../../../Camera.js";import{deg2rad as i,rad2deg as s,clamp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as h,h as l,c as m,j as c}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as _,applyAll as u}from"../../camera/constraintUtils.js";import{ConstraintOptions as p}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as f}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as d}from"../../camera/constraintUtils/InteractionType.js";import{InteractiveController as w}from"./InteractiveController.js";import{screenPixelArea as y}from"../utils/navigationUtils.js";import g from"../../../ui/Component.js";import{FovOverlay as S}from"../../../../widgets/FovOverlay.js";let j=class extends w{constructor(t){super(t),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(C),this.updateTimeout()},this._center=v(),this._viewForward=v(),this._constraints=new p(f.ALL,d.ZOOM)}begin(t){D(t)?this._showOverlay().fov=t.fov:(this._lastDrag=t[1],this._startSize=null,this._ensureStartSize(this.view.state.camera))}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(t){if(null==this._lastDrag)return this._lastDrag=t[1],this._startSize=null,void this._ensureStartSize(this.view.state.camera);const r=-(this._lastDrag-t[1])/2;this._lastDrag=t[1],this.step(r)}step(t){if(!this.running)return void(this._startSize=this._lastDrag=null);const r=this.view.state,o=this.currentCamera.copyFrom(r.camera),a=s(o.fov)+t,n=i(e(a,O,F));n!==o.fov?this._setFov(n):this._showOverlay().fov=o.fov}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(t){super.onControllerEnd(t),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new g({id:"esri.FovOverlay",node:new S({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&(this.view.ui.remove(this._overlay),this._overlay=o(this._overlay))}_setFov(t){const r=this.view.state,i=this.currentCamera.copyFrom(r.camera),s=this._ensureStartSize(i)/Math.tan(t/2),e=h(z,this._center,l(z,this._viewForward,-s));i.eye=e,i.fov=t,this._constraints.interactionStartCamera=r.camera,this._constraints.interactionFactor=_(this.currentCamera.height-r.camera.height),u(this.view,this.currentCamera,this._constraints),this.begin(i),this.commitCamera()}_ensureStartSize(t){if(null==this._startSize){m(this._viewForward,t.viewForward);const r=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import r from"../../../../Camera.js";import{deg2rad as i,rad2deg as s,clamp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as h,h as l,c as m,j as c}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as _,applyAll as u}from"../../camera/constraintUtils.js";import{ConstraintOptions as p}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as f}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as d}from"../../camera/constraintUtils/InteractionType.js";import{InteractiveController as w}from"./InteractiveController.js";import{screenPixelArea as y}from"../utils/navigationUtils.js";import g from"../../../ui/Component.js";import{FovOverlay as S}from"../../../../widgets/FovOverlay.js";let j=class extends w{constructor(t){super(t),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(C),this.updateTimeout()},this._center=v(),this._viewForward=v(),this._constraints=new p(f.ALL,d.ZOOM)}begin(t){D(t)?this._showOverlay().fov=t.fov:(this._lastDrag=t[1],this._startSize=null,this._ensureStartSize(this.view.state.camera))}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(t){if(null==this._lastDrag)return this._lastDrag=t[1],this._startSize=null,void this._ensureStartSize(this.view.state.camera);const r=-(this._lastDrag-t[1])/2;this._lastDrag=t[1],this.step(r)}step(t){if(!this.running)return void(this._startSize=this._lastDrag=null);const r=this.view.state,o=this.currentCamera.copyFrom(r.camera),a=s(o.fov)+t,n=i(e(a,O,F));n!==o.fov?this._setFov(n):this._showOverlay().fov=o.fov}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(t){super.onControllerEnd(t),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new g({id:"esri.FovOverlay",node:new S({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&(this.view.ui.remove(this._overlay),this._overlay=o(this._overlay))}_setFov(t){const r=this.view.state,i=this.currentCamera.copyFrom(r.camera),s=this._ensureStartSize(i)/Math.tan(t/2),e=h(z,this._center,l(z,this._viewForward,-s));i.eye=e,i.fov=t,this._constraints.interactionStartCamera=r.camera,this._constraints.interactionFactor=_(this.currentCamera.height-r.camera.height),u(this.view,this.currentCamera,this._constraints),this.begin(i),this.commitCamera()}_ensureStartSize(t){if(null==this._startSize){m(this._viewForward,t.viewForward);const r=this.view.stage.renderView.getMinimalDepthForArea(null,t.fullWidth/t.pixelRatio*.5,t.fullHeight/t.pixelRatio*.5,t,y),i=c(t.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),s=r??i;h(this._center,t.eye,l(z,this._viewForward,s)),this._startSize=s*Math.tan(t.fov/2)}return this._startSize}};t([a()],j.prototype,"onStop",void 0),j=t([n("esri.views.3d.state.controllers.FovController")],j);const C=i((new r).fov),O=10,F=150,z=v();function D(t){return!Array.isArray(t)}export{j as FovController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,v as c,l as _,d as p,n as l,g as u,h as d,f as g}from"../../../../chunks/vec32.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as M,fromPositionAndNormal as w,getNormal as S}from"../../../../geometry/support/plane.js";import{c as b,a as f}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as j,applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as y}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as A}from"../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as R}from"../../input/util.js";import{InteractiveController as z}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as H}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as T}from"./momentum/ZoomSphericalMomentumController.js";import{NavigationMode as U,pickPointAndInitSphere as D,contentIntersectorOptions as G,SpherePickPointFallback as I,navigationMode as L,sphereOrPlanePointFromScreenPoint as Z,panDistanceModifier as N,minHeightLimit as B,screenPixelArea as V,intersectPlaneFromScreenPointAtEye as q,applyZoomOnSphere as J,shouldPreserveHeading as K,applyPanSphericalPreserveHeading as Q,applyPanSphericalDirectRotation as W,normalizeRotationDelta as X,applyRotation as Y,applyPanPlanar as $,applyZoomToPoint as tt}from"../utils/navigationUtils.js";import it from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as et}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as ot}from"../../../navigation/ZoomMomentumEstimator.js";let rt=class extends z{constructor(){super(...arguments),this._smoothRotation=new R(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=M(),this._beginRadius=0,this._smoothScaling=new R(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new ot,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=b(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navMode=U.Horizontal,this._sphere=b(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new it,this._constraintOptions=new O(y.ALL,A.NONE,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=v(this.view.spatialReference),o=D(this._intersectionHelper,this.startCamera,this._screenPickPoint,n,I.Silhouette,0===this.view.map.ground.opacity?G:{});null!=o.scenePickPoint&&(this._scenePickPoint=o.scenePickPoint,this._sphere=o.sphere,h(this._beginScenePoint,this._scenePickPoint),this._navMode=L(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),this._navMode===U.Vertical&&this._preparePlanarPanMode(t,o.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;this._navMode===U.Horizontal?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._navMode===U.Horizontal?new T({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new H({view:this.view,momentum:e,center:f(this._sphere),axis:this._rotationAxis});if(this._navMode===U.Horizontal){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);w(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],Z(this._adjustedSphere,this.startCamera,r,a);const v=o();this.startCamera.projectToRenderScreen(a,v);const C=P(),M=P(),b=P();p(C,this._scenePickPoint,this.currentCamera.eye);const f=_(C);l(C,C);const j=N*Math.max(Math.abs(this.view.camera.position.z),B),E=this.view._stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,V);let O=null!=E?E:j;O=i?Math.min(O,f):O,h(b,u(M,this.currentCamera.eye,d(M,C,O))),this._panningPlane[3]=-g(S(this._panningPlane),b),this.startCamera.center=u(M,this.startCamera.eye,d(M,this.startCamera.viewForward,O));const y=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.startCamera,y,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),J(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);Z(this._sphere,this.currentCamera,i,this._tmp3d),K(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(Q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(W(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._screenPickPoint,i)),E(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+X(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),C(this._rotationAxis,s)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*e),E(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.currentCamera,i,this._tmp3d)&&($(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),E(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),tt(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=X(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),C(this._rotationAxis,o)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*o),E(this.view,this.currentCamera,this._constraintOptions)}};rt=t([r("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],rt);export{rt as PinchAndPanControllerGlobal};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,v as c,l as _,d as p,n as l,g as u,h as d,f as g}from"../../../../chunks/vec32.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as M,fromPositionAndNormal as w,getNormal as S}from"../../../../geometry/support/plane.js";import{c as b,a as f}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as j,applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as y}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as A}from"../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as R}from"../../input/util.js";import{InteractiveController as z}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as H}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as T}from"./momentum/ZoomSphericalMomentumController.js";import{NavigationMode as U,pickPointAndInitSphere as D,contentIntersectorOptions as G,SpherePickPointFallback as I,navigationMode as L,sphereOrPlanePointFromScreenPoint as Z,panDistanceModifier as N,minHeightLimit as B,screenPixelArea as V,intersectPlaneFromScreenPointAtEye as q,applyZoomOnSphere as J,shouldPreserveHeading as K,applyPanSphericalPreserveHeading as Q,applyPanSphericalDirectRotation as W,normalizeRotationDelta as X,applyRotation as Y,applyPanPlanar as $,applyZoomToPoint as tt}from"../utils/navigationUtils.js";import it from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as et}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as ot}from"../../../navigation/ZoomMomentumEstimator.js";let rt=class extends z{constructor(){super(...arguments),this._smoothRotation=new R(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=M(),this._beginRadius=0,this._smoothScaling=new R(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new ot,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=b(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navMode=U.Horizontal,this._sphere=b(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new it,this._constraintOptions=new O(y.ALL,A.NONE,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=v(this.view.spatialReference),o=D(this._intersectionHelper,this.startCamera,this._screenPickPoint,n,I.Silhouette,0===this.view.map.ground.opacity?G:{});null!=o.scenePickPoint&&(this._scenePickPoint=o.scenePickPoint,this._sphere=o.sphere,h(this._beginScenePoint,this._scenePickPoint),this._navMode=L(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),this._navMode===U.Vertical&&this._preparePlanarPanMode(t,o.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;this._navMode===U.Horizontal?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._navMode===U.Horizontal?new T({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new H({view:this.view,momentum:e,center:f(this._sphere),axis:this._rotationAxis});if(this._navMode===U.Horizontal){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);w(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],Z(this._adjustedSphere,this.startCamera,r,a);const v=o();this.startCamera.projectToRenderScreen(a,v);const C=P(),M=P(),b=P();p(C,this._scenePickPoint,this.currentCamera.eye);const f=_(C);l(C,C);const j=N*Math.max(Math.abs(this.view.camera.position.z),B),E=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,V);let O=null!=E?E:j;O=i?Math.min(O,f):O,h(b,u(M,this.currentCamera.eye,d(M,C,O))),this._panningPlane[3]=-g(S(this._panningPlane),b),this.startCamera.center=u(M,this.startCamera.eye,d(M,this.startCamera.viewForward,O));const y=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.startCamera,y,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),J(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);Z(this._sphere,this.currentCamera,i,this._tmp3d),K(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(Q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(W(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._screenPickPoint,i)),E(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+X(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),C(this._rotationAxis,s)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*e),E(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.currentCamera,i,this._tmp3d)&&($(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),E(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),tt(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=X(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),C(this._rotationAxis,o)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*o),E(this.view,this.currentCamera,this._constraintOptions)}};rt=t([r("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],rt);export{rt as PinchAndPanControllerGlobal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{distance as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{v as o,c as r,f as a,d as m,l as h,n as l,h as c,g as p}from"../../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as d}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as C,setOffsetFromPoint as v,negate as M,getNormal as b}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as w,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as P}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as V}from"../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../input/util.js";import{getVoxelWasm as S}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as H}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as O}from"./momentum/ZoomPlanarMomentumController.js";import{NavigationMode as x,contentIntersectorOptions as F,navigationMode as A,panDistanceModifier as R,minHeightLimit as U,screenPixelArea as L,centroid as T,applyZoomToPoint as k,applyPanPlanar as I,normalizeRotationDelta as N,applyRotation as Z,intersectPlaneFromScreenPointAtEye as D}from"../utils/navigationUtils.js";import G from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as B}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../navigation/ZoomMomentumEstimator.js";const J=u(0,0,1);let K=class extends E{constructor(){super(...arguments),this._rotationValueSmooth=new z(.05),this._scalingValueSmooth=new z(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new B(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=_(),this._beginAngle=0,this._tmpPoints=[],this._navMode=x.Horizontal,this._beginCenterScreen=i(),this._tmpCentroid3d=_(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._pointerCount=0,this._beginCamera=new G,this._constraintOptions=new j(P.ALL,V.NONE,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),C(J,0,this._planeHorizontal);const n=_(),s=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,n,0===this.view.map.ground.opacity?F:{}),u=_();o(u,this.startCamera.viewForward);const d=_();r(d,J);const g=a(u,d);this._navMode=A(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);const w=Math.min(R,1/Math.abs(a(d,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),U);v(this._planeHorizontal,this._planeHorizontal,n),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const f=_(),j=_(),P=_();m(f,n,this.currentCamera.eye);const V=h(f);if(l(f,f),this._navMode===x.Vertical){c(d,d,g),m(b(this._planeVertical),u,d),l(b(this._planeVertical),b(this._planeVertical)),v(this._planeVertical,this._planeVertical,n);const i=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{distance as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{v as o,c as r,f as a,d as m,l as h,n as l,h as c,g as p}from"../../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as d}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as C,setOffsetFromPoint as v,negate as M,getNormal as b}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as w,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as P}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as V}from"../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../input/util.js";import{getVoxelWasm as S}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as H}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as O}from"./momentum/ZoomPlanarMomentumController.js";import{NavigationMode as x,contentIntersectorOptions as F,navigationMode as A,panDistanceModifier as R,minHeightLimit as U,screenPixelArea as L,centroid as T,applyZoomToPoint as k,applyPanPlanar as I,normalizeRotationDelta as N,applyRotation as Z,intersectPlaneFromScreenPointAtEye as D}from"../utils/navigationUtils.js";import G from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as B}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../navigation/ZoomMomentumEstimator.js";const J=u(0,0,1);let K=class extends E{constructor(){super(...arguments),this._rotationValueSmooth=new z(.05),this._scalingValueSmooth=new z(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new B(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=_(),this._beginAngle=0,this._tmpPoints=[],this._navMode=x.Horizontal,this._beginCenterScreen=i(),this._tmpCentroid3d=_(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._pointerCount=0,this._beginCamera=new G,this._constraintOptions=new j(P.ALL,V.NONE,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),C(J,0,this._planeHorizontal);const n=_(),s=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,n,0===this.view.map.ground.opacity?F:{}),u=_();o(u,this.startCamera.viewForward);const d=_();r(d,J);const g=a(u,d);this._navMode=A(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);const w=Math.min(R,1/Math.abs(a(d,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),U);v(this._planeHorizontal,this._planeHorizontal,n),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const f=_(),j=_(),P=_();m(f,n,this.currentCamera.eye);const V=h(f);if(l(f,f),this._navMode===x.Vertical){c(d,d,g),m(b(this._planeVertical),u,d),l(b(this._planeVertical),b(this._planeVertical)),v(this._planeVertical,this._planeVertical,n);const i=this.view.stage.renderView.getMinimalDepthForArea(S(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,L);let e=null!=i?i:w;e=s?Math.min(e,V):e,r(P,p(j,this.currentCamera.eye,c(j,f,e))),this._planeVertical[3]=-a(b(this._planeVertical),P),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=s?V:w;r(P,p(j,this.currentCamera.eye,c(j,f,i))),this._planeHorizontal[3]=-a(b(this._planeHorizontal),P),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=this._navMode===x.Horizontal?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),k(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=V.ZOOM,this._constraintOptions.interactionFactor=w(Math.abs(t.radius-this._beginRadius)),f(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d),I(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=V.PAN,this._constraintOptions.interactionFactor=w(s(this._beginCenterScreen,this._tmpCentroid2d)),f(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+N(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=b(this._planeHorizontal);Z(this.currentCamera,i,d(a,r)),this._constraintOptions.interactionType=V.TUMBLE,this._constraintOptions.interactionFactor=w(Math.abs(t.radius*r)),f(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return new O({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new y({view:this.view,momentum:e,center:this._beginCenter,axis:b(this._planeHorizontal)});const n=this._panMomentumEstimator.evaluateMomentum();return n?new H({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const s=this._tmp2d;let o=0;return t.forEach((t=>{s[0]=t.x,s[1]=t.y,void 0===n[o]&&(n[o]=_()),D(i,e,s,n[o]),o+=1})),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};K=t([n("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],K);export{K as PinchAndPanControllerLocal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,d as l,l as _,f as v,n as f,g as C,h as u,e as P,t as w}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintOptions as R}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as j}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as g}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as T}from"../../camera/constraintUtils/TiltMode.js";import{getVoxelWasm as y}from"../../layers/VoxelWasm.js";import{TiltRange as M}from"../Constraints.js";import{InteractiveController as U}from"./InteractiveController.js";import{contentIntersectorOptions as x,normalizeCoordinate as O,rotatePivotDistanceModifier as b,rotatePivotMinDistanceModifier as D,navigationMode as A,rotateScreenPixelArea as N,NavigationMode as L}from"../utils/navigationUtils.js";var V;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(V||(V={}));let H=class extends U{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=V.CENTER,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=d(),this._tmpViewDir=d(),this._tmpRotCurPoint=m(),this._tmpTransf=h(),this._tmpAxis=d(),this._tmpPivotPoint=d(),this._pivotPos=d(),this._constraintOptions=new R(j.ALL,g.TUMBLE,0,this.startCamera)}initialize(){this._rotScale=this.pivot===V.CENTER?3:1.5}begin(t){if(this.running){switch(this.pivot){case V.EYE:c(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=g.LOOK_AROUND,this._constraintOptions.tiltMode=T.LOOK_AROUND,this._constraintOptions.selection=j.NONE;break;case V.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,0===this.view.map.ground.opacity?x:{});i||c(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=g.TUMBLE,this._constraintOptions.tiltMode=T.TUMBLE,this._constraintOptions.selection=j.ALL&~j.DISTANCE;break}}O(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,o=d();l(o,this._pivotPos,s.eye);const e=_(o),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,k);let n=Math.max(Math.min(b,1/Math.abs(v(k,s.viewForward)))*a,D);i&&(n=Math.min(e,n));const h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),p=A(this.startCamera,h,this.view.renderCoordsHelper,this.view.viewingMode);let m=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,d as l,l as _,f as v,n as f,g as C,h as u,e as P,t as w}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintOptions as R}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as j}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as g}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as T}from"../../camera/constraintUtils/TiltMode.js";import{getVoxelWasm as y}from"../../layers/VoxelWasm.js";import{TiltRange as M}from"../Constraints.js";import{InteractiveController as U}from"./InteractiveController.js";import{contentIntersectorOptions as x,normalizeCoordinate as O,rotatePivotDistanceModifier as b,rotatePivotMinDistanceModifier as D,navigationMode as A,rotateScreenPixelArea as N,NavigationMode as L}from"../utils/navigationUtils.js";var V;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(V||(V={}));let H=class extends U{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=V.CENTER,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=d(),this._tmpViewDir=d(),this._tmpRotCurPoint=m(),this._tmpTransf=h(),this._tmpAxis=d(),this._tmpPivotPoint=d(),this._pivotPos=d(),this._constraintOptions=new R(j.ALL,g.TUMBLE,0,this.startCamera)}initialize(){this._rotScale=this.pivot===V.CENTER?3:1.5}begin(t){if(this.running){switch(this.pivot){case V.EYE:c(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=g.LOOK_AROUND,this._constraintOptions.tiltMode=T.LOOK_AROUND,this._constraintOptions.selection=j.NONE;break;case V.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,0===this.view.map.ground.opacity?x:{});i||c(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=g.TUMBLE,this._constraintOptions.tiltMode=T.TUMBLE,this._constraintOptions.selection=j.ALL&~j.DISTANCE;break}}O(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,o=d();l(o,this._pivotPos,s.eye);const e=_(o),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,k);let n=Math.max(Math.min(b,1/Math.abs(v(k,s.viewForward)))*a,D);i&&(n=Math.min(e,n));const h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),p=A(this.startCamera,h,this.view.renderCoordsHelper,this.view.viewingMode);let m=this.view.stage.renderView.getMinimalDepthForArea(y(this.view),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*N,N),P=this.view.stage.renderView.getMinimalDepthForArea(y(this.view),t[0],t[1],s,N);null==m&&null==P||(m=m??P??0,P=null==P||p===L.Horizontal?m:P,n=m>P?P:m,n=i?Math.min(n,e):n),f(o,o),c(this._pivotPos,C(this._tmpPivotPoint,s.eye,u(this._tmpPivotPoint,o,n)))}update(t){if(this.running){switch(this.pivot){case V.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this._pivotPos);break;case V.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this._pivotPos)}E(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.running&&this.finishController()}_applyRotation(t,r,o,e){this.view.renderCoordsHelper.worldUpAtPosition(e,this._tmpWorldUp),O(t,r,this._tmpRotCurPoint);let h=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,m=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;l(this._tmpViewDir,o,e);const c=_(this._tmpViewDir),f=i(v(this._tmpViewDir,this._tmpWorldUp)/c);if(this.pivot===V.EYE){h*=-.5;const t=.5*Math.PI-f,i=.5*Math.PI*.99;h=t-Math.max(-i,Math.min(i,t+h))}return h=s(h+f,M.min,M.max)-f,P(this._tmpAxis,t.up,this._tmpViewDir),this.pivot===V.CENTER&&(m=-m),a(this._tmpTransf,m,this._tmpWorldUp),n(this._tmpTransf,this._tmpTransf,h,this._tmpAxis),w(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),t.up=w(S,t.up,this._tmpTransf),C(S,e,this._tmpViewDir),p(this._lastPoint,this._tmpRotCurPoint),S}};t([o()],H.prototype,"pivot",void 0),H=t([e("esri.views.3d.state.controllers.RotateController")],H);const S=d(),k=d();export{V as PivotPoint,H as RotateController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{n as o,d as h,l as c,f as m,h as p,g as l}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../geometry/ellipsoidUtils.js";import{create as P,fromPoints as C}from"../../../../geometry/support/axisAngle.js";import{c as y,a as d}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as g,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as R}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as j}from"../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as k}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as w}from"./InteractiveController.js";import{NavigationMode as D,normalizeCoordinate as A,pickPointAndInitSphere as M,contentIntersectorOptions as b,SpherePickPointFallback as O,navigationMode as U,distanceClampValues as x,pivotDistanceModifier as z,screenPixelArea as H,sphereOrPlanePointFromScreenPoint as L,applyRotation as I}from"../utils/navigationUtils.js";import{fromScreenAtEye as S}from"../../support/geometryUtils/ray.js";let B=class extends w{constructor(){super(...arguments),this._pickPoint=_(),this._tmpP0=n(),this._panAxisAngle=P(),this._tmpRayDir=_(),this._tmpRayDirPick=_(),this._targetOnSphere=_(),this._navMode=D.Horizontal,this._tmpRay={origin:_(),direction:_()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new v(R.ALL_EXCEPT_COLLISION,j.ZOOM,0,this.startCamera),this._sphere=y(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;e(this.dragBeginPoint,t),A(this.startCamera,t,this._normalizedAnchorPoint);const r=u(this.view.spatialReference),s=M(this._intersectionHelper,this.startCamera,t,r,O.Ellipsoid,0===this.view.map.ground.opacity?b:{});if(this._navMode=U(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),this._navMode===D.Horizontal)this._hasPickPoint=!!s.scenePickPoint,this._pickPoint=s.scenePickPoint??this._pickPoint,this._sphere=s.sphere;else{let r;S(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=s.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,s.scenePickPoint),r=c(this._tmpRayDirPick));const e=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,T);let a=i(Math.min(z,1/Math.abs(m(T,this._tmpRay.direction)))*e,x[0],x[1]);const n=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{n as o,d as h,l as c,f as m,h as p,g as l}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../geometry/ellipsoidUtils.js";import{create as P,fromPoints as C}from"../../../../geometry/support/axisAngle.js";import{c as y,a as d}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as g,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as R}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as j}from"../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as k}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as w}from"./InteractiveController.js";import{NavigationMode as D,normalizeCoordinate as A,pickPointAndInitSphere as M,contentIntersectorOptions as b,SpherePickPointFallback as O,navigationMode as U,distanceClampValues as x,pivotDistanceModifier as z,screenPixelArea as H,sphereOrPlanePointFromScreenPoint as L,applyRotation as I}from"../utils/navigationUtils.js";import{fromScreenAtEye as S}from"../../support/geometryUtils/ray.js";let B=class extends w{constructor(){super(...arguments),this._pickPoint=_(),this._tmpP0=n(),this._panAxisAngle=P(),this._tmpRayDir=_(),this._tmpRayDirPick=_(),this._targetOnSphere=_(),this._navMode=D.Horizontal,this._tmpRay={origin:_(),direction:_()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new v(R.ALL_EXCEPT_COLLISION,j.ZOOM,0,this.startCamera),this._sphere=y(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;e(this.dragBeginPoint,t),A(this.startCamera,t,this._normalizedAnchorPoint);const r=u(this.view.spatialReference),s=M(this._intersectionHelper,this.startCamera,t,r,O.Ellipsoid,0===this.view.map.ground.opacity?b:{});if(this._navMode=U(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),this._navMode===D.Horizontal)this._hasPickPoint=!!s.scenePickPoint,this._pickPoint=s.scenePickPoint??this._pickPoint,this._sphere=s.sphere;else{let r;S(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=s.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,s.scenePickPoint),r=c(this._tmpRayDirPick));const e=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,T);let a=i(Math.min(z,1/Math.abs(m(T,this._tmpRay.direction)))*e,x[0],x[1]);const n=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,H);a=null!=n?n:a,a=null!=r?Math.min(a,r):a,this._hasPickPoint=!0,p(this._tmpRay.direction,this._tmpRay.direction,a),l(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navMode===D.Horizontal){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;if(this._hasPickPoint&&s<i){const t=1-(1-s/i)*(1-this._sphere[3]/c(this.currentCamera.center));this.currentCamera.center=p(E,this.currentCamera.center,t)}p(this._tmpRayDir,this._tmpRayDir,-s/i),this.currentCamera.eye=l(E,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=g(a(this.dragBeginPoint,t)),f(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(L(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),C(this._pickPoint,this._targetOnSphere,this._panAxisAngle),I(this.currentCamera,d(this._sphere),this._panAxisAngle))}else{const i=c(this._tmpRay.direction);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;p(this._tmpRayDir,this._tmpRay.direction,1-s/i),this.currentCamera.eye=l(E,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=l(E,this.currentCamera.center,this._tmpRayDir)}k(this.view,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};B=t([s("esri.views.3d.state.controllers.ZoomControllerGlobal")],B);const E=_(),T=_();export{B as ZoomControllerGlobal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as o,l as m,n as h,f as c,h as p,g as _,v as l,c as u,m as f}from"../../../../chunks/vec32.js";import{create as g,fromValues as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as P,fromPositionAndNormal as D}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as j,applyAll as y}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as v}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as w}from"../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as b}from"../../layers/VoxelWasm.js";import{InteractiveController as M}from"./InteractiveController.js";import{normalizeCoordinate as O,contentIntersectorOptions as N,distanceClampValues as R,pivotDistanceModifier as x,screenPixelArea as U,intersectPlaneFromScreenPoint as A}from"../utils/navigationUtils.js";let z=class extends M{constructor(){super(...arguments),this._tmpP=g(),this._tmpDir=g(),this._tmpN=g(),this._tmpP0=n(),this._tmpPoi=g(),this._tmpRayDir=g(),this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new d(v.ALL,w.ZOOM,0,this.startCamera,g()),this._plane=P()}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;e(this.dragBeginPoint,t),O(this.startCamera,t,this._normalizedAnchorPoint);const r=this._intersectionHelper.intersectScreenFreePointFallback(t,this._tmpP,0===this.view.map.ground.opacity?N:{});o(this._tmpDir,this._tmpP,this.startCamera.eye);const s=m(this._tmpDir);h(this._tmpDir,this._tmpDir);const a=Math.abs(this.view.camera.position.z);let n=i(Math.min(x,1/Math.abs(c(B,this._tmpDir)))*a,R[0],R[1]);const u=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as o,l as m,n as h,f as c,h as p,g as _,v as l,c as u,m as f}from"../../../../chunks/vec32.js";import{create as g,fromValues as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as P,fromPositionAndNormal as D}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as j,applyAll as y}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as v}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as w}from"../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as b}from"../../layers/VoxelWasm.js";import{InteractiveController as M}from"./InteractiveController.js";import{normalizeCoordinate as O,contentIntersectorOptions as N,distanceClampValues as R,pivotDistanceModifier as x,screenPixelArea as U,intersectPlaneFromScreenPoint as A}from"../utils/navigationUtils.js";let z=class extends M{constructor(){super(...arguments),this._tmpP=g(),this._tmpDir=g(),this._tmpN=g(),this._tmpP0=n(),this._tmpPoi=g(),this._tmpRayDir=g(),this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new d(v.ALL,w.ZOOM,0,this.startCamera,g()),this._plane=P()}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;e(this.dragBeginPoint,t),O(this.startCamera,t,this._normalizedAnchorPoint);const r=this._intersectionHelper.intersectScreenFreePointFallback(t,this._tmpP,0===this.view.map.ground.opacity?N:{});o(this._tmpDir,this._tmpP,this.startCamera.eye);const s=m(this._tmpDir);h(this._tmpDir,this._tmpDir);const a=Math.abs(this.view.camera.position.z);let n=i(Math.min(x,1/Math.abs(c(B,this._tmpDir)))*a,R[0],R[1]);const u=this.view.stage.renderView.getMinimalDepthForArea(b(this.view),t[0],t[1],this.view.state.camera,U);n=null!=u?u:n,n=r?Math.min(n,s):n,p(this._tmpDir,this._tmpDir,n),_(this._tmpP,this.startCamera.eye,this._tmpDir),o(this._tmpN,this.startCamera.eye,this.startCamera.center),h(this._tmpN,this._tmpN),this._tmpN[1]<0&&l(this._tmpN,this._tmpN),D(this._tmpP,this._tmpN,this._plane)}update(t){if(!this.running)return;A(this._plane,this.currentCamera,this.dragBeginPoint,this._tmpPoi)||u(this._tmpPoi,this.currentCamera.center),O(this.currentCamera,t,this._tmpP0);let i=4*(this._tmpP0[1]-this._normalizedAnchorPoint[1]);e(this._normalizedAnchorPoint,this._tmpP0),o(this._tmpRayDir,this._tmpPoi,this.currentCamera.eye);const r=m(this._tmpRayDir);let s=r*(1-i);this._constraintOptions.interactionDirection&&(u(this._constraintOptions.interactionDirection,this._tmpRayDir),p(this._constraintOptions.interactionDirection,this._constraintOptions.interactionDirection,Math.sign(i)/r));const n=this.view.state.constraints.minimumPoiDistance;i>=0&&s<n&&(s=n,i=-(s-r)/r),Math.abs(r-s)<1e-6||(p(this._tmpRayDir,this._tmpRayDir,i),this.currentCamera.eye=_(L,this.currentCamera.eye,this._tmpRayDir),f(L,this.currentCamera.center,this._tmpPoi,i),this._tmpPoi[2]>this.startCamera.center[2]?L[2]=Math.max(this.startCamera.center[2],L[2]):L[2]=Math.min(this.startCamera.center[2],L[2]),this.currentCamera.center=L,this._constraintOptions.interactionFactor=j(a(this.dragBeginPoint,t)),y(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}finish(){this.running&&this.finishController()}};z=t([s("esri.views.3d.state.controllers.ZoomControllerLocal")],z);const L=g(),B=C(0,0,1);export{z as ZoomControllerLocal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as s,n as o,h as a,f as n,l as m,d as h,g as c,s as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l}from"../../../../geometry/support/ray.js";import{c as y}from"../../../../chunks/sphere.js";import{applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as g}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as w}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as C}from"../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as d}from"../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as j}from"./PointToPointAnimationController.js";import{contentIntersectorOptions as u,navigationMode as D,zoomMaxDistanceModifier as v,zoomMinDistanceModifier as b,zoomDistanceModifier as R,NavigationMode as M,panToPosition as L}from"../utils/navigationUtils.js";import{fromScreenAtEye as O}from"../../support/geometryUtils/ray.js";import{intersectScreen as z}from"../../support/geometryUtils/sphere.js";import U from"../../webgl/RenderCamera.js";import{newIntersector as V}from"../../webgl-engine/lib/Intersector.js";import{outExpo as S}from"../../../animation/easing.js";const H=.6,x=4,A=60;let F=class extends j{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new U,this._tmpViewDir=_(),this._tmpRayDir=l(),this._targetOnSphere=_(),this._tmpCenter=_(),this._beginCamera=new U,this._constraintOptions=new g(w.ALL_EXCEPT_COLLISION,C.ZOOM,null,this._beginCamera),this._sphere=y()}initialize(){this._intersector=V(this.view.state.viewingMode)}step(t,i){if(!this.running)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this._intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:S}}_updateCamera(t,e,r,s){const _=D(t,r,this.view.renderCoordsHelper,this.view.viewingMode),l=Math.abs(this.view.camera.position.z),y=this._zoomLocation;o(T,t.eye),a(T,T,-1),O(t,r,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const g=i(Math.min(R,1/Math.abs(n(T,this._tmpRayDir.direction)))*l,b,v);if(_===M.Horizontal){let i=H**e;this._sphere[3]=m(y),h(this._tmpViewDir,t.center,t.eye);const s=Math.min(m(this._tmpViewDir),g);let o=s*i;if(i<=1&&o<x&&(o=x,i=o/s),Math.abs(s-o)<1e-6)return;const n=m(t.center);if(this._sphere[3]!==n){const e=this._sphere[3]+i*(n-this._sphere[3]);t.center=a(I,t.center,e/n)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=c(I,t.center,this._tmpViewDir),f(this.view,t,this._constraintOptions),p(y,t.center)>1e-12&&z(this._sphere,t,r,this._targetOnSphere)&&L(this._sphere,t,y,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=H**Math.abs(e);const o=e>0?1:-1;h(this._tmpViewDir,y,t.eye);const n=m(this._tmpViewDir),p=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as s,n as o,h as a,f as n,l as m,d as h,g as c,s as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l}from"../../../../geometry/support/ray.js";import{c as y}from"../../../../chunks/sphere.js";import{applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as g}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as w}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as C}from"../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as d}from"../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as j}from"./PointToPointAnimationController.js";import{contentIntersectorOptions as u,navigationMode as D,zoomMaxDistanceModifier as v,zoomMinDistanceModifier as b,zoomDistanceModifier as R,NavigationMode as M,panToPosition as L}from"../utils/navigationUtils.js";import{fromScreenAtEye as O}from"../../support/geometryUtils/ray.js";import{intersectScreen as z}from"../../support/geometryUtils/sphere.js";import U from"../../webgl/RenderCamera.js";import{newIntersector as V}from"../../webgl-engine/lib/Intersector.js";import{outExpo as S}from"../../../animation/easing.js";const H=.6,x=4,A=60;let F=class extends j{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new U,this._tmpViewDir=_(),this._tmpRayDir=l(),this._targetOnSphere=_(),this._tmpCenter=_(),this._beginCamera=new U,this._constraintOptions=new g(w.ALL_EXCEPT_COLLISION,C.ZOOM,null,this._beginCamera),this._sphere=y()}initialize(){this._intersector=V(this.view.state.viewingMode)}step(t,i){if(!this.running)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this._intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:S}}_updateCamera(t,e,r,s){const _=D(t,r,this.view.renderCoordsHelper,this.view.viewingMode),l=Math.abs(this.view.camera.position.z),y=this._zoomLocation;o(T,t.eye),a(T,T,-1),O(t,r,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const g=i(Math.min(R,1/Math.abs(n(T,this._tmpRayDir.direction)))*l,b,v);if(_===M.Horizontal){let i=H**e;this._sphere[3]=m(y),h(this._tmpViewDir,t.center,t.eye);const s=Math.min(m(this._tmpViewDir),g);let o=s*i;if(i<=1&&o<x&&(o=x,i=o/s),Math.abs(s-o)<1e-6)return;const n=m(t.center);if(this._sphere[3]!==n){const e=this._sphere[3]+i*(n-this._sphere[3]);t.center=a(I,t.center,e/n)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=c(I,t.center,this._tmpViewDir),f(this.view,t,this._constraintOptions),p(y,t.center)>1e-12&&z(this._sphere,t,r,this._targetOnSphere)&&L(this._sphere,t,y,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=H**Math.abs(e);const o=e>0?1:-1;h(this._tmpViewDir,y,t.eye);const n=m(this._tmpViewDir),p=this.view.stage.renderView.getMinimalDepthForArea(null,r[0],r[1],this.view.state.camera,A);let _=null!=p?p:g;_=s&&e>0?Math.min(_,n):_,a(this._tmpRayDir.direction,this._tmpRayDir.direction,_),c(y,this._tmpRayDir.origin,this._tmpRayDir.direction);let l=_*i;const f=Math.max(x,1.01*t.nearFar[0]);if(e>0&&l<f&&(l=f,i=l/_),Math.abs(_-l)<1e-6)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,o*(1-i)),t.eye=c(I,t.eye,this._tmpRayDir.direction),t.center=c(I,t.center,this._tmpRayDir.direction)}d(this.view,t)}};F=t([r("esri.views.3d.state.controllers.ZoomStepControllerGlobal")],F);const I=_(),T=_();export{F as ZoomStepControllerGlobal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as r,d as o,n as a,f as m,l as n,g as c,h,m as p}from"../../../../chunks/vec32.js";import{create as _,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as C}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as g}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as j}from"../../layers/VoxelWasm.js";import{PointToPointAnimationController as u}from"./PointToPointAnimationController.js";import{contentIntersectorOptions as w,zoomMaxDistanceModifier as b,zoomMinDistanceModifier as L,zoomDistanceModifier as d}from"../utils/navigationUtils.js";import v from"../../webgl/RenderCamera.js";import{newIntersector as z}from"../../webgl-engine/lib/Intersector.js";import{outExpo as R}from"../../../animation/easing.js";const M=.6,D=4,F=60;let U=class extends u{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new v,this._tmpRayDir=_(),this._tmpCenter=_(),this._beginCamera=new v,this._constraintOptions=new f(g.ALL,y.ZOOM,null,this._beginCamera)}step(t,e){if(!this.running)return;const s=this.view.state;this.animation.finished?this._beginCamera.copyFrom(s.camera):this.animation.cameraAt(1,this._beginCamera),this._tmpCamera.copyFrom(s.camera);const p=z(this.view.state.viewingMode);let l=!1;t>0?(l=this._intersectionHelper.intersectScreenFreePointFallback(e,this._zoomLocation,0===this.view.map.ground.opacity?w:{}),this._intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this._intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:r(this._zoomLocation,this._tmpCamera.center);const C=M**t;let f=this.view.
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as r,d as o,n as a,f as m,l as n,g as c,h,m as p}from"../../../../chunks/vec32.js";import{create as _,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as C}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as g}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as j}from"../../layers/VoxelWasm.js";import{PointToPointAnimationController as u}from"./PointToPointAnimationController.js";import{contentIntersectorOptions as w,zoomMaxDistanceModifier as b,zoomMinDistanceModifier as L,zoomDistanceModifier as d}from"../utils/navigationUtils.js";import v from"../../webgl/RenderCamera.js";import{newIntersector as z}from"../../webgl-engine/lib/Intersector.js";import{outExpo as R}from"../../../animation/easing.js";const M=.6,D=4,F=60;let U=class extends u{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new v,this._tmpRayDir=_(),this._tmpCenter=_(),this._beginCamera=new v,this._constraintOptions=new f(g.ALL,y.ZOOM,null,this._beginCamera)}step(t,e){if(!this.running)return;const s=this.view.state;this.animation.finished?this._beginCamera.copyFrom(s.camera):this.animation.cameraAt(1,this._beginCamera),this._tmpCamera.copyFrom(s.camera);const p=z(this.view.state.viewingMode);let l=!1;t>0?(l=this._intersectionHelper.intersectScreenFreePointFallback(e,this._zoomLocation,0===this.view.map.ground.opacity?w:{}),this._intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this._intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:r(this._zoomLocation,this._tmpCamera.center);const C=M**t;let f=this.view.stage.renderView.getMinimalDepthForArea(j(this.view),e[0],e[1],this.view.state.camera,F);o(A,this._tmpCamera.eye,this._zoomLocation),a(A,A);const g=i(Math.min(d,1/Math.abs(m(O,A)))*Math.abs(this.view.camera.position.z),L,b);if(f=null!=f?f:g,f){const t=_();o(t,this._zoomLocation,this._tmpCamera.eye),(f<n(t)||!l)&&(a(t,t),c(this._zoomLocation,this._tmpCamera.eye,h(t,t,f)))}this._updateCamera(this._tmpCamera,C,this._zoomLocation),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:R}}_updateCamera(t,i,e){o(this._tmpRayDir,e,t.eye);const s=n(this._tmpRayDir);let r=s*i;const a=i<=1,m=Math.max(D,1.01*t.nearFar[0]);0!==r&&(a&&r<m&&(r=m,i=r/s),Math.abs(s-r)<1e-6||(h(this._tmpRayDir,this._tmpRayDir,i),t.eye=o(x,e,this._tmpRayDir),t.center=p(x,t.center,e,1-i),C(this.view,t,this._constraintOptions)))}};U=t([s("esri.views.3d.state.controllers.ZoomStepControllerLocal")],U);const x=_(),O=l(0,0,1),A=_();export{U as ZoomStepControllerLocal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as y}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as v}from"../../support/geometryUtils/ray.js";import{defaultTolerance as I,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=I,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(N,r,i),N[0]+=.0466,N[1]-=.0123,_(e,N,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=I){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return v(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==f.Local||null==e||n(t,e.origin,s(g.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=y(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:f}=c.state;if("absolute-height"===d){const t=u?.getAltitude(f.eye),r=o(s(S,e.direction),u.worldUpAtPosition(f.eye,D));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,S)){const e=R(c,S);return e.z??=0,e.z-=p,e}return null}const _=t(g.get());f.projectToRenderScreen(e.origin,_);const v=new k(null,this._forEachLayer),{slicePlane:I}=c,j=null!=I?M(I):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(g.get(),x,e.direction);U.reset(x,T,f),U.point=_;const E=a?"type"in a&&"graphics"===a.type?e=>e.layerUid!==a.uid:e=>e.graphicUid!==a.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(v.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(S)){const e=R(c,S);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(g.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(g.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of n){!a.filterLayerUid(s)?i&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=g.get(),y=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=y.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=y.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=g.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,y.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),g=Math.min(h(n)+2*T,o-a),y=Math.min(d(n)+2*T,l-m),f=g>0&&y>0?new Uint8Array(g*y*4):null;f&&this._view.
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as y}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as v}from"../../support/geometryUtils/ray.js";import{defaultTolerance as I,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=I,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(N,r,i),N[0]+=.0466,N[1]-=.0123,_(e,N,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=I){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return v(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==f.Local||null==e||n(t,e.origin,s(g.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=y(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:f}=c.state;if("absolute-height"===d){const t=u?.getAltitude(f.eye),r=o(s(S,e.direction),u.worldUpAtPosition(f.eye,D));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,S)){const e=R(c,S);return e.z??=0,e.z-=p,e}return null}const _=t(g.get());f.projectToRenderScreen(e.origin,_);const v=new k(null,this._forEachLayer),{slicePlane:I}=c,j=null!=I?M(I):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(g.get(),x,e.direction);U.reset(x,T,f),U.point=_;const E=a?"type"in a&&"graphics"===a.type?e=>e.layerUid!==a.uid:e=>e.graphicUid!==a.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(v.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(S)){const e=R(c,S);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(g.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(g.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of n){!a.filterLayerUid(s)?i&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=g.get(),y=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=y.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=y.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=g.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,y.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),g=Math.min(h(n)+2*T,o-a),y=Math.min(d(n)+2*T,l-m),f=g>0&&y>0?new Uint8Array(g*y*4):null;f&&this._view.stage.renderer.readHUDVisibility(a,m,g,y,f);let R=!0;const _=null==e.results.max.dist;let v=0;for(const{item:c,occlusionTest:u}of i){let t=!u;if(u&&f)for(const e of E){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-n[0]+(Math.min(c.screenPoint[1]+e[1],l)-n[1])*g);if(r>=0&&r<f.length&&f[r]){t=!0;break}}t&&(R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===w.ALL&&e.results.all.splice(v++,0,c.result))}}}const T=1,E=(()=>{const e=[],t=T;for(let r=-1;r<=t;r++)for(let i=-1;i<=t;i++)e.push([i+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function A(e){return L&&L.viewingMode===e||(L=b(e)),L}class k{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function F(e){return"object"==typeof e&&"intersect"in e}const S=l(),D=l(),N=r();export{x as SceneIntersectionHelper,F as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";function d(e){return new p({view:e})}const l=.1,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";function d(e){return new p({view:e})}const l=.1,u=1,m=1,n=.75,c=.6,_=1.3;let p=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(u),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null!=e&&(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<c&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(u);else if(e)(this._predictedMemory>1.1*m||this._usedMemory>m)&&(this._stableQuality>0?(this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality)):this._quality>l&&this._downscaleMemoryUsed<this._usedMemory&&(this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1));else if(this._downscaleMemoryUsed=0,this._usedMemory>m)this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._predictedMemory;else if(this._stableQuality!==this._quality)if(this._usedMemory<n&&this._quality<u){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_updateQuality(e){return(e=Math.min(Math.max(e,l),u))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some((e=>!!e.updating))}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0),s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach((e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}}));const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([o({constructOnly:!0})],p.prototype,"view",void 0),e([o()],p.prototype,"maxMemory",null),e([o()],p.prototype,"additionalCacheMemory",null),e([o({readOnly:!0})],p.prototype,"memoryFactor",null),e([o({readOnly:!0})],p.prototype,"updating",null),e([o({readOnly:!0})],p.prototype,"usedMemory",null),e([o({readOnly:!0})],p.prototype,"usedCacheMemory",null),e([o()],p.prototype,"_quality",void 0),e([o()],p.prototype,"_usedMemory",void 0),e([o()],p.prototype,"_updating",void 0),e([o()],p.prototype,"_stableQuality",void 0),e([o()],p.prototype,"_maxMemory",void 0),e([o()],p.prototype,"_additionalCacheMemory",void 0),p=e([h("esri.views.3d.support.MemoryController")],p);export{l as minQuality,d as newMemoryController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ByteSizeUnit as e}from"../../../core/ByteSizeUnit.js";import{isPerformanceInfoLayerView as r}from"../layers/support/LayerViewPerformanceInfo.js";import o from"./LayerPerformanceInfo.js";class s{constructor(s){if(this.totalMemory=0,this.usedMemory=0,this.quality=1,this.load=0,this.terrainMemory=0,this.edgesMemory=0,this.layerPerformanceInfos=new Array,this.cachedMemory=0,this.fboMemory=0,null!=s.resourceController){const r=s.resourceController.memoryController;this.totalMemory=(r.maxMemory??0)*e.MEGABYTES,this.usedMemory=Math.round(r.usedMemory*this.totalMemory),this.quality=s.quality,this.load=s.resourceController.scheduler.load,this.cachedMemory=r.usedCacheMemory}this.terrainMemory=s.basemapTerrain?.usedMemory??0,this.edgesMemory=s.
|
|
5
|
+
import{ByteSizeUnit as e}from"../../../core/ByteSizeUnit.js";import{isPerformanceInfoLayerView as r}from"../layers/support/LayerViewPerformanceInfo.js";import o from"./LayerPerformanceInfo.js";class s{constructor(s){if(this.totalMemory=0,this.usedMemory=0,this.quality=1,this.load=0,this.terrainMemory=0,this.edgesMemory=0,this.layerPerformanceInfos=new Array,this.cachedMemory=0,this.fboMemory=0,null!=s.resourceController){const r=s.resourceController.memoryController;this.totalMemory=(r.maxMemory??0)*e.MEGABYTES,this.usedMemory=Math.round(r.usedMemory*this.totalMemory),this.quality=s.quality,this.load=s.resourceController.scheduler.load,this.cachedMemory=r.usedCacheMemory}this.terrainMemory=s.basemapTerrain?.usedMemory??0,this.edgesMemory=s.stage?.renderer.usedMemory.edges??0,this.fboMemory=s.stage?.renderer.usedMemory.fbos??0,s.allLayerViews?.items.forEach((e=>{r(e)&&this.layerPerformanceInfos.push(new o(e))})),this.layerPerformanceInfos.sort(((e,r)=>r.memory-e.memory))}}export{s as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeUnordered as e}from"../../../core/arrayUtils.js";import t from"../../../core/Handles.js";import{makeHandle as s}from"../../../core/handleUtils.js";import"../../../core/has.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{ObjectResourceCache as a}from"../layers/graphics/ObjectResourceCache.js";import{ClientType as o}from"./index.js";import{StreamTextureCollection as p}from"./StreamTextureCollection.js";import{getSettings as l,getLabelSettings as h}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";class S{constructor(e){this.streamDataRequester=null,this._graphicsOwners=[],this._screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this._viewState=e.viewState,this._view=e.view,this._pointsOfInterest=e.pointsOfInterest,this.streamDataRequester=e.resourceController.createStreamDataRequester(o.SYMBOLOGY),this.objectResourceCache=new a(((t,s)=>e.resourceController.memoryController.newCache(t,s))),this.textures=new p(this.streamDataRequester,e.view.
|
|
5
|
+
import{removeUnordered as e}from"../../../core/arrayUtils.js";import t from"../../../core/Handles.js";import{makeHandle as s}from"../../../core/handleUtils.js";import"../../../core/has.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{ObjectResourceCache as a}from"../layers/graphics/ObjectResourceCache.js";import{ClientType as o}from"./index.js";import{StreamTextureCollection as p}from"./StreamTextureCollection.js";import{getSettings as l,getLabelSettings as h}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";class S{constructor(e){this.streamDataRequester=null,this._graphicsOwners=[],this._screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this._viewState=e.viewState,this._view=e.view,this._pointsOfInterest=e.pointsOfInterest,this.streamDataRequester=e.resourceController.createStreamDataRequester(o.SYMBOLOGY),this.objectResourceCache=new a(((t,s)=>e.resourceController.memoryController.newCache(t,s))),this.textures=new p(this.streamDataRequester,e.view.stage,e.resourceController.scheduler);const t=c(this._view.spatialReference).radius;this.screenSizePerspectiveSettings=l(e.viewingMode,t),this.screenSizePerspectiveSettingsLabels=h(e.viewingMode,t)}destroy(){this.textures.destroy(),this.streamDataRequester=null}addGraphicsOwner(t){if(!t)return s();this._graphicsOwners.push(t);const r=i((()=>t.layer?.screenSizePerspectiveEnabled),(()=>this._updateScreenSizePerspectiveEnabled()));return this._updateScreenSizePerspectiveEnabled(),s((()=>{r.remove(),e(this._graphicsOwners,t),this._updateScreenSizePerspectiveEnabled()}))}_updateScreenSizePerspectiveEnabled(){const e=this._graphicsOwners.some((e=>!0===e.layer?.screenSizePerspectiveEnabled));if(e&&!this._screenSizePerspectiveHandles){this._screenSizePerspectiveHandles=new t;const e=()=>this._updateScreenSizePerspectiveSettings();this._screenSizePerspectiveHandles.add([i((()=>this._pointsOfInterest.centerOnSurfaceInfrequent.distance),e,n),this._viewState.events.on("camera-projection-changed",e)]),this._updateScreenSizePerspectiveSettings()}else e||(this._screenSizePerspectiveHandles=r(this._screenSizePerspectiveHandles))}_updateScreenSizePerspectiveSettings(){const e=this._pointsOfInterest;d.distance=e.centerOnSurfaceInfrequent.distance,d.fovY=this._viewState.camera.fovY,this.screenSizePerspectiveSettings.update(d),this.screenSizePerspectiveSettingsLabels.update(d),this._view.stage.renderView.requestRender()}get test(){}}const d={distance:0,fovY:0};export{S as SharedSymbolResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferViewVec2f as e,BufferViewVec2f64 as t,BufferViewVec3f as
|
|
5
|
+
import{BufferViewVec2f as e,BufferViewVec2f64 as t,BufferViewVec3f as s,BufferViewVec3f64 as i,BufferViewVec4f as r,BufferViewVec4f64 as n,BufferViewMat3f as h,BufferViewMat3f64 as d,BufferViewMat4f as u,BufferViewMat4f64 as f,BufferViewVec4u8 as o,BufferViewFloat as l,BufferViewFloat64 as p,BufferViewUint8 as c,BufferViewUint16 as a,BufferViewInt8 as _,BufferViewVec2i8 as y,BufferViewVec2i16 as F,BufferViewVec2u8 as m,BufferViewVec4u16 as b,BufferViewUint32 as g,BufferViewVec3u8 as w,BufferViewVec2u16 as v,BufferViewVec3u16 as E,BufferViewVec2u32 as M,BufferViewVec3u32 as T,BufferViewVec4u32 as A,BufferViewVec3i8 as B,BufferViewVec4i8 as U,BufferViewInt16 as C,BufferViewVec3i16 as L,BufferViewVec4i16 as j,BufferViewInt32 as x,BufferViewVec2i32 as z,BufferViewVec3i32 as $,BufferViewVec4i32 as V}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as k}from"../../../../geometry/support/buffer/types.js";import{assert as q}from"../../webgl-engine/lib/Util.js";class D{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const s of e.fields.keys()){const t=e.fields.get(s);this[s]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const s=this[e];return s&&s.elementCount===t.ElementCount&&s.elementType===t.ElementType?s:null}slice(e,t){return new D(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,s=0,i=e.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(e.buffer,t*r,i*r/4);new Uint32Array(this.buffer,s*r,i*r/4).set(n)}else{const n=new Uint8Array(e.buffer,t*r,i*r);new Uint8Array(this.buffer,s*r,i*r).set(n)}return this}get cachedMemory(){return this.byteLength}dispose(){}}class G{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:N(e[1].constructor)}))))}freeze(){return this}vec2f(t,s){return this._appendField(t,e,s),this}vec2f64(e,s){return this._appendField(e,t,s),this}vec3f(e,t){return this._appendField(e,s,t),this}vec3f64(e,t){return this._appendField(e,i,t),this}vec4f(e,t){return this._appendField(e,r,t),this}vec4f64(e,t){return this._appendField(e,n,t),this}mat3f(e,t){return this._appendField(e,h,t),this}mat3f64(e,t){return this._appendField(e,d,t),this}mat4f(e,t){return this._appendField(e,u,t),this}mat4f64(e,t){return this._appendField(e,f,t),this}vec4u8(e,t){return this._appendField(e,o,t),this}f32(e,t){return this._appendField(e,l,t),this}f64(e,t){return this._appendField(e,p,t),this}u8(e,t){return this._appendField(e,c,t),this}u16(e,t){return this._appendField(e,a,t),this}i8(e,t){return this._appendField(e,_,t),this}vec2i8(e,t){return this._appendField(e,y,t),this}vec2i16(e,t){return this._appendField(e,F,t),this}vec2u8(e,t){return this._appendField(e,m,t),this}vec4u16(e,t){return this._appendField(e,b,t),this}u32(e,t){return this._appendField(e,g,t),this}_appendField(e,t,s){if(this._fields.has(e))return void q(!1,`${e} already added to vertex buffer layout`);const i=t.ElementCount*k(t.ElementType),r=this._stride;this._fields.set(e,{constructor:t,size:i,offset:r,optional:s}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach((s=>{const i=k(s.constructor.ElementType);e=Math.floor((e+i-1)/i)*i,s.offset=e,e+=s.size,t=Math.max(t,i)})),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new D(this,e)}createView(e){return new D(this,e)}clone(){const e=new G;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,s)=>e._fields.set(s,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function H(){return new G}class I{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const s={...e,constructor:K(e.constructor)};this.fields.push([t,s])})),this.stride=e.stride}}const J=[l,e,s,r,h,u,p,t,i,n,d,f,c,m,w,o,a,v,E,b,g,M,T,A,_,y,B,U,C,F,L,j,x,z,$,V];function K(e){return`${e.ElementType}_${e.ElementCount}`}function N(e){return O.get(e)}const O=new Map;J.forEach((e=>O.set(K(e),e)));export{D as InterleavedBuffer,G as InterleavedLayout,I as PackedLayout,H as newLayout};
|