@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.2 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.components.forEach((t=>t.unnormalizeVertexPositions())),this._editGeometry.notifyChanges({operation:t,updatedVertices:this._vertices})}apply(){this._vertices.forEach((t=>this.operation.apply(t))),this._notifyChanges(this._undone?"redo":"apply")}undo(){this._vertices.forEach((t=>this.operation.undo(t))),this._undone=!0,this._notifyChanges("undo")}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach((t=>this.operation.accumulate(t,e.operation))),this.operation.accumulateParams(e.operation),this._notifyChanges("apply"),!0)}}var e;!function(t){t[t.CUMULATIVE=0]="CUMULATIVE",t[t.REPLACE=1]="REPLACE"}(e||(e={}));export{e as AccumulationType,t as UpdateVertices};