All files / svg-transform/internal create-matrix.ts

100% Statements 3/3
100% Branches 1/1
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10          102x 102x 102x    
import { getOwnerSvg } from './get-owner-svg';
 
type MatrixValues = readonly [a: number, b: number, c: number, d: number, e: number, f: number];
 
export function createMatrix(element: SVGGraphicsElement, values: MatrixValues = [1, 0, 0, 1, 0, 0]): DOMMatrix {
  const matrix = getOwnerSvg(element).createSVGMatrix();
  [matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f] = values;
  return matrix;
}