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 ListFocus from './interaction/action/component/list-focus';
|
170 | import ListRadio from './interaction/action/component/list-radio';
|
171 | import CircleMask from './interaction/action/mask/circle';
|
172 | import DimMask from './interaction/action/mask/dim-rect';
|
173 | import PathMask from './interaction/action/mask/path';
|
174 | import RectMask from './interaction/action/mask/rect';
|
175 | import SmoothPathMask from './interaction/action/mask/smooth-path';
|
176 | import CursorAction from './interaction/action/cursor';
|
177 | import DataFilter from './interaction/action/data/filter';
|
178 | import DataRangeFilter, { BRUSH_FILTER_EVENTS } from './interaction/action/data/range-filter';
|
179 | import SiblingFilter from './interaction/action/data/sibling-filter';
|
180 | import ElementFilter from './interaction/action/element/filter';
|
181 | import ElementSiblingFilter from './interaction/action/element/sibling-filter';
|
182 | import ButtonAction from './interaction/action/view/button';
|
183 | import ViewDrag from './interaction/action/view/drag';
|
184 | import ViewMove from './interaction/action/view/move';
|
185 | import ScaleTranslate from './interaction/action/view/scale-translate';
|
186 | import ScaleZoom from './interaction/action/view/scale-zoom';
|
187 | import MousewheelScroll from './interaction/action/view/mousewheel-scroll';
|
188 | registerAction('tooltip', TooltipAction);
|
189 | registerAction('sibling-tooltip', SiblingTooltip);
|
190 | registerAction('ellipsis-text', EllipsisTextAction);
|
191 | registerAction('element-active', ElementActive);
|
192 | registerAction('element-single-active', ElementSingleActive);
|
193 | registerAction('element-range-active', ElementRangeActive);
|
194 | registerAction('element-highlight', ElementHighlight);
|
195 | registerAction('element-highlight-by-x', ElementHighlightByX);
|
196 | registerAction('element-highlight-by-color', ElementHighlightByColor);
|
197 | registerAction('element-single-highlight', ElementSingleHighlight);
|
198 | registerAction('element-range-highlight', ElementRangeHighlight);
|
199 | registerAction('element-sibling-highlight', ElementRangeHighlight, {
|
200 | effectSiblings: true,
|
201 | effectByRecord: true,
|
202 | });
|
203 | registerAction('element-selected', ElementSelected);
|
204 | registerAction('element-single-selected', ElementSingleSelected);
|
205 | registerAction('element-range-selected', ElementRangeSelected);
|
206 | registerAction('element-link-by-color', ElementLinkByColor);
|
207 | registerAction('active-region', ActiveRegion);
|
208 | registerAction('list-active', ListActive);
|
209 | registerAction('list-selected', ListSelected);
|
210 | registerAction('list-highlight', ListHighlight);
|
211 | registerAction('list-unchecked', ListUnchecked);
|
212 | registerAction('list-checked', ListChecked);
|
213 | registerAction('list-focus', ListFocus);
|
214 | registerAction('list-radio', ListRadio);
|
215 | registerAction('legend-item-highlight', ListHighlight, {
|
216 | componentNames: ['legend'],
|
217 | });
|
218 | registerAction('axis-label-highlight', ListHighlight, {
|
219 | componentNames: ['axis'],
|
220 | });
|
221 | registerAction('rect-mask', RectMask);
|
222 | registerAction('x-rect-mask', DimMask, { dim: 'x' });
|
223 | registerAction('y-rect-mask', DimMask, { dim: 'y' });
|
224 | registerAction('circle-mask', CircleMask);
|
225 | registerAction('path-mask', PathMask);
|
226 | registerAction('smooth-path-mask', SmoothPathMask);
|
227 | registerAction('cursor', CursorAction);
|
228 | registerAction('data-filter', DataFilter);
|
229 | registerAction('brush', DataRangeFilter);
|
230 | registerAction('brush-x', DataRangeFilter, { dims: ['x'] });
|
231 | registerAction('brush-y', DataRangeFilter, { dims: ['y'] });
|
232 | registerAction('sibling-filter', SiblingFilter);
|
233 | registerAction('sibling-x-filter', SiblingFilter);
|
234 | registerAction('sibling-y-filter', SiblingFilter);
|
235 | registerAction('element-filter', ElementFilter);
|
236 | registerAction('element-sibling-filter', ElementSiblingFilter);
|
237 | registerAction('element-sibling-filter-record', ElementSiblingFilter, { byRecord: true });
|
238 | registerAction('view-drag', ViewDrag);
|
239 | registerAction('view-move', ViewMove);
|
240 | registerAction('scale-translate', ScaleTranslate);
|
241 | registerAction('scale-zoom', ScaleZoom);
|
242 | registerAction('reset-button', ButtonAction, {
|
243 | name: 'reset-button',
|
244 | text: 'reset',
|
245 | });
|
246 | registerAction('mousewheel-scroll', MousewheelScroll);
|
247 |
|
248 | import { registerInteraction } from './core';
|
249 | function isPointInView(context) {
|
250 | return context.isInPlot();
|
251 | }
|
252 |
|
253 | registerInteraction('tooltip', {
|
254 | start: [
|
255 | { trigger: 'plot:mousemove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
256 | { trigger: 'plot:touchmove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
257 | ],
|
258 | end: [
|
259 | { trigger: 'plot:mouseleave', action: 'tooltip:hide' },
|
260 | { trigger: 'plot:leave', action: 'tooltip:hide' },
|
261 | { trigger: 'plot:touchend', action: 'tooltip:hide' },
|
262 | ],
|
263 | });
|
264 | registerInteraction('ellipsis-text', {
|
265 | start: [
|
266 | {
|
267 | trigger: 'legend-item-name:mousemove',
|
268 | action: 'ellipsis-text:show',
|
269 | throttle: { wait: 50, leading: true, trailing: false },
|
270 | },
|
271 | {
|
272 | trigger: 'legend-item-name:touchstart',
|
273 | action: 'ellipsis-text:show',
|
274 | throttle: { wait: 50, leading: true, trailing: false },
|
275 | },
|
276 | {
|
277 | trigger: 'axis-label:mousemove',
|
278 | action: 'ellipsis-text:show',
|
279 | throttle: { wait: 50, leading: true, trailing: false },
|
280 | },
|
281 | {
|
282 | trigger: 'axis-label:touchstart',
|
283 | action: 'ellipsis-text:show',
|
284 | throttle: { wait: 50, leading: true, trailing: false },
|
285 | },
|
286 | ],
|
287 | end: [
|
288 | { trigger: 'legend-item-name:mouseleave', action: 'ellipsis-text:hide' },
|
289 | { trigger: 'legend-item-name:touchend', action: 'ellipsis-text:hide' },
|
290 | { trigger: 'axis-label:mouseleave', action: 'ellipsis-text:hide' },
|
291 | { trigger: 'axis-label:touchend', action: 'ellipsis-text:hide' },
|
292 | ],
|
293 | });
|
294 |
|
295 | registerInteraction('element-active', {
|
296 | start: [{ trigger: 'element:mouseenter', action: 'element-active:active' }],
|
297 | end: [{ trigger: 'element:mouseleave', action: 'element-active:reset' }],
|
298 | });
|
299 |
|
300 | registerInteraction('element-selected', {
|
301 | start: [{ trigger: 'element:click', action: 'element-selected:toggle' }],
|
302 | });
|
303 |
|
304 | registerInteraction('element-highlight', {
|
305 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight:highlight' }],
|
306 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight:reset' }],
|
307 | });
|
308 |
|
309 | registerInteraction('element-highlight-by-x', {
|
310 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-x:highlight' }],
|
311 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-x:reset' }],
|
312 | });
|
313 |
|
314 | registerInteraction('element-highlight-by-color', {
|
315 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-color:highlight' }],
|
316 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-color:reset' }],
|
317 | });
|
318 |
|
319 | registerInteraction('legend-active', {
|
320 | start: [{ trigger: 'legend-item:mouseenter', action: ['list-active:active', 'element-active:active'] }],
|
321 | end: [{ trigger: 'legend-item:mouseleave', action: ['list-active:reset', 'element-active:reset'] }],
|
322 | });
|
323 |
|
324 | registerInteraction('legend-highlight', {
|
325 | start: [
|
326 | { trigger: 'legend-item:mouseenter', action: ['legend-item-highlight:highlight', 'element-highlight:highlight'] },
|
327 | ],
|
328 | end: [{ trigger: 'legend-item:mouseleave', action: ['legend-item-highlight:reset', 'element-highlight:reset'] }],
|
329 | });
|
330 |
|
331 | registerInteraction('axis-label-highlight', {
|
332 | start: [
|
333 | { trigger: 'axis-label:mouseenter', action: ['axis-label-highlight:highlight', 'element-highlight:highlight'] },
|
334 | ],
|
335 | end: [{ trigger: 'axis-label:mouseleave', action: ['axis-label-highlight:reset', 'element-highlight:reset'] }],
|
336 | });
|
337 |
|
338 | registerInteraction('element-list-highlight', {
|
339 | start: [{ trigger: 'element:mouseenter', action: ['list-highlight:highlight', 'element-highlight:highlight'] }],
|
340 | end: [{ trigger: 'element:mouseleave', action: ['list-highlight:reset', 'element-highlight:reset'] }],
|
341 | });
|
342 |
|
343 | registerInteraction('element-range-highlight', {
|
344 | showEnable: [
|
345 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
346 | { trigger: 'mask:mouseenter', action: 'cursor:move' },
|
347 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
348 | { trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
349 | ],
|
350 | start: [
|
351 | {
|
352 | trigger: 'plot:mousedown',
|
353 | isEnable: function (context) {
|
354 |
|
355 | return !context.isInShape('mask');
|
356 | },
|
357 | action: ['rect-mask:start', 'rect-mask:show'],
|
358 | },
|
359 | {
|
360 | trigger: 'mask:dragstart',
|
361 | action: ['rect-mask:moveStart'],
|
362 | },
|
363 | ],
|
364 | processing: [
|
365 | {
|
366 | trigger: 'plot:mousemove',
|
367 | action: ['rect-mask:resize'],
|
368 | },
|
369 | {
|
370 | trigger: 'mask:drag',
|
371 | action: ['rect-mask:move'],
|
372 | },
|
373 | {
|
374 | trigger: 'mask:change',
|
375 | action: ['element-range-highlight:highlight'],
|
376 | },
|
377 | ],
|
378 | end: [
|
379 | { trigger: 'plot:mouseup', action: ['rect-mask:end'] },
|
380 | { trigger: 'mask:dragend', action: ['rect-mask:moveEnd'] },
|
381 | {
|
382 | trigger: 'document:mouseup',
|
383 | isEnable: function (context) {
|
384 | return !context.isInPlot();
|
385 | },
|
386 | action: ['element-range-highlight:clear', 'rect-mask:end', 'rect-mask:hide'],
|
387 | },
|
388 | ],
|
389 | rollback: [{ trigger: 'dblclick', action: ['element-range-highlight:clear', 'rect-mask:hide'] }],
|
390 | });
|
391 | registerInteraction('brush', {
|
392 | showEnable: [
|
393 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
394 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
395 | ],
|
396 | start: [
|
397 | {
|
398 | trigger: 'mousedown',
|
399 | isEnable: isPointInView,
|
400 | action: ['brush:start', 'rect-mask:start', 'rect-mask:show'],
|
401 | },
|
402 | ],
|
403 | processing: [
|
404 | {
|
405 | trigger: 'mousemove',
|
406 | isEnable: isPointInView,
|
407 | action: ['rect-mask:resize'],
|
408 | },
|
409 | ],
|
410 | end: [
|
411 | {
|
412 | trigger: 'mouseup',
|
413 | isEnable: isPointInView,
|
414 | action: ['brush:filter', 'brush:end', 'rect-mask:end', 'rect-mask:hide', 'reset-button:show'],
|
415 | },
|
416 | ],
|
417 | rollback: [{ trigger: 'reset-button:click', action: ['brush:reset', 'reset-button:hide', 'cursor:crosshair'] }],
|
418 | });
|
419 | registerInteraction('brush-visible', {
|
420 | showEnable: [
|
421 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
422 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
423 | ],
|
424 | start: [
|
425 | {
|
426 | trigger: 'plot:mousedown',
|
427 | action: ['rect-mask:start', 'rect-mask:show'],
|
428 | },
|
429 | ],
|
430 | processing: [
|
431 | {
|
432 | trigger: 'plot:mousemove',
|
433 | action: ['rect-mask:resize'],
|
434 | },
|
435 | { trigger: 'mask:change', action: ['element-range-highlight:highlight'] },
|
436 | ],
|
437 | end: [
|
438 | {
|
439 | trigger: 'plot:mouseup',
|
440 | action: ['rect-mask:end', 'rect-mask:hide', 'element-filter:filter', 'element-range-highlight:clear'],
|
441 | },
|
442 | ],
|
443 | rollback: [
|
444 | {
|
445 | trigger: 'dblclick',
|
446 | action: ['element-filter:clear'],
|
447 | },
|
448 | ],
|
449 | });
|
450 | registerInteraction('brush-x', {
|
451 | showEnable: [
|
452 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
453 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
454 | ],
|
455 | start: [
|
456 | {
|
457 | trigger: 'mousedown',
|
458 | isEnable: isPointInView,
|
459 | action: ['brush-x:start', 'x-rect-mask:start', 'x-rect-mask:show'],
|
460 | },
|
461 | ],
|
462 | processing: [
|
463 | {
|
464 | trigger: 'mousemove',
|
465 | isEnable: isPointInView,
|
466 | action: ['x-rect-mask:resize'],
|
467 | },
|
468 | ],
|
469 | end: [
|
470 | {
|
471 | trigger: 'mouseup',
|
472 | isEnable: isPointInView,
|
473 | action: ['brush-x:filter', 'brush-x:end', 'x-rect-mask:end', 'x-rect-mask:hide'],
|
474 | },
|
475 | ],
|
476 | rollback: [{ trigger: 'dblclick', action: ['brush-x:reset'] }],
|
477 | });
|
478 | registerInteraction('element-path-highlight', {
|
479 | showEnable: [
|
480 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
481 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
482 | ],
|
483 | start: [
|
484 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:start' },
|
485 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:show' },
|
486 | ],
|
487 | processing: [{ trigger: 'mousemove', action: 'path-mask:addPoint' }],
|
488 | end: [{ trigger: 'mouseup', action: 'path-mask:end' }],
|
489 | rollback: [{ trigger: 'dblclick', action: 'path-mask:hide' }],
|
490 | });
|
491 |
|
492 | registerInteraction('element-single-selected', {
|
493 | start: [{ trigger: 'element:click', action: 'element-single-selected:toggle' }],
|
494 | });
|
495 |
|
496 | registerInteraction('legend-filter', {
|
497 | showEnable: [
|
498 | { trigger: 'legend-item:mouseenter', action: ['cursor:pointer', 'list-radio:show'] },
|
499 | { trigger: 'legend-item:mouseleave', action: ['cursor:default', 'list-radio:hide'] },
|
500 | ],
|
501 | start: [
|
502 | {
|
503 | trigger: 'legend-item:click',
|
504 | isEnable: function (context) {
|
505 | return !context.isInShape('legend-item-radio');
|
506 | },
|
507 | action: ['list-unchecked:toggle', 'data-filter:filter', 'list-radio:show'],
|
508 | },
|
509 |
|
510 | {
|
511 | trigger: 'legend-item-radio:mouseenter',
|
512 | action: ['list-radio:showTip'],
|
513 | },
|
514 | {
|
515 | trigger: 'legend-item-radio:mouseleave',
|
516 | action: ['list-radio:hideTip'],
|
517 | },
|
518 | {
|
519 | trigger: 'legend-item-radio:click',
|
520 | action: ['list-focus:toggle', 'data-filter:filter', 'list-radio:show'],
|
521 | },
|
522 | ],
|
523 | });
|
524 |
|
525 | registerInteraction('continuous-filter', {
|
526 | start: [{ trigger: 'legend:valuechanged', action: 'data-filter:filter' }],
|
527 | });
|
528 |
|
529 | registerInteraction('continuous-visible-filter', {
|
530 | start: [{ trigger: 'legend:valuechanged', action: 'element-filter:filter' }],
|
531 | });
|
532 |
|
533 | registerInteraction('legend-visible-filter', {
|
534 | showEnable: [
|
535 | { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
|
536 | { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
|
537 | ],
|
538 | start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'element-filter:filter'] }],
|
539 | });
|
540 |
|
541 | registerInteraction('active-region', {
|
542 | start: [{ trigger: 'plot:mousemove', action: 'active-region:show' }],
|
543 | end: [{ trigger: 'plot:mouseleave', action: 'active-region:hide' }],
|
544 | });
|
545 | function isWheelDown(event) {
|
546 | event.gEvent.preventDefault();
|
547 | return event.gEvent.originalEvent.deltaY > 0;
|
548 | }
|
549 | registerInteraction('view-zoom', {
|
550 | start: [
|
551 | {
|
552 | trigger: 'plot:mousewheel',
|
553 | isEnable: function (context) {
|
554 | return isWheelDown(context.event);
|
555 | },
|
556 | action: 'scale-zoom:zoomOut',
|
557 | throttle: { wait: 100, leading: true, trailing: false },
|
558 | },
|
559 | {
|
560 | trigger: 'plot:mousewheel',
|
561 | isEnable: function (context) {
|
562 | return !isWheelDown(context.event);
|
563 | },
|
564 | action: 'scale-zoom:zoomIn',
|
565 | throttle: { wait: 100, leading: true, trailing: false },
|
566 | },
|
567 | ],
|
568 | });
|
569 | registerInteraction('sibling-tooltip', {
|
570 | start: [{ trigger: 'plot:mousemove', action: 'sibling-tooltip:show' }],
|
571 | end: [{ trigger: 'plot:mouseleave', action: 'sibling-tooltip:hide' }],
|
572 | });
|
573 | registerInteraction('plot-mousewheel-scroll', {
|
574 | start: [{ trigger: 'plot:mousewheel', action: 'mousewheel-scroll:scroll' }],
|
575 | });
|
576 |
|
577 | export { VIEW_LIFE_CIRCLE } from './constant';
|
578 |
|
579 | export { BRUSH_FILTER_EVENTS, ELEMENT_RANGE_HIGHLIGHT_EVENTS };
|
580 | export * from './core';
|
581 |
|
\ | No newline at end of file |