Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getScaledMatrix(shape, v, direct) {
let scaledMatrix;
shape.apply(v);
const x = v[0];
const y = v[1];
if (direct === 'x') {
shape.transform([
[ 't', -x, -y ],
[ 's', 0.01, 1 ],
[ 't', x, y ],
]);
const matrix = shape.getMatrix();
scaledMatrix = mat3.transform(matrix, [
[ 't', -x, -y ],
[ 's', 100, 1 ],
[ 't', x, y ],
]);
} else if (direct === 'y') {
shape.transform([
[ 't', -x, -y ],
[ 's', 1, 0.01 ],
[ 't', x, y ],
]);
const matrix = shape.getMatrix();
scaledMatrix = mat3.transform(matrix, [
[ 't', -x, -y ],
[ 's', 1, 100 ],
[ 't', x, y ],
]);
[ 't', x, y ],
]);
const matrix = shape.getMatrix();
scaledMatrix = mat3.transform(matrix, [
[ 't', -x, -y ],
[ 's', 100, 1 ],
[ 't', x, y ],
]);
} else if (direct === 'y') {
shape.transform([
[ 't', -x, -y ],
[ 's', 1, 0.01 ],
[ 't', x, y ],
]);
const matrix = shape.getMatrix();
scaledMatrix = mat3.transform(matrix, [
[ 't', -x, -y ],
[ 's', 1, 100 ],
[ 't', x, y ],
]);
} else if (direct === 'xy') {
shape.transform([
[ 't', -x, -y ],
[ 's', 0.01, 0.01 ],
[ 't', x, y ],
]);
const matrix = shape.getMatrix();
scaledMatrix = mat3.transform(matrix, [
[ 't', -x, -y ],
[ 's', 100, 100 ],
[ 't', x, y ],
]);