UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 3.23 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{syncAndInitial 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};