How to use the @antv/matrix-util.vec2.vertical function in @antv/matrix-util

To help you get started, we’ve selected a few @antv/matrix-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / packages / component / src / axis / line.ts View on Github external
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);
  }