UNPKG

4.2 kBTypeScriptView Raw
1import { Component } from '@antv/f-engine';
2import { ChartChildProps } from '../../chart';
3import { Scale } from '../../deps/f2-scale/src';
4export type ZoomRange = [number, number];
5export type ScaleValues = number[] | string[];
6export interface ZoomProps {
7 panSensitive?: number;
8 pinchSensitive?: number;
9 /**
10 * 缩放和平移模式
11 */
12 mode?: 'x' | 'y' | ['x', 'y'] | null;
13 /**
14 * 显示的范围
15 */
16 range?: ZoomRange;
17 /**
18 * 平移
19 */
20 pan?: boolean;
21 /**
22 * 缩放
23 */
24 pinch?: boolean;
25 /**
26 * 横扫
27 */
28 swipe?: boolean;
29 /**
30 * 横扫动画时长
31 */
32 swipeDuration?: number;
33 /**
34 * 事件回调
35 */
36 onPanStart?: Function;
37 onPinchStart?: Function;
38 onPan?: Function;
39 onPinch?: Function;
40 onPanEnd?: Function;
41 onPinchEnd?: Function;
42 onInit?: Function;
43 onChange?: Function;
44 /**
45 * 自动同步 x/y 的坐标值
46 */
47 autoFit?: boolean;
48 /**
49 * 最少展示数据量,用于控制最小缩放比例, 默认是10
50 */
51 minCount?: number;
52}
53export interface ZoomState {
54 range: {
55 x?: ZoomRange;
56 y?: ZoomRange;
57 };
58}
59declare const _default: (View: any) => {
60 new <P extends ZoomProps = ZoomProps, S extends ZoomState = ZoomState>(props: P): {
61 startRange: {
62 x?: ZoomRange;
63 y?: ZoomRange;
64 };
65 scale: {};
66 originScale: {};
67 minScale: number;
68 dims: Array<String>;
69 swipeEnd: {
70 startX: number;
71 startY: number;
72 endX: number;
73 endY: number;
74 };
75 loop: number;
76 didMount(): void;
77 willReceiveProps(nextProps: P): void;
78 willMount(): void;
79 willUpdate(): void;
80 didUnmount(): void;
81 _requestAnimationFrame(calllback: Function): number;
82 _cancelAnimationFrame(): void;
83 onPanStart: () => void;
84 onPan: (ev: any) => void;
85 onPanEnd: () => void;
86 onPinchStart: () => void;
87 onPinch: (ev: any) => void;
88 onPinchEnd: () => void;
89 _bindEvents(): void;
90 _unBindEvents(): void;
91 onStart: () => void;
92 update(): void;
93 animateSwipe(dim: string, dimRange: ZoomRange, velocity: number): void;
94 onSwipe: (ev: any) => void;
95 onEnd: () => void;
96 _doXPan(ev: any): ZoomRange;
97 _doYPan(ev: any): ZoomRange;
98 _doPan(ratio: number, dim: string): ZoomRange;
99 _doXPinch(ev: any): any;
100 _doYPinch(ev: any): any;
101 _doPinch(startRatio: number, endRatio: number, zoom: number, dim: string): any;
102 updateRange(originalRange: ZoomRange, dim: any): ZoomRange;
103 updateFollow(scales: Scale[], mainScale: Scale, data: any[]): void;
104 _getScale(dim: any): any;
105 _getFollowScales(dim: any): any[];
106 renderRange(range: any): void;
107 render(): import("@antv/f-engine").JSX.Element;
108 props: P & ChartChildProps<import("../../chart/Data").DataRecord>;
109 state: S;
110 context: import("@antv/f-engine").IContext;
111 refs: {
112 [key: string]: Component<import("@antv/f-engine").IProps, import("@antv/f-engine").IState>;
113 };
114 updater: import("@antv/f-engine/es/component/updater").Updater<S>;
115 container: import("@antv/g-lite").Group;
116 layout: import("@antv/f-engine").LayoutProps;
117 children: import("@antv/f-engine/es/canvas/vnode").VNode | import("@antv/f-engine/es/canvas/vnode").VNode[];
118 isMounted: boolean;
119 animate: boolean;
120 animator: import("@antv/f-engine/es/canvas/render/animator").default;
121 destroyed: boolean;
122 _vNode: import("@antv/f-engine/es/canvas/vnode").VNode;
123 shouldUpdate(_nextProps: P & ChartChildProps<import("../../chart/Data").DataRecord>): boolean;
124 didUpdate(): void;
125 willUnmount(): void;
126 setState(partialState: S, callback?: () => void): void;
127 forceUpdate(callback?: () => void): void;
128 setAnimate(animate: boolean): void;
129 destroy(): void; /**
130 * 横扫
131 */
132 };
133};
134export default _default;