UNPKG

1.69 kBTypeScriptView Raw
1import { Coordinate, Point } from '../../dependents';
2import { CoordinateOption } from '../../interface';
3/**
4 * coordinate controller,职责:
5 * 1. 创建实例
6 * 2. 暂存配置
7 */
8export default class CoordinateController {
9 private option;
10 private coordinate;
11 constructor(option?: CoordinateOption);
12 /**
13 * 更新配置
14 * @param option
15 */
16 update(option: CoordinateOption): this;
17 /**
18 * 是否存在某一个 action
19 * @param actionName
20 */
21 hasAction(actionName: string): boolean;
22 /**
23 * 创建坐标系对象
24 * @param start 起始位置
25 * @param end 结束位置
26 * @return 坐标系实例
27 */
28 create(start: Point, end: Point): Coordinate;
29 /**
30 * 更新坐标系对象
31 * @param start 起始位置
32 * @param end 结束位置
33 * @return 坐标系实例
34 */
35 adjust(start: Point, end: Point): Coordinate;
36 /**
37 * 旋转弧度
38 * @param angle
39 */
40 rotate(angle: number): this;
41 /**
42 * 镜像
43 * @param dim
44 */
45 reflect(dim: 'x' | 'y'): this;
46 /**
47 * scale
48 * @param sx
49 * @param sy
50 */
51 scale(sx: number, sy: number): this;
52 /**
53 * 对角变换
54 */
55 transpose(): this;
56 /**
57 * 获取配置
58 */
59 getOption(): CoordinateOption;
60 /**
61 * 获得 coordinate 实例
62 */
63 getCoordinate(): Coordinate;
64 /**
65 * 包装配置的默认值
66 * @param option
67 */
68 private wrapperOption;
69 /**
70 * coordinate 实例执行 actions
71 * @params includeActions 如果没有指定,则执行全部,否则,执行指定的 action
72 */
73 private execActions;
74}