@arcgis/core 4.31.0-next.20240521 → 4.31.0-next.20240523
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/WebMap.js +1 -1
- package/assets/components/assets/icon/developerCredentials16.json +1 -0
- package/assets/components/assets/icon/developerCredentials24.json +1 -0
- package/assets/components/assets/icon/developerCredentials32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d7722531be4892293cb1.js → 00c49f6c84444e69f3a1.js} +1 -1
- package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{df26d7d07fed1f124fc2.js → 0903b492782dca69eb48.js} +1 -1
- package/assets/esri/core/workers/chunks/158c05b16372d8ed33ea.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/190913c221964292333b.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{2529a4b1e135223833f0.js → 2635ab64e75d4ec700a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f965644347007e3d68e2.js → 27dc94db9ed42b237ecb.js} +1 -1
- package/assets/esri/core/workers/chunks/36d620a9c051e451e6b3.js +1 -0
- package/assets/esri/core/workers/chunks/{0ae3ea7a73f3b5083968.js → 3a01cf7e3355f3c78378.js} +1 -1
- package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/43e1c935452b489e422e.js +1 -0
- package/assets/esri/core/workers/chunks/{15212a82e283d6df2873.js → 4ae885f257660545ceeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ea2ced4b5ea1c8a1cee.js → 4ba866a10711b6a8158f.js} +1 -1
- package/assets/esri/core/workers/chunks/50ee28a1944bde74a7c1.js +1 -0
- package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{eafbe663f7a61d3222c5.js → 5efe1300a39ab9c7bbab.js} +1 -1
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js → 606f8b907166190a8b65.js} +2 -2
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js.LICENSE.txt → 606f8b907166190a8b65.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{5349b0de83ae4be8afe2.js → 6c1ded9acf5c8be493ea.js} +1 -1
- package/assets/esri/core/workers/chunks/{46225ebc10a4398170b5.js → 712ba8ad69b1aab6f508.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d210c2a5a135da2c37d.js → 7c68dc664c0b4cf2a46b.js} +1 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
- package/assets/esri/core/workers/chunks/948867b3c17f6c0e753a.js +1 -0
- package/assets/esri/core/workers/chunks/9b04a666726b5d2ff3c5.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/9c75837b7e75f0f38dc0.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{9a217c5c55ce6fb1d3cd.js → a111eb0ae78a9f5be981.js} +1 -1
- package/assets/esri/core/workers/chunks/a6b138f330625d98f856.js +1 -0
- package/assets/esri/core/workers/chunks/{e4a0fd9e0f8887009b92.js → a8a19e5a7ae4ec16480a.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcf0016d56df8a69f6c1.js → aa198e898b46c6e89d0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{04faa3bf4ef5a6f0ccb4.js → b3de9bc3e75476b0a7e9.js} +1 -1
- package/assets/esri/core/workers/chunks/b61e458ef5021adba1cb.js +1 -0
- package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
- package/assets/esri/core/workers/chunks/bf6e75cc75d3bdfb70cb.js +1 -0
- package/assets/esri/core/workers/chunks/{5acac4616c53a95cc48f.js → c0c8e1a709648e1305c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
- package/assets/esri/core/workers/chunks/{7b4ed96554722be59ae2.js → d8140b5316e80d734155.js} +1 -1
- package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/e3711bc5b100b64cac3a.js +1 -0
- package/assets/esri/core/workers/chunks/{2d5d66cee7c3ec992bcd.js → e93e59f6907fa4c1081c.js} +1 -1
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +15 -1
- package/assets/esri/themes/base/widgets/_Grid.scss +4 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tooltip.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/workers/InvokeHandler.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/interfaces.d.ts +568 -48
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/package.json +2 -2
- package/portal/PortalItem.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/rest/print.js +1 -1
- package/rest/support/printTaskUtils.js +1 -1
- package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/undoRecords.js +5 -0
- package/views/SceneView.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webdoc/support/SlideThumbnail.js +1 -1
- package/widgets/Bookmarks/BookmarksUserState.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +4 -0
- package/widgets/CatalogLayerList.d.ts +4 -0
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm/support/textManipulationUtils.js +1 -1
- package/widgets/FeatureTable/VisibleElements.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
- package/assets/esri/core/workers/chunks/50936725c9bd23b780ef.js +0 -1
- package/assets/esri/core/workers/chunks/5c8c5290b9fcb5a4468f.js +0 -1
- package/assets/esri/core/workers/chunks/7745209175eb744aee5c.js +0 -1
- package/assets/esri/core/workers/chunks/80b1b1e8f3f7b9d2ad20.js +0 -1
- package/assets/esri/core/workers/chunks/aa020d495f464eff0134.js +0 -1
- package/assets/esri/core/workers/chunks/bf2af659da8e33d3c8bf.js +0 -1
- package/assets/esri/core/workers/chunks/cbb3a56e4072cdf25a9d.js +0 -1
- package/assets/esri/core/workers/chunks/fb48e8e42379fdf8a094.js +0 -1
- package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
- package/views/3d/support/MapCoordsHelper.js +0 -5
- package/widgets/Bookmarks/bookmarkUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Evented.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{after as r}from"../../../core/promiseUtils.js";import{toUnit as n}from"../../../core/quantityUtils.js";import{watch as s,sync as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,j as l,c as p,o as u}from"../../../chunks/vec32.js";import{create as _,fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as m}from"../../../geometry/projection.js";import{projectPointToVector as f}from"../../../geometry/projection/projectPointToVector.js";import{isEarth as P}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as v}from"../../ViewingMode.js";import{EnvironmentRenderer as y}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as w}from"../support/earthUtils.js";import{computeColorAndIntensity as U,computeVirtualLightDirection as b,computeShadowsEnabled as R,ColorAndIntensity as T}from"../support/sunUtils.js";import{Update as C}from"../webgl-engine/lib/Update.js";import{MainLight as M,AmbientLight as S,FillLight as j}from"../webgl-engine/lighting/Lightsources.js";import{euclideanDirectDistanceBetweenPoints as G}from"../../support/euclideanLengthMeasurementUtils.js";import H from"../../../geometry/SpatialReference.js";let L=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new M,this._ambientLight=new S,this._moonLight=new j,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePositionGeographic=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===v.Global&&P(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionGeographic(){return this._referencePositionGeographic}connectView(e){if(this._renderer)return;this._renderer=new y({view:e});const t=()=>this._updateRenderParameters(),i=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),o),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),o),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,o),s((()=>e.qualitySettings.ambientOcclusion),t,o),s((()=>e.qualitySettings.reflections),t,o),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),o),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,C.Faded)),o),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,C.Faded)),o),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),a),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),a),s((()=>e.state.camera),i,a),s((()=>this.disableQueries),i)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=i(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const i=this._view.spatialReference;if(!m(i,H.WGS84)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePositionGeographic){const e=w(this._referencePositionGeographic,k);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const i=t.stateManager.camera;i&&(this._cameraHandlerClientSide(i,e)||this._cameraHandlerServerSide(i))}_cameraHandlerClientSide(e,t){const i=P(this._view.spatialReference);if(i&&!m(this._view.spatialReference,H.WGS84))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const r=e.position;return this._referencePositionGeographic??=_(),i?f(r,this._referencePositionGeographic,H.WGS84):d(this._referencePositionGeographic,r.longitude??0,r.latitude??0,r.z??0),this.notifyChange("referencePositionGeographic"),this._autoUpdateTimezone(this._referencePositionGeographic,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePositionGeographic&&(this._referencePositionGeographic[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=C.Immediate){const i=this._view;e=e||("virtual"===i.environment.lighting.type?null:i.environment.lighting.date);const r=this._referencePositionGeographic,n=r?q:E,s=this.weatherVisible?i.environment.weather.type:"disabled";null!=r?U(e,r,i.state.viewingMode,s,i.state.camera,n):"virtual"===i.environment.lighting.type&&b(i.state.camera,i.state.viewingMode,n.direct.directionToLightSource);const o=this._mainLight,a=n.direct;l(o.intensity,a.color,a.intensity*Math.PI),p(o.direction,a.directionToLightSource),o.specularStrength=n.specularStrength,o.environmentStrength=n.environmentStrength;const h=this._ambientLight;l(h.intensity,n.ambient.color,n.ambient.intensity);const c=this._moonLight;u(c.intensity,D,V,n.globalFactor);const d=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));l(c.intensity,c.intensity,d),p(c.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,c],n.noonFactor,n.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=Q;i.setTime((t||this._view.environment.lighting.date).getTime());const r=w(e,k);if(null==r)return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===r.hours&&n.minutes===r.minutes&&n.seconds===r.seconds)return!1}else n=r;const s=i.getUTCHours()-(r.hours-n.hours),o=i.getUTCMinutes()-(r.minutes-n.minutes),a=i.getUTCSeconds()-(r.seconds-n.seconds);return i.setUTCHours(s),i.setUTCMinutes(o),i.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(i,r)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePositionGeographic||R(this._referencePositionGeographic[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePositionGeographic=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=r(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=r(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePositionGeographic?d(this._referencePositionGeographic,t[0],t[1],e):this._referencePositionGeographic=g(t[0],t[1],e),this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePositionGeographic)||this._updateLighting(),this.notifyChange("referencePositionGeographic")}_exceedsReferencePosDistThreshold(e){const t=this._referencePosMapCoords;if(null==t)return!0;const i=G(t,e);if(null==i)return!0;return n(i,"meters").value>this._referencePointUpdateDistThreshold}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){}};e([h({type:Boolean,readOnly:!0})],L.prototype,"updating",null),e([h()],L.prototype,"disableQueries",void 0),e([h()],L.prototype,"_disableWeather",void 0),e([h()],L.prototype,"weatherEnabled",null),e([h()],L.prototype,"weatherVisible",null),e([h()],L.prototype,"referencePositionGeographic",null),e([h()],L.prototype,"_renderer",void 0),e([h()],L.prototype,"_referencePositionGeographic",void 0),L=e([c("esri.views.3d.environment.SceneViewEnvironmentManager")],L);const q=new T,E=new T,Q=new Date,k={hours:0,minutes:0,seconds:0},D=g(.22,.22,.33),V=g(.22,.22,.22);export{L as SceneViewEnvironmentManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Evented.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{after as r}from"../../../core/promiseUtils.js";import{toUnit as n}from"../../../core/quantityUtils.js";import{watch as s,sync as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as h}from"../../../core/unitUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as l,j as p,c as u,o as _}from"../../../chunks/vec32.js";import{create as g,fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as P,initializeProjection as v}from"../../../geometry/projection.js";import{projectPointToVector as y}from"../../../geometry/projection/projectPointToVector.js";import{isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as U}from"../../ViewingMode.js";import{EnvironmentRenderer as b}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as R}from"../support/earthUtils.js";import{computeColorAndIntensity as T,computeVirtualLightDirection as C,computeShadowsEnabled as M,ColorAndIntensity as S}from"../support/sunUtils.js";import{Update as j}from"../webgl-engine/lib/Update.js";import{MainLight as G,AmbientLight as L,FillLight as H}from"../webgl-engine/lighting/Lightsources.js";import{euclideanDirectDistanceBetweenPoints as q}from"../../support/euclideanLengthMeasurementUtils.js";import E from"../../../geometry/SpatialReference.js";let Q=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new G,this._ambientLight=new L,this._moonLight=new H,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePositionGeographic=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===U.Global&&w(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionGeographic(){return this._referencePositionGeographic}connectView(e){if(this._renderer)return;this._renderer=new b({view:e});const t=()=>this._updateRenderParameters(),i=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),o),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),o),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,o),s((()=>e.qualitySettings.ambientOcclusion),t,o),s((()=>e.qualitySettings.reflections),t,o),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),o),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,j.Faded)),o),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,j.Faded)),o),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),a),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),a),s((()=>e.state.camera),i,a),s((()=>this.disableQueries),i)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=i(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const i=this._view.spatialReference;if(!P(i,E.WGS84)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePositionGeographic){const e=R(this._referencePositionGeographic,A);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const i=t.stateManager.camera;i&&(this._cameraHandlerClientSide(i,e)||this._cameraHandlerServerSide(i))}_cameraHandlerClientSide(e,t){const i=w(this._view.spatialReference);if(i&&!P(this._view.spatialReference,E.WGS84))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const r=e.position;return this._referencePositionGeographic??=g(),i?y(r,this._referencePositionGeographic,E.WGS84):l(this._referencePositionGeographic,r.longitude??0,r.latitude??0,r.z??0),this.notifyChange("referencePositionGeographic"),this._autoUpdateTimezone(this._referencePositionGeographic,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;if((!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._referencePositionGeographic){const{spatialReference:e,z:i}=t;this._referencePositionGeographic[2]=(i??0)*h(e,f(e).metersPerDegree),this._referencePosChanged()}}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=j.Immediate){const i=this._view;e=e||("virtual"===i.environment.lighting.type?null:i.environment.lighting.date);const r=this._referencePositionGeographic,n=r?k:D,s=this.weatherVisible?i.environment.weather.type:"disabled";null!=r?T(e,r,i.state.viewingMode,s,i.state.camera,n):"virtual"===i.environment.lighting.type&&C(i.state.camera,i.state.viewingMode,n.direct.directionToLightSource);const o=this._mainLight,a=n.direct;p(o.intensity,a.color,a.intensity*Math.PI),u(o.direction,a.directionToLightSource),o.specularStrength=n.specularStrength,o.environmentStrength=n.environmentStrength;const h=this._ambientLight;p(h.intensity,n.ambient.color,n.ambient.intensity);const c=this._moonLight;_(c.intensity,x,z,n.globalFactor);const d=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));p(c.intensity,c.intensity,d),u(c.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,c],n.noonFactor,n.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=V;i.setTime((t||this._view.environment.lighting.date).getTime());const r=R(e,A);if(null==r)return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===r.hours&&n.minutes===r.minutes&&n.seconds===r.seconds)return!1}else n=r;const s=i.getUTCHours()-(r.hours-n.hours),o=i.getUTCMinutes()-(r.minutes-n.minutes),a=i.getUTCSeconds()-(r.seconds-n.seconds);return i.setUTCHours(s),i.setUTCMinutes(o),i.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(i,r)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePositionGeographic||M(this._referencePositionGeographic[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePositionGeographic=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=r(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=r(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=this._referencePosMapCoords;if(await v(t.spatialReference,E.WGS84),e())return;const i=this._referencePositionGeographic??=g();y(t,i,E.WGS84)&&this._referencePosChanged()}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePositionGeographic)||this._updateLighting(),this.notifyChange("referencePositionGeographic")}_exceedsReferencePosDistThreshold(e){const t=this._referencePosMapCoords;if(null==t)return!0;const i=q(t,e);if(null==i)return!0;return n(i,"meters").value>this._referencePointUpdateDistThreshold}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){}};e([c({type:Boolean,readOnly:!0})],Q.prototype,"updating",null),e([c()],Q.prototype,"disableQueries",void 0),e([c()],Q.prototype,"_disableWeather",void 0),e([c()],Q.prototype,"weatherEnabled",null),e([c()],Q.prototype,"weatherVisible",null),e([c()],Q.prototype,"referencePositionGeographic",null),e([c()],Q.prototype,"_renderer",void 0),e([c()],Q.prototype,"_referencePositionGeographic",void 0),Q=e([d("esri.views.3d.environment.SceneViewEnvironmentManager")],Q);const k=new S,D=new S,V=new Date,A={hours:0,minutes:0,seconds:0},x=m(.22,.22,.33),z=m(.22,.22,.22);export{Q as SceneViewEnvironmentManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{initial as r}from"../../../../core/reactiveUtils.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 s}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{MeshTransformUpdateAction as p}from"../../../../layers/graphics/sources/interfaces.js";import{getGraphicEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as c}from"../manipulatorUtils.js";import{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{initial as r}from"../../../../core/reactiveUtils.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 s}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{MeshTransformUpdateAction as p}from"../../../../layers/graphics/sources/interfaces.js";import{getGraphicEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as c}from"../manipulatorUtils.js";import{createGraphicGeometryUndoRecord as h}from"./undoRecords.js";import{GraphicState as d}from"../../layers/graphics/GraphicState.js";import{GraphicManipulator as m}from"../../../interactive/GraphicManipulator.js";import{EditGeometryOperations as g}from"../../../interactive/editGeometry/EditGeometryOperations.js";const l=Symbol();let u=class extends e.EventedAccessor{get operations(){return this._operations}get updating(){return this._updatingHandles.updating}get elevationInfo(){return n(this.graphic)}get visible(){return this._graphicState.displaying}get isDraped(){return this._graphicState.isDraped}get origin(){return c(this.view,this.graphic)}constructor(t){super(t),this._updatingHandles=new a}destroy(){this._operations=i(this._operations),this._updatingHandles.destroy()}initialize(){this._graphicState=new d({graphic:this.graphic}),this._graphicState.on("changed",(()=>this.emit("committed"))),this.addHandles(this.view.trackGraphicState(this._graphicState)),this.addHandles(this._updatingHandles.add((()=>this.graphic.geometry),(t=>{const e=this._operations?.data.geometry;if(t!==e){if(!t||"multipoint"===t?.type||"extent"===t?.type)return i(this._operations),this.removeHandles(l),void(this._operations=null);if(this._operations?.trySetGeometry(t))this.emit("modified-externally");else{i(this._operations),this.removeHandles(l);const e=g.fromGeometry(t,this.view.state.viewingMode);this._operations=e,this.addHandles(e.data.on("change",(()=>this.graphic.geometry=e.data.geometry)),l)}}}),r))}createManipulator(t){return new m({view:this.view,graphic:this.graphic,...t})}maskOccludee(){return this.view.maskOccludee(this.graphic)}endInteraction(){const t=this.graphic.geometry;"mesh"===t?.type&&this.graphic.notifyMeshTransformChanged({action:p.UpdateFastLocalOrigin})}toMap(t){return this.view.toMap(t,{include:[this.graphic]})}createUndoRecord(){const{graphic:{geometry:t}}=this;return h(t)}};t([o({constructOnly:!0})],u.prototype,"view",void 0),t([o({constructOnly:!0})],u.prototype,"graphic",void 0),t([o()],u.prototype,"_operations",void 0),t([o()],u.prototype,"operations",null),t([o()],u.prototype,"updating",null),u=t([s("esri.views.3d.interactive.editingTools.ManipulatedObject3DGraphic")],u);export{u as ManipulatedObject3DGraphic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import o from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{zeroMeters as s,scale as a}from"../../../../../core/quantityUtils.js";import{watch as l,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as m}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as u}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{orientation as f}from"../geometryUtils.js";import{SupportedObjectResult as v}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as M}from"../tooltipUtils3D.js";import{createVisualElements as b}from"../visualElementUtils.js";import{discRadius as y}from"../manipulations/config.js";import{ManipulationType as T,MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as I}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as S}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as A}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as R}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class V{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),B=Symbol("tooltips");let J=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new e,this.objects=new o,this.enableZ=!0,this.sketchOptions=new U,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new h,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("after-changes",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=n(this.tooltip),this._moveManipulation=n(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!A(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=g(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(O(e)!==v.SUPPORTED)continue;const t=new K(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new S({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(T.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,T.XY,o,e,i,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?w.radiusForSymbol(t[0].object.graphic?.symbol):y});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),q)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=s)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(e(T.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(T.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(T.Z));const i=()=>this._updateMoveManipulation(t);for(const s of t)this.addHandles([s.object.on("committed",i),l((()=>s.object.visible),i)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:a}=n,{operations:r}=a;if(r){const e=a.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),a.elevationInfo,r.data.spatialReference,e),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,n=b({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>i()});null!=n&&(o.geometryRepresentation=n.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),l((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(n,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=f(g(t.object)))}_updateMoveManipulation(t){const o=m(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&_(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===T.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=P(l),this.events.emit("move-start",new V(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(B),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new D({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onMoveStart:()=>{e.emit("record-undo",{objects:[o]}),e.emit("move-start",new V([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new N([o]))};t=M(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=l((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),r);this.addHandles(t,B)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case T.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new R({sketchOptions:e}),Q(this._latestTooltipInfo,o,((t,o)=>F(t,o)));break;case T.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new Z({sketchOptions:e}),Q(this._latestTooltipInfo,o,((t,e)=>a(F(t,e),I(o))));break;case T.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new C({sketchOptions:e}),Q(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_buildSnappingPipelineSteps(t,o,e,i,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.anchor).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new d,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=u(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([p()],J.prototype,"objects",void 0),t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([p({constructOnly:!0,type:U})],J.prototype,"sketchOptions",void 0),t([p({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([p()],J.prototype,"type",void 0),t([p()],J.prototype,"updating",null),t([p()],J.prototype,"_latestTooltipInfo",void 0),t([p()],J.prototype,"_shouldShowMovePointTooltip",null),t([p()],J.prototype,"activeTooltipInfo",null),J=t([c("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);class K{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function Q(t,o,e){if(null==o||"end"===o.action)return void(t.distance=s);const{mapStart:i,mapEnd:n}=o,a=e(i,n);t.distance=null!=a?a:s}export{L as MoveEvent,V as MoveStartEvent,N as MoveStopEvent,J as MoveTool3D};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{orientation as v}from"../geometryUtils.js";import{SupportedObjectResult as _}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as M}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as b}from"../tooltipUtils3D.js";import{createVisualElements as y}from"../visualElementUtils.js";import{discRadius as T}from"../manipulations/config.js";import{ManipulationType as w,MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as U,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import X from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as A}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as D}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as R}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as V}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class L{constructor(t){this.objects=t,this.type="move-start"}}class N{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class q{constructor(t){this.objects=t,this.type="move-stop"}}const B=Symbol("manipulators"),J=Symbol("tooltips");let K=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new X,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("change",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!D(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=g(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(x(e)!==_.SUPPORTED)continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(M(t.object),o)}}_refreshManipulators(){if(this.removeHandles(B),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(w.XY):this._hideTooltip()}))],B)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,w.XY,o,e,i,n))),B)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):T});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),B)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=a)}))],B)};this._moveManipulation.xyManipulation.forEachManipulator(e(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(w.Z));const i=()=>this._updateMoveManipulation(t);for(const a of t)this.addHandles([a.object.on("committed",i),r((()=>a.object.visible),i)],B);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),B);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),s.elevationInfo,l.data.spatialReference,e),B)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=y({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),r((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],B),this.addHandles(i,B))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=v(g(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===w.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new q(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=U(l),p=P(l),this._emitRecordUndo(),this.events.emit("move-start",new L(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new N(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new q(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(J),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new R({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new L([o]))},onMove:()=>e.emit("move",new N(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new q([o]))};t=b(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=r((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),p);this.addHandles(t,J)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case w.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,o)=>V(t,o)));break;case w.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,e)=>l(V(t,e),S(o))));break;case w.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_emitRecordUndo(){const t=this.objects.toArray().map((t=>t.createUndoRecord?.())).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.anchor).clone(),l=new Y({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new f,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=A({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=d(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),t([c()],K.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:X})],K.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],K.prototype,"snappingManager",void 0),t([c()],K.prototype,"type",void 0),t([c()],K.prototype,"updating",null),t([c()],K.prototype,"_latestTooltipInfo",void 0),t([c()],K.prototype,"_shouldShowMovePointTooltip",null),t([c()],K.prototype,"activeTooltipInfo",null),K=t([h("esri.views.3d.interactive.editingTools.move.MoveTool3D")],K);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{N as MoveEvent,L as MoveStartEvent,q as MoveStopEvent,K as MoveTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{zeroMeters as e,createLength as o,scale as
|
|
5
|
+
import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{zeroMeters as e,createLength as o,scale as i}from"../../../../../core/quantityUtils.js";import{watch as n,syncAndInitial as s,sync as r}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../../core/unitUtils.js";import{projectPoint as p}from"../../../../../geometry/support/plane.js";import{sv3d as l}from"../../../../../geometry/support/vectorStacks.js";import{manipulatedObjectGeometry as c}from"../manipulatedObjectUtils.js";import{updateXYZFromTooltipInfo as m,updateTooltipInfoFromManipulatedObject as f,updateElevationFromPoint as u}from"../tooltipUtils3D.js";import{ManipulationType as y}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as v}from"../manipulations/moveUtils.js";import{AccumulationBehavior as d}from"../../../../interactive/editGeometry/interfaces.js";import{connectPasteEvent as h,getXYZDeltasFromTooltipInfo as T}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as k}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{ReshapeEdgeOffsetTooltipInfo as g}from"../../../../interactive/tooltip/infos/ReshapeEdgeOffsetTooltipInfo.js";import{SelectedVertexTooltipInfo as j}from"../../../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as I}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as O}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as w}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoArea2D as b}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoLength2D as x,autoDistanceBetweenPoints2D as U}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as M}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as L}from"../../../../support/geodesicLengthMeasurementUtils.js";function S(t,e){const o=e?.type;return{edgeOffset:new g({sketchOptions:t,viewType:o}),movePoint:new k({sketchOptions:t,viewType:o}),selectedVertex:new j({sketchOptions:t,viewType:o}),translate:new I({sketchOptions:t,viewType:o}),translateXY:new O({sketchOptions:t,viewType:o}),translateZ:new w({sketchOptions:t,viewType:o})}}function X(e,o,i){function a(){const t=i(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let p=!1;function l(t){p=!0,V(o,t),e.info=t.activeTooltipInfo,p=!1}return t([n(a,l,s),n((()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,activeTooltipInfo:e,key:e.key,geometry:c(o)}}),((t,e)=>{t&&!p&&e&&e.key!==t.key&&E(t.activeTooltipInfo,o,t.context)}),r),o.on("committed",(()=>l(a()))),h(e)])}function E(t,e,{selectedVertexManipulatorInfo:o,callbacks:i}){const n=c(e);switch(n?.type){case"mesh":"move-point"===t.type&&m(t,n.origin,e,i);break;case"point":"move-point"===t.type&&m(t,n,e,i);break;case"polyline":case"polygon":"selected-vertex"===t.type&&R(t,o,e,i)}}function R(t,e,o,i){if("vertex"!==e?.type)return;const{dx:n,dy:s,dz:r}=T(t,e.manipulator.location);0===n&&0===s&&0===r||(i.onReshapeStart?.(),o.operations?.moveVertices([e.handle],n,s,r,d.NEW_STEP),i.onReshape?.(),i.onReshapeStop?.())}function V(t,{activeTooltipInfo:e,selectedVertexManipulatorInfo:o,sketchOptions:i}){if(e)switch(e.sketchOptions=i,e?.type){case"move-point":f(e,t);break;case"selected-vertex":Y(e,o,t)}}function Y(t,e,o){if(!t||"selected-vertex"!==t.type)return;const i=e?.manipulator.location;t.setLocationFromPoint(i),u(t,i,o);const n=o.operations?.data.geometry;switch(n?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=b(n);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=x(n),t.area.visible=!1}}function Z(t,e,{sketchOptions:o,tooltipInfos:n}){let s=null;switch(t){case y.XY:s=n.translate,P(s,e,((t,e)=>U(t,e)));break;case y.XY_AXIS:s=n.translateXY,P(s,e,((t,o)=>i(U(t,o),v(e))));break;case y.Z:s=n.translateZ,P(s,e,M)}return s.sketchOptions=o,s}function P(t,o,i){if(null!=o&&"end"!==o.action){const{mapStart:n,mapEnd:s}=o,r=i(n,s);t.distance=null!=r?r:e}else t.distance=e}function A(t,o,{sketchOptions:i,tooltipInfos:n}){const s=n.edgeOffset;if(s.distance=e,null!=o&&"end"!==o.action){const e=t.operations,{mapEnd:i,signedDistance:n,operation:r}=o;if(null!=n&&null!=e){const o=e.data.coordinateHelper,a=n*r.selectedArrow;s.distance=D(t.isDraped,a,i,r.plane,o)}}const r=t.operations?.data.geometry;return s.area="polygon"===r?.type?b(r):null,s.totalLength="polyline"===r?.type?x(r):null,s.sketchOptions=i,s}function D(t,e,i,n,s){if(t){const t=s.toXYZ(s.pointToVector(i)),r=p(n,t,l.get()),a=L(r,t,s.spatialReference);if(null!=a)return o(a.value*Math.sign(e),a.unit)}return o(e*a(i.spatialReference),"meters")}export{X as connectTooltipToManipulatedObject,S as createTooltipInfos,A as getUpdatedEdgeOffsetTooltipInfo,Z as getUpdatedTranslateObjectTooltipInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as t}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as e,sync as
|
|
5
|
+
import{handlesGroup as t}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as e,sync as i}from"../../../../core/reactiveUtils.js";import{manipulatedObjectGeometry as n}from"./manipulatedObjectUtils.js";import{AccumulationBehavior as r}from"../../../interactive/editGeometry/interfaces.js";import{connectPasteEvent as s,updateMeshTransformFromTooltipInfo as c,getXYZDeltasFromTooltipInfo as a,updateTooltipInfoFromMeshTransform as l}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";function m(r,c,a){function l(){const t=a(),o=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:o}}let p=!1;function m({activeTooltipInfo:t,sketchOptions:o}){p=!0,t&&(t.sketchOptions=o,v(t,c)),r.info=t,p=!1}return t([o(l,m,e),o((()=>{const t=l(),{activeTooltipInfo:o}=t;if(o)return{context:t,activeTooltipInfo:o,key:o.key,geometry:n(c)}}),((t,o)=>{t&&!p&&o&&o.key!==t.key&&f(t.activeTooltipInfo,c,t.context)}),i),c.on("committed",(()=>m(l()))),s(r)])}function f(t,o,{callbacks:e}){const i=n(o);switch(i?.type){case"mesh":u(t,i.origin,o,e),"orientation"in t&&"scale"in t&&c(t,i,e);break;case"point":u(t,i,o,e)}}function u(t,o,e,i){const{dx:n,dy:s,dz:c}=a(t,o);0===n&&0===s&&0===c||(i.onMoveStart?.(),e.operations?.move(n,s,c,r.NEW_STEP),i.onMove?.(n,s,c),i.onMoveStop?.())}function v(t,o){const e=n(o);if(!t||!e||"mesh"!==e.type&&"point"!==e.type)return;const i="mesh"===e.type,r=i?e.origin:e;t.setLocationFromPoint(r),y(t,r,o),"transform-mesh"===t.type&&i&&l(t,e),t.clearInputValues()}function y(t,o,e){t.elevation.actual=p(o),t.elevation.visible=!!e.operations?.data.coordinateHelper.hasZ(),t.elevation.readOnly=!1,t.elevation.showAsZ=!0}export{m as connectTooltipToManipulatedObject,y as updateElevationFromPoint,v as updateTooltipInfoFromManipulatedObject,u as updateXYZFromTooltipInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{deg2rad as o,rad2deg as i}from"../../../../../core/mathUtils.js";import{when as r,sync as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as l,angle as c}from"../../../../../geometry/support/axisAngleDegrees.js";
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{deg2rad as o,rad2deg as i}from"../../../../../core/mathUtils.js";import{when as r,sync as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as l,angle as c}from"../../../../../geometry/support/axisAngleDegrees.js";let p=class extends e{constructor(t){super(t),this._interactionState=null}initialize(){this.addHandles([r((()=>{const t=this._interactionState;return t&&t.angle!==t.previousAngle?{interactionState:t,angle:t.state.angle}:null}),(({interactionState:t})=>{this._updateMeshRotation(t)}),n),r((()=>{const t=this._interactionState;return t&&t.scale!==t.previousScale?{interactionState:t,scale:t.state.scale}:null}),(({interactionState:t})=>{this._updateMeshSize(t)}),n)])}get initialAngle(){return this._interactionState?.initialAngle??0}get angle(){const t=this.geometry.transform;if(null==t)return this._interactionState?.angle??0;const e=l(t.rotation)[2];return Math.abs(e)>.999999?o(c(t.rotation))*Math.sign(e):0}get angleClockwise(){return-this.angle}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){return this._interactionState?.scale??1}startInteraction(){const t=new g({angle:this.angle});this._interactionState=t;const e=()=>{this._interactionState=null};return{state:t,done:e,cancel:()=>{t.cancel(),e()}}}createUndoRecord(){return this.object.createUndoRecord()}_updateMeshRotation(t){const{angle:e,previousAngle:o}=t;t.previousAngle=e;const r=i(e-o);this.geometry.rotate(0,0,r,{origin:this.geometry.anchor})}_updateMeshSize(t){const{scale:e,previousScale:o}=t;t.previousScale=e;const i=e/o,r=this.geometry.anchor;this.geometry.scale(i,{origin:r})}};t([s({constructOnly:!0})],p.prototype,"object",void 0),t([s({constructOnly:!0})],p.prototype,"geometry",void 0),t([s({constructOnly:!0})],p.prototype,"viewingMode",void 0),t([s()],p.prototype,"initialAngle",null),t([s()],p.prototype,"angle",null),t([s()],p.prototype,"angleClockwise",null),t([s()],p.prototype,"relativeAngle",null),t([s()],p.prototype,"relativeAngleClockwise",null),t([s()],p.prototype,"scale",null),t([s()],p.prototype,"_interactionState",void 0),p=t([a("esri.views.3d.interactive.editingTools.transform.ScaleRotateMeshAdapter")],p);let g=class extends e{get state(){const{angle:t,scale:e}=this;return{angle:t,scale:e}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=t.angle,this.previousAngle=t.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};t([s()],g.prototype,"angle",void 0),t([s()],g.prototype,"initialAngle",void 0),t([s()],g.prototype,"previousAngle",void 0),t([s()],g.prototype,"previousScale",void 0),t([s()],g.prototype,"scale",void 0),t([s()],g.prototype,"state",null),g=t([a("esri.views.3d.interactive.editingTools.transform.ScaleRotateMeshAdapter.InteractionState")],g);export{p as ScaleRotateMeshAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as d,watch as u}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as T,f as j,l as w,a as R,b as I,g as k}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as F,getNormal as C}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as dt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ut}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{Tooltip as vt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=new vt({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),d),u((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()}))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,F()))).next((t=>{const a=C(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{record:this.adapter.createUndoRecord()})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(kt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),u((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),d)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const d=e.info;d.sketchOptions=t,d.orientation=c?l(r,"radians","geographic"):void 0,d.orientationPrecision=Et(o?.valueType),d.rotationType=o?.rotationType??"geographic",d.size=h?p(n,"meters"):void 0,d.sizeUnit=i?.unit,d.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>dt(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),d=this._createMaterial(.33),u=e(X+at),m=e(X+ot),g=i(u,it,p),f=i(m,it,d),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,d);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:ut.Transparent,isDecoration:!0});return this.addHandles(u((()=>({color:a(this.tool.view.effectiveTheme.accentColor,t)})),(t=>e.setParameters(t)),d)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=I(x.get(),l,C(e)),p=i,h=k(x.get(),p,c),d=wt(a,o,x.get()),u=n,m=wt(h,o,x.get()),g=j(x.get(),m,u),f=j(x.get(),n,d),_=P(u,g),v=P(d,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function It(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function kt(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as u,watch as d}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as T,f as j,l as w,a as R,b as I,g as k}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as F,getNormal as C}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as ut}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as dt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{Tooltip as vt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=new vt({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),u),d((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()}))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,F()))).next((t=>{const a=C(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(kt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),d((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),u)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const u=e.info;u.sketchOptions=t,u.orientation=c?l(r,"radians","geographic"):void 0,u.orientationPrecision=Et(o?.valueType),u.rotationType=o?.rotationType??"geographic",u.size=h?p(n,"meters"):void 0,u.sizeUnit=i?.unit,u.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>ut(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),d=e(X+at),m=e(X+ot),g=i(d,it,p),f=i(m,it,u),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,u);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:dt.Transparent,isDecoration:!0});return this.addHandles(d((()=>({color:a(this.tool.view.effectiveTheme.accentColor,t)})),(t=>e.setParameters(t)),u)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=I(x.get(),l,C(e)),p=i,h=k(x.get(),p,c),u=wt(a,o,x.get()),d=n,m=wt(h,o,x.get()),g=j(x.get(),m,d),f=j(x.get(),n,u),_=P(d,g),v=P(u,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function It(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function kt(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as g}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as _}from"../tooltipUtils3D.js";import{createVisualElements as f}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as b}from"../manipulations/config.js";import{MoveManipulation as j,ManipulationType as y}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as S}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as M}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as R}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as w}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as A}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import O from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as x}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as k}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as U}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as E}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let z=class extends T{constructor(t){super(t),this.events=new o,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new O,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:o,view:a}=this;this.tooltip=new k({view:a}),this._moveManipulation=new j({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&v(o.operations,o.elevationInfo),radius:j.radiusForSymbol(o.graphic?.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles(e.events.on("immediate-click",(e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))));const s=o.elevationInfo;if(this._moveManipulation.elevationInfo=s,this.addHandles(g(o)),this._moveManipulation.createManipulatedObjectDragPipeline(((t,e,i,n,r)=>{if(t===y.XY){const{snappingStep:t,cancelSnapping:e}=I({snappingContext:new x({elevationInfo:s,pointer:r,editGeometryOperations:A.fromGeometry(new p({spatialReference:o.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new d,excludeFeature:o.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(e),i=i.next(w(this.view,s)).next(...t)}return{steps:i,cancel:n}}),o,(e=>{const{action:o,object:i,dxScreen:a,dyScreen:n}=e,s={object:i,dxScreen:a,dyScreen:n};switch(o){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(n((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new R({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions,tooltipEnabled:"mesh"!==u(o)?.type}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([f({view:this.view,object:o,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()}),o.on("committed",(()=>this._onGeometryChanged())),this._hideManipulatorsForObjectState(),n((()=>a.scale),(()=>this._updateMoveAngle()))].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof h&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))}));const r=a?.type,{sketchOptions:l}=this;this._meshTooltipInfo=new E({viewType:r,sketchOptions:l}),this._pointTooltipInfo=new H({viewType:r,sketchOptions:l});const c={object:o,dxScreen:0,dyScreen:0},m={onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:o,angle:e})},onRotate:e=>t.emit("rotate",{object:o,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:o,angle:e}),onScaleStart:(e,i)=>{this._emitRecordUndo(),t.emit("scale-start",{object:o,xScale:e,yScale:i})},onScale:(e,i)=>t.emit("scale",{object:o,xScale:e,yScale:i}),onScaleStop:(e,i)=>t.emit("scale-stop",{object:o,xScale:e,yScale:i})};this.addHandles(_(this.tooltip,this.object,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:m})))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!U(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){const t=u(this.object);return"mesh"===t?.type?new S({object:this.object,geometry:t,viewingMode:this.view.state.viewingMode}):new M({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.object.graphic?.layer)),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return n((()=>this.object.visible),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&v(this.object.operations,this.object.elevationInfo)}))}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating}get activeTooltipInfo(){return null!=this._scaleRotate?.tooltip?.info?null:"mesh"===u(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=t.state.viewingMode===c.Local||t.scale<b;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){m(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"object",void 0),t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"enableZ",void 0),t([s()],z.prototype,"enableRotation",void 0),t([s()],z.prototype,"enableScaling",void 0),t([s({constructOnly:!0,type:O})],z.prototype,"sketchOptions",void 0),t([s({value:!1})],z.prototype,"snapToScene",null),t([s({constructOnly:!0})],z.prototype,"snappingManager",void 0),t([s({readOnly:!0})],z.prototype,"type",void 0),t([s({readOnly:!0})],z.prototype,"updating",null),t([s()],z.prototype,"activeTooltipInfo",null),z=t([r("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],z);export{z as TransformTool3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isRelativeVertexSpace as t}from"../../../../geometry/support/meshVertexSpaceUtils.js";function r(e){return null!=e&&"mesh"===e.type?o(e):n(e)}function o(e){return t(e.vertexSpace)?i(e,e.transform,e.vertexSpace):l(e)}function n(e){let t=e,r=null;return{undo(e){r=e.geometry,e.geometry=t},redo(e){t=e.geometry,e.geometry=r}}}function i(t,r,o){let n=r?.clone(),i=e(o.origin),l=null,u=null;return{undo:()=>{l=t.transform?.clone(),u=e(o.origin),t.transform=n,t.vertexSpace.origin=i},redo:()=>{n=t.transform?.clone(),i=e(o.origin),t.transform=l,t.vertexSpace.origin=u}}}function l(e){let t,r=e.vertexAttributes.clonePositional();return{undo:()=>{t=e.vertexAttributes.clonePositional(),e.vertexAttributes=r},redo:()=>{r=e.vertexAttributes.clonePositional(),e.vertexAttributes=t}}}export{r as createGraphicGeometryUndoRecord};
|