UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 971 B
import{equals as t}from"../../../../core/arrayUtils.js";import{f as s}from"../../../../chunks/vec2f64.js";import{u as a}from"../../../../chunks/vec2.js";import{AccumulationType as i}from"./UpdateVertices.js";class c{constructor(t,a,c,o,r=i.CUMULATIVE){this.origin=t,this.axis1=a,this.factor1=c,this.factor2=o,this._accumulationType=r,this.axis2=s(a[1],-a[0])}_scale(t,s,i){a(t.pos,t.pos,this.origin,this.axis1,s),a(t.pos,t.pos,this.origin,this.axis2,i)}apply(t){this._scale(t,this.factor1,this.factor2)}undo(t){this._scale(t,1/this.factor1,1/this.factor2)}canAccumulate(s){return s instanceof c&&t(this.origin,s.origin)&&t(this.axis1,s.axis1)}accumulate(t,s){s._accumulationType===i.REPLACE?this._scale(t,s.factor1/this.factor1,s.factor2/this.factor2):this._scale(t,s.factor1,s.factor2)}accumulateParams(t){const s=t._accumulationType===i.REPLACE;this.factor1=s?t.factor1:this.factor1*t.factor1,this.factor2=s?t.factor2:this.factor2*t.factor2}}export{c as ScaleVertex};