UNPKG

4.18 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 /**
44 * 自动同步 x/y 的坐标值
45 */
46 autoFit?: boolean;
47 /**
48 * 最少展示数据量,用于控制最小缩放比例, 默认是10
49 */
50 minCount?: number;
51}
52export interface ZoomState {
53 range: {
54 x?: ZoomRange;
55 y?: ZoomRange;
56 };
57}
58declare const _default: (View: any) => {
59 new <P extends ZoomProps = ZoomProps, S extends ZoomState = ZoomState>(props: P): {
60 startRange: {
61 x?: ZoomRange;
62 y?: ZoomRange;
63 };
64 scale: {};
65 originScale: {};
66 minScale: number;
67 dims: Array<String>;
68 swipeEnd: {
69 startX: number;
70 startY: number;
71 endX: number;
72 endY: number;
73 };
74 loop: number;
75 didMount(): void;
76 willReceiveProps(nextProps: P): void;
77 willMount(): void;
78 willUpdate(): void;
79 didUnmount(): void;
80 _requestAnimationFrame(calllback: Function): number;
81 _cancelAnimationFrame(): void;
82 onPanStart: () => void;
83 onPan: (ev: any) => void;
84 onPanEnd: () => void;
85 onPinchStart: () => void;
86 onPinch: (ev: any) => void;
87 onPinchEnd: () => void;
88 _bindEvents(): void;
89 _unBindEvents(): void;
90 onStart: () => void;
91 update(): void;
92 animateSwipe(dim: string, dimRange: ZoomRange, velocity: number): void;
93 onSwipe: (ev: any) => void;
94 onEnd: () => void;
95 _doXPan(ev: any): ZoomRange;
96 _doYPan(ev: any): ZoomRange;
97 _doPan(ratio: number, dim: string): ZoomRange;
98 _doXPinch(ev: any): any;
99 _doYPinch(ev: any): any;
100 _doPinch(startRatio: number, endRatio: number, zoom: number, dim: string): any;
101 updateRange(originalRange: ZoomRange, dim: any): ZoomRange;
102 updateFollow(scales: Scale[], mainScale: Scale, data: any[]): void;
103 _getScale(dim: any): any;
104 _getFollowScales(dim: any): any[];
105 renderRange(range: any): void;
106 render(): import("@antv/f-engine").JSX.Element;
107 props: P & ChartChildProps<import("../../chart/Data").DataRecord>;
108 state: S;
109 context: import("@antv/f-engine").IContext;
110 refs: {
111 [key: string]: Component<import("@antv/f-engine").IProps, import("@antv/f-engine").IState>;
112 };
113 updater: import("@antv/f-engine/es/component/updater").Updater<S>;
114 container: import("@antv/g-lite").Group;
115 layout: import("@antv/f-engine").LayoutProps;
116 children: import("@antv/f-engine/es/canvas/vnode").VNode | import("@antv/f-engine/es/canvas/vnode").VNode[];
117 isMounted: boolean;
118 animate: boolean;
119 animator: import("@antv/f-engine/es/canvas/render/animator").default;
120 destroyed: boolean;
121 _vNode: import("@antv/f-engine/es/canvas/vnode").VNode;
122 shouldUpdate(_nextProps: P & ChartChildProps<import("../../chart/Data").DataRecord>): boolean;
123 didUpdate(): void;
124 willUnmount(): void;
125 setState(partialState: S, callback?: () => void): void;
126 forceUpdate(callback?: () => void): void;
127 setAnimate(animate: boolean): void;
128 destroy(): void; /**
129 * 横扫
130 */
131 };
132};
133export default _default;