1 |
|
2 | import * as CanvasEngine from '@antv/g-canvas/lib';
|
3 | import * as SVGEngine from '@antv/g-svg/lib';
|
4 | import { registerEngine } from '@antv/g2/lib/core';
|
5 |
|
6 | export { registerScale, getScale, registerTickMethod } from '@antv/scale';
|
7 |
|
8 | import './extend/scale/scale';
|
9 |
|
10 |
|
11 | import './animations';
|
12 |
|
13 | export * from './theme';
|
14 |
|
15 | registerEngine('canvas', CanvasEngine);
|
16 | registerEngine('svg', SVGEngine);
|
17 |
|
18 |
|
19 | export * from '@antv/g2/lib/core';
|
20 | export const VERSION = '4.1.11';
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | const rawGetPointByClient = CanvasEngine.Canvas.prototype.getPointByClient;
|
28 |
|
29 | CanvasEngine.Canvas.prototype.getPointByClient = function(clientX, clientY) {
|
30 |
|
31 | const raw = rawGetPointByClient.call(this, clientX, clientY);
|
32 |
|
33 |
|
34 | const el = this.get('el');
|
35 | const bbox = el.getBoundingClientRect();
|
36 | const setWidth = this.get('width');
|
37 | const setHeight = this.get('height');
|
38 | const { width: realWidth, height: realHeight } = bbox;
|
39 |
|
40 | return {
|
41 | x: raw.x / (realWidth / setWidth),
|
42 | y: raw.y / (realHeight / setHeight),
|
43 | };
|
44 | };
|
45 |
|
46 |
|
47 | export { setDefaultErrorFallback } from './boundary/ErrorBoundary';
|