@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 720 B
JavaScript
import{isNone as t,unwrap as e}from"../../../../core/maybe.js";class i{constructor(t,e,i){this._editGeometry=t,this._vertex=e,this._pos=i}apply(){const e=t(this._originalPosition);e&&(this._originalPosition=this._vertex.pos),this._apply(e?"apply":"redo")}undo(){this._vertex.pos=e(this._originalPosition),this._editGeometry.notifyChanges({operation:"undo",updatedVertices:[this._vertex]})}accumulate(t){return t instanceof i&&t._vertex===this._vertex&&(this._pos=t._pos,this._apply("apply"),!0)}_apply(t){this._vertex.pos=this._pos,this._editGeometry.components.forEach((t=>t.unnormalizeVertexPositions())),this._editGeometry.notifyChanges({operation:t,updatedVertices:[this._vertex]})}}export{i as SetVertexPosition};