UNPKG

1.7 kBTypeScriptView Raw
1import { Options, Transformation, Vector2, Vector } from './type';
2export declare class Coordinate {
3 private output;
4 private input;
5 private options;
6 private transformers;
7 /**
8 * Create a new Coordinate Object.
9 * @param options Custom options
10 */
11 constructor(options?: Partial<Options>);
12 /**
13 * Update options and inner state.
14 * @param options Options to be updated
15 */
16 update(options: Partial<Options>): void;
17 /**
18 * Returns a new Coordinate with same options.
19 * @returns Coordinate
20 */
21 clone(): Coordinate;
22 /**
23 * Returns current options.
24 * @returns options
25 */
26 getOptions(): Options;
27 /**
28 * Clear transformations and update.
29 */
30 clear(): void;
31 /**
32 * Returns the size of the bounding box of the coordinate.
33 * @returns [width, height]
34 */
35 getSize(): number[];
36 /**
37 * Returns the center of the bounding box of the coordinate.
38 * @returns [centerX, centerY]
39 */
40 getCenter(): number[];
41 /**
42 * Add selected transformation.
43 * @param args transform type and params
44 * @returns Coordinate
45 */
46 transform(...args: Transformation): this;
47 /**
48 * Apples transformations for the current vector.
49 * @param vector original vector2
50 * @returns transformed vector2
51 */
52 map(vector: Vector2 | Vector): Vector2 | Vector;
53 /**
54 * Apples invert transformations for the current vector.
55 * @param vector transformed vector2
56 * @param vector original vector2
57 */
58 invert(vector: Vector2 | Vector): Vector2 | Vector;
59 private recoordinate;
60 private compose;
61 private createMatrixTransform;
62}