UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 994 B
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.parts.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)}}export{t as UpdateVertices};