UNPKG

1.55 kBTypeScriptView Raw
1import Layout from '../base/layout';
2import { Range, Point, Option } from './types';
3interface RectPoint {
4 x: number | [number, number];
5 y: number | [number, number];
6 y0?: number;
7 size?: number;
8}
9interface Rect {
10 xMin: number;
11 xMax: number;
12 yMin: number;
13 yMax: number;
14}
15/**
16 * 直角坐标系
17 * convert相关的方法,涉及将标准坐标系映射到实际坐标系内
18 * transform相关的方法,是仅将某一种关键点转换成另一种关键点 (比如将x/y/size/y0转换成yMin/yMax/..)
19 */
20declare class Base extends Layout {
21 type: string;
22 isPolar: boolean;
23 transposed: boolean;
24 center: Point;
25 x: Range;
26 y: Range;
27 constructor(option: Option);
28 update(option: Option): this;
29 isCyclic(): boolean;
30 _zoomVal(val: any, func: any): any;
31 /**
32 * 把归一后的值映射到对应的定义域
33 * @param point
34 */
35 convert(point: any): {
36 x: any;
37 y: any;
38 };
39 /**
40 * convert 的反处理,把定义域的值,反处理到归一的值
41 */
42 invert(point: any): {
43 [x: string]: any;
44 };
45 /**
46 * 把归一化的值映射到 canvas 的坐标点
47 * @param point
48 * @returns
49 */
50 convertPoint(point: any): {
51 x: any;
52 y: any;
53 };
54 /**
55 * 把canvas坐标的点位映射回归一的值
56 */
57 invertPoint(point: any): {
58 [x: string]: any;
59 };
60 convertRect(rectPoint: RectPoint): Rect;
61 transformToRect(rectPoint: RectPoint): Rect;
62}
63export default Base;