@antv/coord

  • Version 0.4.0
  • Published
  • 182 kB
  • 3 dependencies
  • MIT license

Install

npm i @antv/coord
yarn add @antv/coord
pnpm add @antv/coord

Overview

Toolkit for mapping elements of sets into geometric objects.

Index

Classes

class Coordinate

class Coordinate {}

    constructor

    constructor(options?: Partial<Options>);
    • Create a new Coordinate Object.

      Parameter options

      Custom options

    method clear

    clear: () => void;
    • Clear transformations and update.

    method clone

    clone: () => Coordinate;
    • Returns a new Coordinate with same options.

      Returns

      Coordinate

    method getCenter

    getCenter: () => number[];
    • Returns the center of the bounding box of the coordinate.

      Returns

      [centerX, centerY]

    method getOptions

    getOptions: () => Options;
    • Returns current options.

      Returns

      options

    method getSize

    getSize: () => number[];
    • Returns the size of the bounding box of the coordinate.

      Returns

      [width, height]

    method invert

    invert: (vector: Vector2 | Vector) => Vector2 | Vector;
    • Apples invert transformations for the current vector.

      Parameter vector

      transformed vector2

      Parameter vector

      original vector2

    method map

    map: (vector: Vector2 | Vector) => Vector2 | Vector;
    • Apples transformations for the current vector.

      Parameter vector

      original vector2

      Returns

      transformed vector2

    method transform

    transform: (...args: Transformation) => this;
    • Add selected transformation.

      Parameter args

      transform type and params

      Returns

      Coordinate

    method update

    update: (options: Partial<Options>) => void;
    • Update options and inner state.

      Parameter options

      Options to be updated

    Type Aliases

    type Matrix3

    type Matrix3 = mat3;

      type Options

      type Options = {
      x?: number;
      y?: number;
      width?: number;
      height?: number;
      transformations?: Transformation[];
      };

        type Transformation

        type Transformation =
        | Translate
        | Cartesian
        | Custom
        | Matrix
        | Polar
        | Transpose
        | Scale
        | ShearX
        | ShearY
        | Reflect
        | ReflectX
        | ReflectY
        | Rotate
        | Helix
        | Parallel
        | Fisheye
        | FisheyeX
        | FisheyeY
        | FisheyeCircular;

          type Vector

          type Vector = number[];

            type Vector2

            type Vector2 = [number, number];

              Package Files (3)

              Dependencies (3)

              Dev Dependencies (19)

              Peer Dependencies (0)

              No peer dependencies.

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@antv/coord.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@antv/coord)
              • HTML
                <a href="https://www.jsdocs.io/package/@antv/coord"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>