Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const factor = this.get('factor');
// if (Util.isArray(offset)) {
// return offset.map(value => value * factor);
// }
if (!Util.isNumber(offset)) {
return [0, 0];
}
const start = this.get('start');
const end = this.get('end');
const axisVector = this.getAxisVector();
const normal = vec2.normalize([], axisVector);
let direction = false;
if ((isVertical && start.y < end.y) || (!isVertical && start.x > end.x)) {
direction = true;
}
const verticalVector = vec2.vertical([], normal, direction);
return vec2.scale([], verticalVector, offset * factor);
}