UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.53 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 e}from"../../../chunks/tslib.es6.js";import{neverReached as t}from"../../../core/compilerUtils.js";import o from"../../../core/Evented.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";let n=class extends o.EventedAccessor{constructor(e){super(e),this.cancelled=!1,this.history={undo:[],redo:[]},this.type=null}get tool(){if(!this.activeComponent)return null;switch(this.activeComponent.type){case"graphic-mover":case"move-3d":return"move";case"box":case"transform-3d":return"transform";case"reshape":case"reshape-3d":return"reshape";case"draw-2d":case"draw-3d":return this.activeComponent.geometryType;default:t(this.activeComponent)}return null}addToHistory(e){this.history.redo=[],this.history.undo.push(e)}resetHistory(){this.history.redo=[],this.history.undo=[]}canUndo(){return this.history.undo.length>0}canRedo(){return this.history.redo.length>0}complete(){this._reset(),this.onEnd(),this.emit("complete")}cancel(){this.cancelled=!0,this.complete()}_reset(){this.activeComponent?.reset()}refreshComponent(){const e=this.activeComponent;e&&("box"!==e.type&&"reshape"!==e.type&&"graphic-mover"!==e.type||e.refresh())}set undo(e){this._set("undo",(()=>{this.canUndo()&&e()}))}set redo(e){this._set("redo",(()=>{this.canRedo()&&e()}))}};e([r()],n.prototype,"activeComponent",void 0),e([r()],n.prototype,"cancelled",void 0),e([r()],n.prototype,"history",void 0),e([r()],n.prototype,"tool",null),e([r()],n.prototype,"type",void 0),e([r()],n.prototype,"canUndo",null),e([r()],n.prototype,"canRedo",null),e([r()],n.prototype,"onEnd",void 0),e([r()],n.prototype,"undo",null),e([r()],n.prototype,"redo",null),e([r()],n.prototype,"toggleTool",void 0),e([r()],n.prototype,"addToSelection",void 0),e([r()],n.prototype,"removeFromSelection",void 0),n=e([s("esri.widgets.Sketch.support.OperationHandle")],n);let p=class extends n{};e([r()],p.prototype,"activeComponent",void 0),p=e([s("esri.widgets.Sketch.support.OperationHandle.CreateOperationHandle")],p);let i=class extends n{};e([r()],i.prototype,"activeComponent",void 0),i=e([s("esri.widgets.Sketch.support.OperationHandle.UpdateOperationHandle")],i);export{p as CreateOperationHandle,n as OperationHandle,i as UpdateOperationHandle};