import { IPathResultItem } from '../../typings' ; import { plus } from '../math/plus' ; export const computeZ = ( pathResult , pos ) : number [ ] => { const rLen = pathResult . length ; const lastItem = pathResult [ rLen - 1 ] ; if ( lastItem . type . toLowerCase ( ) === 'z' ) { return pos ; } const zpos = ( pathResult [ 0 ] . type === 'm' ) ? [ plus ( pathResult [ 0 ] . val [ 0 ] , pathResult [ 0 ] . from [ 0 ] ) , plus ( pathResult [ 0 ] . val [ 1 ] , pathResult [ 0 ] . from [ 1 ] ) ] : [ pathResult [ 0 ] . val [ 0 ] , pathResult [ 0 ] . val [ 1 ] ] ; pathResult . push ( { type : 'z' , from : pos . slice ( ) , val : [ ] , } ) ; return zpos ; } ;