1 |
|
2 | import { registerTheme } from './core';
|
3 | import { antvDark } from './theme/style-sheet/dark';
|
4 | import { createThemeByStyleSheet } from './theme/util/create-by-style-sheet';
|
5 | registerTheme('dark', createThemeByStyleSheet(antvDark));
|
6 |
|
7 | import * as CanvasEngine from '@antv/g-canvas';
|
8 | import * as SVGEngine from '@antv/g-svg';
|
9 | import { registerEngine } from './core';
|
10 | registerEngine('canvas', CanvasEngine);
|
11 | registerEngine('svg', SVGEngine);
|
12 |
|
13 | import { registerGeometry } from './core';
|
14 | import Area from './geometry/area';
|
15 | import Edge from './geometry/edge';
|
16 | import Heatmap from './geometry/heatmap';
|
17 | import Interval from './geometry/interval';
|
18 | import Line from './geometry/line';
|
19 | import Path from './geometry/path';
|
20 | import Point from './geometry/point';
|
21 | import Polygon from './geometry/polygon';
|
22 | import Schema from './geometry/schema';
|
23 | import Violin from './geometry/violin';
|
24 | registerGeometry('Polygon', Polygon);
|
25 | registerGeometry('Interval', Interval);
|
26 | registerGeometry('Schema', Schema);
|
27 | registerGeometry('Path', Path);
|
28 | registerGeometry('Point', Point);
|
29 | registerGeometry('Line', Line);
|
30 | registerGeometry('Area', Area);
|
31 | registerGeometry('Edge', Edge);
|
32 | registerGeometry('Heatmap', Heatmap);
|
33 | registerGeometry('Violin', Violin);
|
34 |
|
35 | import './geometry/shape/area/line';
|
36 | import './geometry/shape/area/smooth';
|
37 | import './geometry/shape/area/smooth-line';
|
38 | import './geometry/shape/edge/arc';
|
39 | import './geometry/shape/edge/smooth';
|
40 | import './geometry/shape/edge/vhv';
|
41 | import './geometry/shape/interval/funnel';
|
42 | import './geometry/shape/interval/hollow-rect';
|
43 | import './geometry/shape/interval/line';
|
44 | import './geometry/shape/interval/pyramid';
|
45 | import './geometry/shape/interval/tick';
|
46 | import './geometry/shape/line/step';
|
47 | import './geometry/shape/point/hollow';
|
48 | import './geometry/shape/point/image';
|
49 | import './geometry/shape/point/solid';
|
50 | import './geometry/shape/schema/box';
|
51 | import './geometry/shape/schema/candle';
|
52 | import './geometry/shape/polygon/square';
|
53 | import './geometry/shape/violin/smooth';
|
54 | import './geometry/shape/violin/hollow';
|
55 |
|
56 | import { registerGeometryLabel } from './core';
|
57 | import GeometryLabel from './geometry/label/base';
|
58 | import IntervalLabel from './geometry/label/interval';
|
59 | import PieLabel from './geometry/label/pie';
|
60 | import PolarLabel from './geometry/label/polar';
|
61 | registerGeometryLabel('base', GeometryLabel);
|
62 | registerGeometryLabel('interval', IntervalLabel);
|
63 | registerGeometryLabel('pie', PieLabel);
|
64 | registerGeometryLabel('polar', PolarLabel);
|
65 |
|
66 | import { registerGeometryLabelLayout } from './core';
|
67 | import { distribute } from './geometry/label/layout/pie/distribute';
|
68 | import { pieOuterLabelLayout } from './geometry/label/layout/pie/outer';
|
69 | import { pieSpiderLabelLayout } from './geometry/label/layout/pie/spider';
|
70 | import { limitInCanvas } from './geometry/label/layout/limit-in-canvas';
|
71 | import { limitInShape } from './geometry/label/layout/limit-in-shape';
|
72 | import { fixedOverlap, overlap } from './geometry/label/layout/overlap';
|
73 | import { hideOverlap } from './geometry/label/layout/hide-overlap';
|
74 | import { adjustColor } from './geometry/label/layout/adjust-color';
|
75 | import { intervalAdjustPosition } from './geometry/label/layout/interval/adjust-position';
|
76 | import { intervalHideOverlap } from './geometry/label/layout/interval/hide-overlap';
|
77 | import { pointAdjustPosition } from './geometry/label/layout/point/adjust-position';
|
78 | import { pathAdjustPosition } from './geometry/label/layout/path/adjust-position';
|
79 | import { limitInPlot } from './geometry/label/layout/limit-in-plot';
|
80 | registerGeometryLabelLayout('overlap', overlap);
|
81 | registerGeometryLabelLayout('distribute', distribute);
|
82 | registerGeometryLabelLayout('fixed-overlap', fixedOverlap);
|
83 | registerGeometryLabelLayout('hide-overlap', hideOverlap);
|
84 | registerGeometryLabelLayout('limit-in-shape', limitInShape);
|
85 | registerGeometryLabelLayout('limit-in-canvas', limitInCanvas);
|
86 | registerGeometryLabelLayout('limit-in-plot', limitInPlot);
|
87 | registerGeometryLabelLayout('pie-outer', pieOuterLabelLayout);
|
88 | registerGeometryLabelLayout('adjust-color', adjustColor);
|
89 | registerGeometryLabelLayout('interval-adjust-position', intervalAdjustPosition);
|
90 | registerGeometryLabelLayout('interval-hide-overlap', intervalHideOverlap);
|
91 | registerGeometryLabelLayout('point-adjust-position', pointAdjustPosition);
|
92 | registerGeometryLabelLayout('pie-spider', pieSpiderLabelLayout);
|
93 | registerGeometryLabelLayout('path-adjust-position', pathAdjustPosition);
|
94 |
|
95 | import { fadeIn, fadeOut } from './animate/animation/fade';
|
96 | import { growInX, growInXY, growInY } from './animate/animation/grow-in';
|
97 | import { pathIn } from './animate/animation/path-in';
|
98 | import { positionUpdate } from './animate/animation/position-update';
|
99 | import { scaleInX, scaleInY } from './animate/animation/scale-in';
|
100 | import { sectorPathUpdate } from './animate/animation/sector-path-update';
|
101 | import { waveIn } from './animate/animation/wave-in';
|
102 | import { zoomIn, zoomOut } from './animate/animation/zoom';
|
103 | import { registerAnimation } from './core';
|
104 | registerAnimation('fade-in', fadeIn);
|
105 | registerAnimation('fade-out', fadeOut);
|
106 | registerAnimation('grow-in-x', growInX);
|
107 | registerAnimation('grow-in-xy', growInXY);
|
108 | registerAnimation('grow-in-y', growInY);
|
109 | registerAnimation('scale-in-x', scaleInX);
|
110 | registerAnimation('scale-in-y', scaleInY);
|
111 | registerAnimation('wave-in', waveIn);
|
112 | registerAnimation('zoom-in', zoomIn);
|
113 | registerAnimation('zoom-out', zoomOut);
|
114 | registerAnimation('position-update', positionUpdate);
|
115 | registerAnimation('sector-path-update', sectorPathUpdate);
|
116 | registerAnimation('path-in', pathIn);
|
117 |
|
118 | import { registerFacet } from './core';
|
119 | import Circle from './facet/circle';
|
120 | import List from './facet/list';
|
121 | import Matrix from './facet/matrix';
|
122 | import Mirror from './facet/mirror';
|
123 | import Rect from './facet/rect';
|
124 | import Tree from './facet/tree';
|
125 | registerFacet('rect', Rect);
|
126 | registerFacet('mirror', Mirror);
|
127 | registerFacet('list', List);
|
128 | registerFacet('matrix', Matrix);
|
129 | registerFacet('circle', Circle);
|
130 | registerFacet('tree', Tree);
|
131 |
|
132 | import { registerComponentController } from './core';
|
133 | import Annotation from './chart/controller/annotation';
|
134 | import Axis from './chart/controller/axis';
|
135 | import Legend from './chart/controller/legend';
|
136 | import Slider from './chart/controller/slider';
|
137 | import Tooltip from './chart/controller/tooltip';
|
138 | import Scrollbar from './chart/controller/scrollbar';
|
139 |
|
140 | registerComponentController('axis', Axis);
|
141 | registerComponentController('legend', Legend);
|
142 | registerComponentController('tooltip', Tooltip);
|
143 | registerComponentController('annotation', Annotation);
|
144 | registerComponentController('slider', Slider);
|
145 | registerComponentController('scrollbar', Scrollbar);
|
146 |
|
147 | import { registerAction } from './core';
|
148 | import ActiveRegion from './interaction/action/active-region';
|
149 | import SiblingTooltip from './interaction/action/component/tooltip/sibling';
|
150 | import TooltipAction from './interaction/action/component/tooltip/geometry';
|
151 | import EllipsisTextAction from './interaction/action/component/tooltip/ellipsis-text';
|
152 | import ElementActive from './interaction/action/element/active';
|
153 | import ElementLinkByColor from './interaction/action/element/link-by-color';
|
154 | import ElementRangeActive from './interaction/action/element/range-active';
|
155 | import ElementSingleActive from './interaction/action/element/single-active';
|
156 | import ElementHighlight from './interaction/action/element/highlight';
|
157 | import ElementHighlightByColor from './interaction/action/element/highlight-by-color';
|
158 | import ElementHighlightByX from './interaction/action/element/highlight-by-x';
|
159 | import ElementRangeHighlight, { ELEMENT_RANGE_HIGHLIGHT_EVENTS } from './interaction/action/element/range-highlight';
|
160 | import ElementSingleHighlight from './interaction/action/element/single-highlight';
|
161 | import ElementRangeSelected from './interaction/action/element/range-selected';
|
162 | import ElementSelected from './interaction/action/element/selected';
|
163 | import ElementSingleSelected from './interaction/action/element/single-selected';
|
164 | import ListActive from './interaction/action/component/list-active';
|
165 | import ListHighlight from './interaction/action/component/list-highlight';
|
166 | import ListSelected from './interaction/action/component/list-selected';
|
167 | import ListUnchecked from './interaction/action/component/list-unchecked';
|
168 | import ListChecked from './interaction/action/component/list-checked';
|
169 | import CircleMask from './interaction/action/mask/circle';
|
170 | import DimMask from './interaction/action/mask/dim-rect';
|
171 | import PathMask from './interaction/action/mask/path';
|
172 | import RectMask from './interaction/action/mask/rect';
|
173 | import SmoothPathMask from './interaction/action/mask/smooth-path';
|
174 | import CursorAction from './interaction/action/cursor';
|
175 | import DataFilter from './interaction/action/data/filter';
|
176 | import DataRangeFilter, { BRUSH_FILTER_EVENTS } from './interaction/action/data/range-filter';
|
177 | import SiblingFilter from './interaction/action/data/sibling-filter';
|
178 | import ElementFilter from './interaction/action/element/filter';
|
179 | import ElementSiblingFilter from './interaction/action/element/sibling-filter';
|
180 | import ButtonAction from './interaction/action/view/button';
|
181 | import ViewDrag from './interaction/action/view/drag';
|
182 | import ViewMove from './interaction/action/view/move';
|
183 | import ScaleTranslate from './interaction/action/view/scale-translate';
|
184 | import ScaleZoom from './interaction/action/view/scale-zoom';
|
185 | registerAction('tooltip', TooltipAction);
|
186 | registerAction('sibling-tooltip', SiblingTooltip);
|
187 | registerAction('ellipsis-text', EllipsisTextAction);
|
188 | registerAction('element-active', ElementActive);
|
189 | registerAction('element-single-active', ElementSingleActive);
|
190 | registerAction('element-range-active', ElementRangeActive);
|
191 | registerAction('element-highlight', ElementHighlight);
|
192 | registerAction('element-highlight-by-x', ElementHighlightByX);
|
193 | registerAction('element-highlight-by-color', ElementHighlightByColor);
|
194 | registerAction('element-single-highlight', ElementSingleHighlight);
|
195 | registerAction('element-range-highlight', ElementRangeHighlight);
|
196 | registerAction('element-sibling-highlight', ElementRangeHighlight, {
|
197 | effectSiblings: true,
|
198 | effectByRecord: true,
|
199 | });
|
200 | registerAction('element-selected', ElementSelected);
|
201 | registerAction('element-single-selected', ElementSingleSelected);
|
202 | registerAction('element-range-selected', ElementRangeSelected);
|
203 | registerAction('element-link-by-color', ElementLinkByColor);
|
204 | registerAction('active-region', ActiveRegion);
|
205 | registerAction('list-active', ListActive);
|
206 | registerAction('list-selected', ListSelected);
|
207 | registerAction('list-highlight', ListHighlight);
|
208 | registerAction('list-unchecked', ListUnchecked);
|
209 | registerAction('list-checked', ListChecked);
|
210 | registerAction('legend-item-highlight', ListHighlight, {
|
211 | componentNames: ['legend'],
|
212 | });
|
213 | registerAction('axis-label-highlight', ListHighlight, {
|
214 | componentNames: ['axis'],
|
215 | });
|
216 | registerAction('rect-mask', RectMask);
|
217 | registerAction('x-rect-mask', DimMask, { dim: 'x' });
|
218 | registerAction('y-rect-mask', DimMask, { dim: 'y' });
|
219 | registerAction('circle-mask', CircleMask);
|
220 | registerAction('path-mask', PathMask);
|
221 | registerAction('smooth-path-mask', SmoothPathMask);
|
222 | registerAction('cursor', CursorAction);
|
223 | registerAction('data-filter', DataFilter);
|
224 | registerAction('brush', DataRangeFilter);
|
225 | registerAction('brush-x', DataRangeFilter, { dims: ['x'] });
|
226 | registerAction('brush-y', DataRangeFilter, { dims: ['y'] });
|
227 | registerAction('sibling-filter', SiblingFilter);
|
228 | registerAction('sibling-x-filter', SiblingFilter);
|
229 | registerAction('sibling-y-filter', SiblingFilter);
|
230 | registerAction('element-filter', ElementFilter);
|
231 | registerAction('element-sibling-filter', ElementSiblingFilter);
|
232 | registerAction('element-sibling-filter-record', ElementSiblingFilter, { byRecord: true });
|
233 | registerAction('view-drag', ViewDrag);
|
234 | registerAction('view-move', ViewMove);
|
235 | registerAction('scale-translate', ScaleTranslate);
|
236 | registerAction('scale-zoom', ScaleZoom);
|
237 | registerAction('reset-button', ButtonAction, {
|
238 | name: 'reset-button',
|
239 | text: 'reset',
|
240 | });
|
241 |
|
242 | import { registerInteraction } from './core';
|
243 | function isPointInView(context) {
|
244 | return context.isInPlot();
|
245 | }
|
246 |
|
247 | registerInteraction('tooltip', {
|
248 | start: [
|
249 | { trigger: 'plot:mousemove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
250 | { trigger: 'plot:touchmove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
251 | ],
|
252 | end: [
|
253 | { trigger: 'plot:mouseleave', action: 'tooltip:hide' },
|
254 | { trigger: 'plot:leave', action: 'tooltip:hide' },
|
255 | { trigger: 'plot:touchend', action: 'tooltip:hide' },
|
256 | ],
|
257 | });
|
258 | registerInteraction('ellipsis-text', {
|
259 | start: [
|
260 | {
|
261 | trigger: 'legend-item-name:mousemove',
|
262 | action: 'ellipsis-text:show',
|
263 | throttle: { wait: 50, leading: true, trailing: false },
|
264 | },
|
265 | {
|
266 | trigger: 'legend-item-name:touchstart',
|
267 | action: 'ellipsis-text:show',
|
268 | throttle: { wait: 50, leading: true, trailing: false },
|
269 | },
|
270 | {
|
271 | trigger: 'axis-label:mousemove',
|
272 | action: 'ellipsis-text:show',
|
273 | throttle: { wait: 50, leading: true, trailing: false },
|
274 | },
|
275 | {
|
276 | trigger: 'axis-label:touchstart',
|
277 | action: 'ellipsis-text:show',
|
278 | throttle: { wait: 50, leading: true, trailing: false },
|
279 | },
|
280 | ],
|
281 | end: [
|
282 | { trigger: 'legend-item-name:mouseleave', action: 'ellipsis-text:hide' },
|
283 | { trigger: 'legend-item-name:touchend', action: 'ellipsis-text:hide' },
|
284 | { trigger: 'axis-label:mouseleave', action: 'ellipsis-text:hide' },
|
285 | { trigger: 'axis-label:touchend', action: 'ellipsis-text:hide' },
|
286 | ],
|
287 | });
|
288 |
|
289 | registerInteraction('element-active', {
|
290 | start: [{ trigger: 'element:mouseenter', action: 'element-active:active' }],
|
291 | end: [{ trigger: 'element:mouseleave', action: 'element-active:reset' }],
|
292 | });
|
293 |
|
294 | registerInteraction('element-selected', {
|
295 | start: [{ trigger: 'element:click', action: 'element-selected:toggle' }],
|
296 | });
|
297 |
|
298 | registerInteraction('element-highlight', {
|
299 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight:highlight' }],
|
300 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight:reset' }],
|
301 | });
|
302 |
|
303 | registerInteraction('element-highlight-by-x', {
|
304 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-x:highlight' }],
|
305 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-x:reset' }],
|
306 | });
|
307 |
|
308 | registerInteraction('element-highlight-by-color', {
|
309 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-color:highlight' }],
|
310 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-color:reset' }],
|
311 | });
|
312 |
|
313 | registerInteraction('legend-active', {
|
314 | start: [{ trigger: 'legend-item:mouseenter', action: ['list-active:active', 'element-active:active'] }],
|
315 | end: [{ trigger: 'legend-item:mouseleave', action: ['list-active:reset', 'element-active:reset'] }],
|
316 | });
|
317 |
|
318 | registerInteraction('legend-highlight', {
|
319 | start: [
|
320 | { trigger: 'legend-item:mouseenter', action: ['legend-item-highlight:highlight', 'element-highlight:highlight'] },
|
321 | ],
|
322 | end: [{ trigger: 'legend-item:mouseleave', action: ['legend-item-highlight:reset', 'element-highlight:reset'] }],
|
323 | });
|
324 |
|
325 | registerInteraction('axis-label-highlight', {
|
326 | start: [
|
327 | { trigger: 'axis-label:mouseenter', action: ['axis-label-highlight:highlight', 'element-highlight:highlight'] },
|
328 | ],
|
329 | end: [{ trigger: 'axis-label:mouseleave', action: ['axis-label-highlight:reset', 'element-highlight:reset'] }],
|
330 | });
|
331 |
|
332 | registerInteraction('element-list-highlight', {
|
333 | start: [{ trigger: 'element:mouseenter', action: ['list-highlight:highlight', 'element-highlight:highlight'] }],
|
334 | end: [{ trigger: 'element:mouseleave', action: ['list-highlight:reset', 'element-highlight:reset'] }],
|
335 | });
|
336 |
|
337 | registerInteraction('element-range-highlight', {
|
338 | showEnable: [
|
339 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
340 | { trigger: 'mask:mouseenter', action: 'cursor:move' },
|
341 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
342 | { trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
343 | ],
|
344 | start: [
|
345 | {
|
346 | trigger: 'plot:mousedown',
|
347 | isEnable: function (context) {
|
348 |
|
349 | return !context.isInShape('mask');
|
350 | },
|
351 | action: ['rect-mask:start', 'rect-mask:show'],
|
352 | },
|
353 | {
|
354 | trigger: 'mask:dragstart',
|
355 | action: ['rect-mask:moveStart'],
|
356 | },
|
357 | ],
|
358 | processing: [
|
359 | {
|
360 | trigger: 'plot:mousemove',
|
361 | action: ['rect-mask:resize'],
|
362 | },
|
363 | {
|
364 | trigger: 'mask:drag',
|
365 | action: ['rect-mask:move'],
|
366 | },
|
367 | {
|
368 | trigger: 'mask:change',
|
369 | action: ['element-range-highlight:highlight'],
|
370 | },
|
371 | ],
|
372 | end: [
|
373 | { trigger: 'plot:mouseup', action: ['rect-mask:end'] },
|
374 | { trigger: 'mask:dragend', action: ['rect-mask:moveEnd'] },
|
375 | {
|
376 | trigger: 'document:mouseup',
|
377 | isEnable: function (context) {
|
378 | return !context.isInPlot();
|
379 | },
|
380 | action: ['element-range-highlight:clear', 'rect-mask:end', 'rect-mask:hide'],
|
381 | },
|
382 | ],
|
383 | rollback: [{ trigger: 'dblclick', action: ['element-range-highlight:clear', 'rect-mask:hide'] }],
|
384 | });
|
385 | registerInteraction('brush', {
|
386 | showEnable: [
|
387 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
388 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
389 | ],
|
390 | start: [
|
391 | {
|
392 | trigger: 'mousedown',
|
393 | isEnable: isPointInView,
|
394 | action: ['brush:start', 'rect-mask:start', 'rect-mask:show'],
|
395 | },
|
396 | ],
|
397 | processing: [
|
398 | {
|
399 | trigger: 'mousemove',
|
400 | isEnable: isPointInView,
|
401 | action: ['rect-mask:resize'],
|
402 | },
|
403 | ],
|
404 | end: [
|
405 | {
|
406 | trigger: 'mouseup',
|
407 | isEnable: isPointInView,
|
408 | action: ['brush:filter', 'brush:end', 'rect-mask:end', 'rect-mask:hide', 'reset-button:show'],
|
409 | },
|
410 | ],
|
411 | rollback: [{ trigger: 'reset-button:click', action: ['brush:reset', 'reset-button:hide', 'cursor:crosshair'] }],
|
412 | });
|
413 | registerInteraction('brush-visible', {
|
414 | showEnable: [
|
415 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
416 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
417 | ],
|
418 | start: [
|
419 | {
|
420 | trigger: 'plot:mousedown',
|
421 | action: ['rect-mask:start', 'rect-mask:show'],
|
422 | },
|
423 | ],
|
424 | processing: [
|
425 | {
|
426 | trigger: 'plot:mousemove',
|
427 | action: ['rect-mask:resize'],
|
428 | },
|
429 | { trigger: 'mask:change', action: ['element-range-highlight:highlight'] },
|
430 | ],
|
431 | end: [
|
432 | {
|
433 | trigger: 'plot:mouseup',
|
434 | action: ['rect-mask:end', 'rect-mask:hide', 'element-filter:filter', 'element-range-highlight:clear'],
|
435 | },
|
436 | ],
|
437 | rollback: [
|
438 | {
|
439 | trigger: 'dblclick',
|
440 | action: ['element-filter:clear'],
|
441 | },
|
442 | ],
|
443 | });
|
444 | registerInteraction('brush-x', {
|
445 | showEnable: [
|
446 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
447 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
448 | ],
|
449 | start: [
|
450 | {
|
451 | trigger: 'mousedown',
|
452 | isEnable: isPointInView,
|
453 | action: ['brush-x:start', 'x-rect-mask:start', 'x-rect-mask:show'],
|
454 | },
|
455 | ],
|
456 | processing: [
|
457 | {
|
458 | trigger: 'mousemove',
|
459 | isEnable: isPointInView,
|
460 | action: ['x-rect-mask:resize'],
|
461 | },
|
462 | ],
|
463 | end: [
|
464 | {
|
465 | trigger: 'mouseup',
|
466 | isEnable: isPointInView,
|
467 | action: ['brush-x:filter', 'brush-x:end', 'x-rect-mask:end', 'x-rect-mask:hide'],
|
468 | },
|
469 | ],
|
470 | rollback: [{ trigger: 'dblclick', action: ['brush-x:reset'] }],
|
471 | });
|
472 | registerInteraction('element-path-highlight', {
|
473 | showEnable: [
|
474 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
475 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
476 | ],
|
477 | start: [
|
478 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:start' },
|
479 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:show' },
|
480 | ],
|
481 | processing: [{ trigger: 'mousemove', action: 'path-mask:addPoint' }],
|
482 | end: [{ trigger: 'mouseup', action: 'path-mask:end' }],
|
483 | rollback: [{ trigger: 'dblclick', action: 'path-mask:hide' }],
|
484 | });
|
485 |
|
486 | registerInteraction('element-single-selected', {
|
487 | start: [{ trigger: 'element:click', action: 'element-single-selected:toggle' }],
|
488 | });
|
489 |
|
490 | registerInteraction('legend-filter', {
|
491 | showEnable: [
|
492 | { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
|
493 | { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
|
494 | ],
|
495 | start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'data-filter:filter'] }],
|
496 | });
|
497 |
|
498 | registerInteraction('continuous-filter', {
|
499 | start: [{ trigger: 'legend:valuechanged', action: 'data-filter:filter' }],
|
500 | });
|
501 |
|
502 | registerInteraction('continuous-visible-filter', {
|
503 | start: [{ trigger: 'legend:valuechanged', action: 'element-filter:filter' }],
|
504 | });
|
505 |
|
506 | registerInteraction('legend-visible-filter', {
|
507 | showEnable: [
|
508 | { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
|
509 | { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
|
510 | ],
|
511 | start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'element-filter:filter'] }],
|
512 | });
|
513 |
|
514 | registerInteraction('active-region', {
|
515 | start: [{ trigger: 'plot:mousemove', action: 'active-region:show' }],
|
516 | end: [{ trigger: 'plot:mouseleave', action: 'active-region:hide' }],
|
517 | });
|
518 | function isWheelDown(event) {
|
519 | event.gEvent.preventDefault();
|
520 | return event.gEvent.originalEvent.deltaY > 0;
|
521 | }
|
522 | registerInteraction('view-zoom', {
|
523 | start: [
|
524 | {
|
525 | trigger: 'plot:mousewheel',
|
526 | isEnable: function (context) {
|
527 | return isWheelDown(context.event);
|
528 | },
|
529 | action: 'scale-zoom:zoomOut',
|
530 | throttle: { wait: 100, leading: true, trailing: false },
|
531 | },
|
532 | {
|
533 | trigger: 'plot:mousewheel',
|
534 | isEnable: function (context) {
|
535 | return !isWheelDown(context.event);
|
536 | },
|
537 | action: 'scale-zoom:zoomIn',
|
538 | throttle: { wait: 100, leading: true, trailing: false },
|
539 | },
|
540 | ],
|
541 | });
|
542 | registerInteraction('sibling-tooltip', {
|
543 | start: [{ trigger: 'plot:mousemove', action: 'sibling-tooltip:show' }],
|
544 | end: [{ trigger: 'plot:mouseleave', action: 'sibling-tooltip:hide' }],
|
545 | });
|
546 |
|
547 | export { VIEW_LIFE_CIRCLE } from './constant';
|
548 |
|
549 | export { BRUSH_FILTER_EVENTS, ELEMENT_RANGE_HIGHLIGHT_EVENTS };
|
550 | export * from './core';
|
551 |
|
\ | No newline at end of file |