@visactor/vgrammar-core 0.10.0-alpha.2 → 0.10.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/component/axis.js.map +1 -1
- package/cjs/component/datazoom.js.map +1 -1
- package/cjs/component/grid.js.map +1 -1
- package/cjs/component/label.js +1 -0
- package/cjs/component/label.js.map +1 -1
- package/cjs/component/legend.js.map +1 -1
- package/cjs/component/player.js.map +1 -1
- package/cjs/component/scrollbar.js.map +1 -1
- package/cjs/component/slider.js.map +1 -1
- package/cjs/component/title.d.ts +4 -3
- package/cjs/component/title.js.map +1 -1
- package/cjs/core/factory.d.ts +8 -4
- package/cjs/core/factory.js +9 -3
- package/cjs/core/factory.js.map +1 -1
- package/cjs/env.d.ts +1 -1
- package/cjs/env.js +6 -6
- package/cjs/env.js.map +1 -1
- package/cjs/glyph/boxplot.js +4 -2
- package/cjs/glyph/boxplot.js.map +1 -1
- package/cjs/glyph/link-path.js +3 -2
- package/cjs/glyph/link-path.js.map +1 -1
- package/cjs/glyph/ripple.js +2 -2
- package/cjs/glyph/ripple.js.map +1 -1
- package/cjs/glyph/tree-path.js +3 -2
- package/cjs/glyph/tree-path.js.map +1 -1
- package/cjs/glyph/violin.js +4 -2
- package/cjs/glyph/violin.js.map +1 -1
- package/cjs/glyph/wave.js +2 -2
- package/cjs/glyph/wave.js.map +1 -1
- package/cjs/graph/animation/animate.js +5 -3
- package/cjs/graph/animation/animate.js.map +1 -1
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/cjs/graph/animation/animator.js +6 -5
- package/cjs/graph/animation/animator.js.map +1 -1
- package/cjs/graph/animation/attribute.d.ts +2 -2
- package/cjs/graph/animation/attribute.js +6 -6
- package/cjs/graph/animation/attribute.js.map +1 -1
- package/cjs/graph/animation/config.js +9 -7
- package/cjs/graph/animation/config.js.map +1 -1
- package/cjs/graph/animation/morph.js +4 -4
- package/cjs/graph/animation/morph.js.map +1 -1
- package/cjs/graph/attributes/line.d.ts +1 -0
- package/cjs/graph/attributes/line.js +11 -3
- package/cjs/graph/attributes/line.js.map +1 -1
- package/cjs/graph/attributes/transform.js +0 -24
- package/cjs/graph/attributes/transform.js.map +1 -1
- package/cjs/graph/canvas-renderer.d.ts +1 -1
- package/cjs/graph/canvas-renderer.js +5 -5
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/constants.d.ts +1 -0
- package/cjs/graph/constants.js +3 -3
- package/cjs/graph/constants.js.map +1 -1
- package/cjs/graph/element.d.ts +2 -2
- package/cjs/graph/element.js +9 -10
- package/cjs/graph/element.js.map +1 -1
- package/cjs/graph/glyph-element.d.ts +1 -1
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/graph/mark/graphic.d.ts +22 -0
- package/cjs/graph/mark/graphic.js +138 -0
- package/cjs/graph/mark/graphic.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +2 -2
- package/cjs/graph/mark/large-rects.js +3 -3
- package/cjs/graph/mark/large-rects.js.map +1 -1
- package/cjs/graph/mark/large-symbols.d.ts +2 -2
- package/cjs/graph/mark/large-symbols.js +3 -3
- package/cjs/graph/mark/large-symbols.js.map +1 -1
- package/cjs/graph/util/env.js +2 -2
- package/cjs/graph/util/env.js.map +1 -1
- package/cjs/graph/util/events-extend.d.ts +1 -1
- package/cjs/graph/util/events-extend.js.map +1 -1
- package/cjs/graph/util/graphic.d.ts +3 -5
- package/cjs/graph/util/graphic.js +12 -28
- package/cjs/graph/util/graphic.js.map +1 -1
- package/cjs/index.d.ts +5 -2
- package/cjs/index.js +34 -5
- package/cjs/index.js.map +1 -1
- package/cjs/interactions/brush-active.d.ts +1 -1
- package/cjs/interactions/brush-active.js.map +1 -1
- package/cjs/interactions/brush-base.d.ts +1 -1
- package/cjs/interactions/brush-base.js.map +1 -1
- package/cjs/interactions/brush-filter.d.ts +1 -1
- package/cjs/interactions/brush-filter.js.map +1 -1
- package/cjs/interactions/brush-highlight.d.ts +1 -1
- package/cjs/interactions/brush-highlight.js.map +1 -1
- package/cjs/interactions/crosshair.js.map +1 -1
- package/cjs/interactions/drill-down.d.ts +1 -1
- package/cjs/interactions/drill-down.js.map +1 -1
- package/cjs/parse/scale.js +1 -1
- package/cjs/parse/scale.js.map +1 -1
- package/cjs/semantic-marks/cell.d.ts +1 -1
- package/cjs/semantic-marks/interval.d.ts +1 -1
- package/cjs/semantic-marks/interval.js +4 -2
- package/cjs/semantic-marks/interval.js.map +1 -1
- package/cjs/transforms/data/contour.js +2 -1
- package/cjs/transforms/data/contour.js.map +1 -1
- package/cjs/transforms/data/sampling.js +3 -3
- package/cjs/transforms/data/sampling.js.map +1 -1
- package/cjs/transforms/data/unfold.js +2 -2
- package/cjs/transforms/data/unfold.js.map +1 -1
- package/cjs/transforms/mark/symmetry.js +2 -1
- package/cjs/transforms/mark/symmetry.js.map +1 -1
- package/cjs/transforms/util/util.d.ts +0 -2
- package/cjs/transforms/util/util.js +2 -11
- package/cjs/transforms/util/util.js.map +1 -1
- package/cjs/types/animate.d.ts +3 -1
- package/cjs/types/animate.js.map +1 -1
- package/cjs/types/component.d.ts +5 -5
- package/cjs/types/component.js.map +1 -1
- package/cjs/types/element.d.ts +1 -1
- package/cjs/types/element.js.map +1 -1
- package/cjs/types/event.d.ts +1 -1
- package/cjs/types/event.js.map +1 -1
- package/cjs/types/grammar.d.ts +5 -5
- package/cjs/types/grammar.js.map +1 -1
- package/cjs/types/interaction.d.ts +1 -1
- package/cjs/types/interaction.js.map +1 -1
- package/cjs/types/mark.d.ts +1 -1
- package/cjs/types/mark.js.map +1 -1
- package/cjs/types/morph.d.ts +1 -1
- package/cjs/types/morph.js.map +1 -1
- package/cjs/types/plot.d.ts +1 -1
- package/cjs/types/plot.js.map +1 -1
- package/cjs/types/renderer.d.ts +1 -1
- package/cjs/types/renderer.js.map +1 -1
- package/cjs/types/theme.d.ts +1 -1
- package/cjs/types/theme.js.map +1 -1
- package/cjs/types/view.d.ts +1 -1
- package/cjs/types/view.js.map +1 -1
- package/cjs/util/text.d.ts +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/cjs/view/View.d.ts +1 -1
- package/cjs/view/View.js +17 -14
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/component.d.ts +1 -1
- package/cjs/view/coordinate.d.ts +1 -0
- package/cjs/view/coordinate.js +8 -2
- package/cjs/view/coordinate.js.map +1 -1
- package/cjs/view/mark.d.ts +4 -4
- package/cjs/view/mark.js +12 -8
- package/cjs/view/mark.js.map +1 -1
- package/cjs/view/scale.d.ts +1 -0
- package/cjs/view/scale.js +8 -2
- package/cjs/view/scale.js.map +1 -1
- package/es/component/axis.js.map +1 -1
- package/es/component/datazoom.js.map +1 -1
- package/es/component/grid.js.map +1 -1
- package/es/component/label.js +1 -0
- package/es/component/label.js.map +1 -1
- package/es/component/legend.js.map +1 -1
- package/es/component/player.js.map +1 -1
- package/es/component/scrollbar.js.map +1 -1
- package/es/component/slider.js.map +1 -1
- package/es/component/title.d.ts +4 -3
- package/es/component/title.js.map +1 -1
- package/es/core/factory.d.ts +8 -4
- package/es/core/factory.js +8 -3
- package/es/core/factory.js.map +1 -1
- package/es/env.d.ts +1 -1
- package/es/env.js +2 -2
- package/es/env.js.map +1 -1
- package/es/glyph/boxplot.js +4 -1
- package/es/glyph/boxplot.js.map +1 -1
- package/es/glyph/link-path.js +4 -1
- package/es/glyph/link-path.js.map +1 -1
- package/es/glyph/ripple.js +3 -1
- package/es/glyph/ripple.js.map +1 -1
- package/es/glyph/tree-path.js +4 -1
- package/es/glyph/tree-path.js.map +1 -1
- package/es/glyph/violin.js +4 -1
- package/es/glyph/violin.js.map +1 -1
- package/es/glyph/wave.js +3 -1
- package/es/glyph/wave.js.map +1 -1
- package/es/graph/animation/animate.js +4 -3
- package/es/graph/animation/animate.js.map +1 -1
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/es/graph/animation/animator.js +3 -2
- package/es/graph/animation/animator.js.map +1 -1
- package/es/graph/animation/attribute.d.ts +2 -2
- package/es/graph/animation/attribute.js +1 -1
- package/es/graph/animation/attribute.js.map +1 -1
- package/es/graph/animation/config.js +10 -8
- package/es/graph/animation/config.js.map +1 -1
- package/es/graph/animation/morph.js +1 -1
- package/es/graph/animation/morph.js.map +1 -1
- package/es/graph/attributes/line.d.ts +1 -0
- package/es/graph/attributes/line.js +8 -1
- package/es/graph/attributes/line.js.map +1 -1
- package/es/graph/attributes/transform.js +0 -24
- package/es/graph/attributes/transform.js.map +1 -1
- package/es/graph/canvas-renderer.d.ts +1 -1
- package/es/graph/canvas-renderer.js +2 -2
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/constants.d.ts +1 -0
- package/es/graph/constants.js +2 -0
- package/es/graph/constants.js.map +1 -1
- package/es/graph/element.d.ts +2 -2
- package/es/graph/element.js +9 -10
- package/es/graph/element.js.map +1 -1
- package/es/graph/glyph-element.d.ts +1 -1
- package/es/graph/glyph-element.js.map +1 -1
- package/es/graph/mark/graphic.d.ts +22 -0
- package/es/graph/mark/graphic.js +98 -0
- package/es/graph/mark/graphic.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +2 -2
- package/es/graph/mark/large-rects.js +1 -1
- package/es/graph/mark/large-rects.js.map +1 -1
- package/es/graph/mark/large-symbols.d.ts +2 -2
- package/es/graph/mark/large-symbols.js +1 -1
- package/es/graph/mark/large-symbols.js.map +1 -1
- package/es/graph/util/env.js +1 -1
- package/es/graph/util/env.js.map +1 -1
- package/es/graph/util/events-extend.d.ts +1 -1
- package/es/graph/util/events-extend.js.map +1 -1
- package/es/graph/util/graphic.d.ts +3 -5
- package/es/graph/util/graphic.js +13 -35
- package/es/graph/util/graphic.js.map +1 -1
- package/es/index.d.ts +5 -2
- package/es/index.js +8 -2
- package/es/index.js.map +1 -1
- package/es/interactions/brush-active.d.ts +1 -1
- package/es/interactions/brush-active.js.map +1 -1
- package/es/interactions/brush-base.d.ts +1 -1
- package/es/interactions/brush-base.js.map +1 -1
- package/es/interactions/brush-filter.d.ts +1 -1
- package/es/interactions/brush-filter.js +2 -1
- package/es/interactions/brush-filter.js.map +1 -1
- package/es/interactions/brush-highlight.d.ts +1 -1
- package/es/interactions/brush-highlight.js.map +1 -1
- package/es/interactions/crosshair.js.map +1 -1
- package/es/interactions/drill-down.d.ts +1 -1
- package/es/interactions/drill-down.js.map +1 -1
- package/es/interactions/element-highlight-by-group.js +1 -2
- package/es/interactions/index.js +2 -1
- package/es/interactions/legend-filter.js +1 -1
- package/es/interactions/player-filter.js +1 -1
- package/es/interactions/roll-up.js +1 -1
- package/es/interactions/scrollbar-filter.js +1 -1
- package/es/interactions/slider-filter.js +1 -1
- package/es/interactions/tooltip.js +1 -1
- package/es/interactions/view-drag-mixin.js +1 -1
- package/es/parse/coordinate.js +1 -1
- package/es/parse/event.js +1 -1
- package/es/parse/mark.js +1 -1
- package/es/parse/option.js +1 -1
- package/es/parse/scale.js +3 -4
- package/es/parse/scale.js.map +1 -1
- package/es/parse/transform.js +1 -1
- package/es/parse/util.js +1 -1
- package/es/parse/view.js +1 -1
- package/es/semantic-marks/cell.d.ts +1 -1
- package/es/semantic-marks/interval.d.ts +1 -1
- package/es/semantic-marks/interval.js +3 -3
- package/es/semantic-marks/interval.js.map +1 -1
- package/es/transforms/data/contour.js +2 -2
- package/es/transforms/data/contour.js.map +1 -1
- package/es/transforms/data/sampling.js +5 -3
- package/es/transforms/data/sampling.js.map +1 -1
- package/es/transforms/data/unfold.js +3 -3
- package/es/transforms/data/unfold.js.map +1 -1
- package/es/transforms/mark/symmetry.js +2 -2
- package/es/transforms/mark/symmetry.js.map +1 -1
- package/es/transforms/util/util.d.ts +0 -2
- package/es/transforms/util/util.js +0 -8
- package/es/transforms/util/util.js.map +1 -1
- package/es/types/animate.d.ts +3 -1
- package/es/types/animate.js.map +1 -1
- package/es/types/component.d.ts +5 -5
- package/es/types/component.js.map +1 -1
- package/es/types/element.d.ts +1 -1
- package/es/types/element.js.map +1 -1
- package/es/types/event.d.ts +1 -1
- package/es/types/event.js.map +1 -1
- package/es/types/grammar.d.ts +5 -5
- package/es/types/grammar.js.map +1 -1
- package/es/types/interaction.d.ts +1 -1
- package/es/types/interaction.js.map +1 -1
- package/es/types/mark.d.ts +1 -1
- package/es/types/mark.js.map +1 -1
- package/es/types/morph.d.ts +1 -1
- package/es/types/morph.js.map +1 -1
- package/es/types/plot.d.ts +1 -1
- package/es/types/plot.js.map +1 -1
- package/es/types/renderer.d.ts +1 -1
- package/es/types/renderer.js.map +1 -1
- package/es/types/theme.d.ts +1 -1
- package/es/types/theme.js.map +1 -1
- package/es/types/view.d.ts +1 -1
- package/es/types/view.js.map +1 -1
- package/es/util/text.d.ts +1 -1
- package/es/util/text.js +1 -1
- package/es/util/text.js.map +1 -1
- package/es/view/View.d.ts +1 -1
- package/es/view/View.js +11 -12
- package/es/view/View.js.map +1 -1
- package/es/view/component.d.ts +1 -1
- package/es/view/coordinate.d.ts +1 -0
- package/es/view/coordinate.js +6 -0
- package/es/view/coordinate.js.map +1 -1
- package/es/view/mark.d.ts +4 -4
- package/es/view/mark.js +12 -7
- package/es/view/mark.js.map +1 -1
- package/es/view/scale.d.ts +1 -0
- package/es/view/scale.js +6 -0
- package/es/view/scale.js.map +1 -1
- package/package.json +11 -12
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Factory } from "../../core/factory";
|
|
2
|
+
|
|
3
|
+
import { GrammarMarkType } from "../enums";
|
|
4
|
+
|
|
5
|
+
import { LargeRects } from "./large-rects";
|
|
6
|
+
|
|
7
|
+
import { LargeSymbols } from "./large-symbols";
|
|
8
|
+
|
|
9
|
+
import { createArc, createCircle, createArc3d, createPyramid3d, createArea, createGroup, createImage, createRect3d, createLine, createPath, createRect, createSymbol, createText, createPolygon, createRichText, createGlyph, registerCircle, registerArc, registerArc3d, registerPyramid3d, registerArea, registerGroup, registerImage, registerRect3d, registerLine, registerPath, registerRect, registerSymbol, registerText, registerPolygon, registerRichtext, registerGlyph } from "@visactor/vrender/es/register";
|
|
10
|
+
|
|
11
|
+
export const registerCircleGraphic = () => {
|
|
12
|
+
registerCircle(), Factory.registerGraphic(GrammarMarkType.circle, createCircle);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const registerArcGraphic = () => {
|
|
16
|
+
registerArc(), Factory.registerGraphic(GrammarMarkType.arc, createArc);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const registerArc3dGraphic = () => {
|
|
20
|
+
registerArc3d(), Factory.registerGraphic(GrammarMarkType.arc3d, createArc3d);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const registerPyramid3dGraphic = () => {
|
|
24
|
+
registerPyramid3d(), Factory.registerGraphic(GrammarMarkType.pyramid3d, createPyramid3d);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const registerAreaGraphic = () => {
|
|
28
|
+
registerArea(), Factory.registerGraphic(GrammarMarkType.area, createArea);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const registerGroupGraphic = () => {
|
|
32
|
+
registerGroup(), Factory.registerGraphic(GrammarMarkType.group, createGroup);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const registerImageGraphic = () => {
|
|
36
|
+
registerImage(), Factory.registerGraphic(GrammarMarkType.image, createImage);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const registerLineGraphic = () => {
|
|
40
|
+
registerLine(), Factory.registerGraphic(GrammarMarkType.line, createLine);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const registerPathGraphic = () => {
|
|
44
|
+
registerPath(), Factory.registerGraphic(GrammarMarkType.path, createPath);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const registerRectGraphic = () => {
|
|
48
|
+
registerRect(), Factory.registerGraphic(GrammarMarkType.rect, createRect);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const registerRect3dGraphic = () => {
|
|
52
|
+
registerRect3d(), Factory.registerGraphic(GrammarMarkType.rect3d, createRect3d);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const registerRuleGraphic = () => {
|
|
56
|
+
registerLine(), Factory.registerGraphic(GrammarMarkType.rule, createLine);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const registerShapeGraphic = () => {
|
|
60
|
+
registerPath(), Factory.registerGraphic(GrammarMarkType.shape, createPath);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const registerSymbolGraphic = () => {
|
|
64
|
+
registerSymbol(), Factory.registerGraphic(GrammarMarkType.symbol, createSymbol);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const registerTextGraphic = () => {
|
|
68
|
+
registerText(), Factory.registerGraphic(GrammarMarkType.text, createText);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const registerPolygonGraphic = () => {
|
|
72
|
+
registerPolygon(), Factory.registerGraphic(GrammarMarkType.polygon, createPolygon);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const registerRichTextGraphic = () => {
|
|
76
|
+
registerRichtext(), Factory.registerGraphic(GrammarMarkType.richtext, createRichText);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const registerCellGraphic = () => {
|
|
80
|
+
registerSymbol(), Factory.registerGraphic(GrammarMarkType.cell, createSymbol);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const registerIntervalGraphic = () => {
|
|
84
|
+
registerRect(), Factory.registerGraphic(GrammarMarkType.interval, createRect);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const registerGlyphGraphic = () => {
|
|
88
|
+
registerGlyph(), Factory.registerGraphic(GrammarMarkType.glyph, createGlyph);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const registerLargeRectsGraphic = () => {
|
|
92
|
+
registerPath(), Factory.registerGraphic(GrammarMarkType.largeRects, (attrs => new LargeRects(attrs)));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const registerLargeSymbolsGraphic = () => {
|
|
96
|
+
registerPath(), Factory.registerGraphic(GrammarMarkType.largeSymbols, (attrs => new LargeSymbols(attrs)));
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=graphic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/graphic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACd,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,cAAc,EAAE,CAAC;IACjB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,WAAW,EAAE,CAAC;IACd,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,aAAa,EAAE,CAAC;IACh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AAc,EAAE,CAAC;IACjB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,aAAa,EAAE,CAAC;IAChB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE;QACjE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAwB,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,KAAU,EAAE,EAAE;QACnE,OAAO,IAAI,YAAY,CAAC,KAAK,CAAwB,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","file":"graphic.js","sourcesContent":["import { Factory } from '../../core/factory';\nimport { GrammarMarkType } from '../enums';\nimport { LargeRects } from './large-rects';\nimport { LargeSymbols } from './large-symbols';\nimport type { IGraphic } from '@visactor/vrender/es';\n\nimport {\n createArc,\n createCircle,\n createArc3d,\n createPyramid3d,\n createArea,\n createGroup,\n createImage,\n createRect3d,\n createLine,\n createPath,\n createRect,\n createSymbol,\n createText,\n createPolygon,\n createRichText,\n createGlyph,\n registerCircle,\n registerArc,\n registerArc3d,\n registerPyramid3d,\n registerArea,\n registerGroup,\n registerImage,\n registerRect3d,\n registerLine,\n registerPath,\n registerRect,\n registerSymbol,\n registerText,\n registerPolygon,\n registerRichtext,\n registerGlyph\n} from '@visactor/vrender/es/register';\n\nexport const registerCircleGraphic = () => {\n registerCircle();\n Factory.registerGraphic(GrammarMarkType.circle, createCircle);\n};\n\nexport const registerArcGraphic = () => {\n registerArc();\n Factory.registerGraphic(GrammarMarkType.arc, createArc);\n};\n\nexport const registerArc3dGraphic = () => {\n registerArc3d();\n Factory.registerGraphic(GrammarMarkType.arc3d, createArc3d);\n};\n\nexport const registerPyramid3dGraphic = () => {\n registerPyramid3d();\n Factory.registerGraphic(GrammarMarkType.pyramid3d, createPyramid3d);\n};\n\nexport const registerAreaGraphic = () => {\n registerArea();\n Factory.registerGraphic(GrammarMarkType.area, createArea);\n};\n\nexport const registerGroupGraphic = () => {\n registerGroup();\n Factory.registerGraphic(GrammarMarkType.group, createGroup);\n};\n\nexport const registerImageGraphic = () => {\n registerImage();\n Factory.registerGraphic(GrammarMarkType.image, createImage);\n};\n\nexport const registerLineGraphic = () => {\n registerLine();\n Factory.registerGraphic(GrammarMarkType.line, createLine);\n};\n\nexport const registerPathGraphic = () => {\n registerPath();\n Factory.registerGraphic(GrammarMarkType.path, createPath);\n};\n\nexport const registerRectGraphic = () => {\n registerRect();\n Factory.registerGraphic(GrammarMarkType.rect, createRect);\n};\n\nexport const registerRect3dGraphic = () => {\n registerRect3d();\n Factory.registerGraphic(GrammarMarkType.rect3d, createRect3d);\n};\n\nexport const registerRuleGraphic = () => {\n registerLine();\n Factory.registerGraphic(GrammarMarkType.rule, createLine);\n};\n\nexport const registerShapeGraphic = () => {\n registerPath();\n Factory.registerGraphic(GrammarMarkType.shape, createPath);\n};\n\nexport const registerSymbolGraphic = () => {\n registerSymbol();\n Factory.registerGraphic(GrammarMarkType.symbol, createSymbol);\n};\n\nexport const registerTextGraphic = () => {\n registerText();\n Factory.registerGraphic(GrammarMarkType.text, createText);\n};\n\nexport const registerPolygonGraphic = () => {\n registerPolygon();\n Factory.registerGraphic(GrammarMarkType.polygon, createPolygon);\n};\n\nexport const registerRichTextGraphic = () => {\n registerRichtext();\n Factory.registerGraphic(GrammarMarkType.richtext, createRichText);\n};\n\nexport const registerCellGraphic = () => {\n registerSymbol();\n Factory.registerGraphic(GrammarMarkType.cell, createSymbol);\n};\n\nexport const registerIntervalGraphic = () => {\n registerRect();\n Factory.registerGraphic(GrammarMarkType.interval, createRect);\n};\n\nexport const registerGlyphGraphic = () => {\n registerGlyph();\n Factory.registerGraphic(GrammarMarkType.glyph, createGlyph);\n};\n\nexport const registerLargeRectsGraphic = () => {\n registerPath();\n Factory.registerGraphic(GrammarMarkType.largeRects, (attrs: any) => {\n return new LargeRects(attrs) as unknown as IGraphic;\n });\n};\n\nexport const registerLargeSymbolsGraphic = () => {\n registerPath();\n Factory.registerGraphic(GrammarMarkType.largeSymbols, (attrs: any) => {\n return new LargeSymbols(attrs) as unknown as IGraphic;\n });\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IGroupGraphicAttribute } from '@visactor/vrender
|
|
2
|
-
import { Group } from '@visactor/vrender
|
|
1
|
+
import type { IGroupGraphicAttribute } from '@visactor/vrender/es/core';
|
|
2
|
+
import { Group } from '@visactor/vrender/es/core';
|
|
3
3
|
interface LargeRectsAttribute extends IGroupGraphicAttribute {
|
|
4
4
|
points: Float32Array | number[];
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/large-rects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/large-rects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAMhE,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,UAA+B;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CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF","file":"large-rects.js","sourcesContent":["/**\n * use when mark render in large mode or progressive mode\n */\nimport type { IGroupGraphicAttribute, IPath, ICustomPath2D } from '@visactor/vrender/es/core';\nimport { Group, CustomPath2D } from '@visactor/vrender/es/core';\n\ninterface LargeRectsAttribute extends IGroupGraphicAttribute {\n points: Float32Array | number[];\n}\n\nexport class LargeRects extends Group {\n constructor(attributes: LargeRectsAttribute) {\n super(attributes);\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n });\n }\n\n render() {\n const pathNode = this.createOrUpdateChild('large-path', {}, 'path') as IPath;\n const points = (this.attribute as LargeRectsAttribute).points;\n const path2d = (pathNode.attribute.path as ICustomPath2D) ?? new CustomPath2D();\n let x;\n let y;\n let width;\n let height;\n\n path2d.clear();\n for (let i = 0, len = points.length; i < len; i += 4) {\n x = points[i];\n y = points[i + 1];\n width = points[i + 2];\n height = points[i + 3];\n path2d.rect(x, y, width, height);\n }\n\n const pathAttrs = Object.assign({}, this.attribute, { path: path2d, points: null });\n this.attribute = {};\n (pathNode as IPath).setAttributes(pathAttrs);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IGroupGraphicAttribute } from '@visactor/vrender
|
|
2
|
-
import { Group } from '@visactor/vrender
|
|
1
|
+
import type { IGroupGraphicAttribute } from '@visactor/vrender/es/core';
|
|
2
|
+
import { Group } from '@visactor/vrender/es/core';
|
|
3
3
|
interface LargeSymbolsAttribute extends IGroupGraphicAttribute {
|
|
4
4
|
size: number;
|
|
5
5
|
points: Float32Array | number[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumber, max } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
import { CustomPath2D, Group, DefaultSymbolAttribute } from "@visactor/vrender
|
|
3
|
+
import { CustomPath2D, Group, DefaultSymbolAttribute } from "@visactor/vrender/es/core";
|
|
4
4
|
|
|
5
5
|
export class LargeSymbols extends Group {
|
|
6
6
|
constructor(attributes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOxF,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,UAAiC;QAC3C,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,CAAU,CAAC;QAC7E,MAAM,MAAM,GAAI,IAAI,CAAC,SAAmC,CAAC,MAAM,CAAC;QAChE,MAAM,IAAI,GAAG,MAAC,IAAI,CAAC,SAAmC,CAAC,IAAI,mCAAK,sBAAsB,CAAC,IAAe,CAAC;QACvG,MAAM,MAAM,GAAG,MAAC,QAAQ,CAAC,SAAS,CAAC,IAAsB,mCAAI,IAAI,YAAY,EAAE,CAAC;QAChF,IAAI,CAAC,CAAC;QACN,IAAI,CAAC,CAAC;QAEN,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;YACpD,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACd,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC9C,MAAM,CAAC,SAAS,EAAE,CAAC;SACpB;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACnB,QAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF","file":"large-symbols.js","sourcesContent":["import type { ICustomPath2D, IGroupGraphicAttribute, IPath } from '@visactor/vrender/es/core';\nimport { isNumber, max } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { CustomPath2D, Group, DefaultSymbolAttribute } from '@visactor/vrender/es/core';\n\ninterface LargeSymbolsAttribute extends IGroupGraphicAttribute {\n size: number;\n points: Float32Array | number[];\n}\n\nexport class LargeSymbols extends Group {\n constructor(attributes: LargeSymbolsAttribute) {\n super(attributes);\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n });\n }\n\n render() {\n const pathNode = this.createOrUpdateChild('large-path', {}, 'path') as IPath;\n const points = (this.attribute as LargeSymbolsAttribute).points;\n const size = (this.attribute as LargeSymbolsAttribute).size ?? (DefaultSymbolAttribute.size as number);\n const path2d = (pathNode.attribute.path as ICustomPath2D) ?? new CustomPath2D();\n let x;\n let y;\n\n path2d.clear();\n const maxSize = isNumber(size) ? size : max(size[0], size[1]);\n for (let i = 0, len = points.length; i < len; i += 4) {\n x = points[i];\n y = points[i + 1];\n path2d.arc(x, y, maxSize / 2, 0, Math.PI * 2);\n path2d.closePath();\n }\n\n const pathAttrs = Object.assign({}, this.attribute, { path: path2d, points: null, size: null });\n this.attribute = {};\n (pathNode as IPath).setAttributes(pathAttrs);\n }\n}\n"]}
|
package/es/graph/util/env.js
CHANGED
package/es/graph/util/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAC/D,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;KACxD;AACH,CAAC","file":"env.js","sourcesContent":["import { vglobal } from '@visactor/vrender/es/core';\nimport type { IEnvironmentOptions } from '../../types';\n\nexport function configureEnvironment(options: IEnvironmentOptions) {\n if (options.mode) {\n vglobal.setEnv(options.mode, options.modeParams || {});\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FederatedEvent } from '@visactor/vrender
|
|
1
|
+
import type { FederatedEvent } from '@visactor/vrender/es/core';
|
|
2
2
|
import type { IElement } from './../../types/element';
|
|
3
3
|
import type { IView } from './../../types/view';
|
|
4
4
|
import type { EventSourceType } from '../../types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/events-extend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,mBAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,KAAK,CAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC","file":"events-extend.js","sourcesContent":["import type { FederatedEvent } from '@visactor/vrender
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/events-extend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,mBAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,KAAK,CAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC","file":"events-extend.js","sourcesContent":["import type { FederatedEvent } from '@visactor/vrender/es/core';\nimport type { IElement } from './../../types/element';\nimport type { IView } from './../../types/view';\nimport { point } from './point';\nimport { EVENT_SOURCE_WINDOW } from '../../view/constants';\nimport type { EventSourceType } from '../../types';\n\nexport default function getExtendedEvents(\n view: IView,\n event: FederatedEvent,\n item: IElement,\n type: string,\n source: EventSourceType\n) {\n if (source === EVENT_SOURCE_WINDOW) {\n const e = (event as any).changedTouches ? (event as any).changedTouches[0] : event;\n point(e);\n }\n\n (event as any).element = item;\n\n return event;\n}\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { IGlyphMeta, IMark } from '../../types';
|
|
2
|
-
import type { IGraphic } from '@visactor/vrender
|
|
3
|
-
import { LargeRects } from '../mark/large-rects';
|
|
4
|
-
import { LargeSymbols } from '../mark/large-symbols';
|
|
2
|
+
import type { IGraphic } from '@visactor/vrender/es/core';
|
|
5
3
|
export declare const isMarkType: (type: string) => boolean;
|
|
6
|
-
export declare function createGraphicItem(mark: IMark, markType: string, attrs?: any): IGraphic<Partial<import("@visactor/vrender
|
|
7
|
-
export declare function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs?: any):
|
|
4
|
+
export declare function createGraphicItem(mark: IMark, markType: string, attrs?: any): IGraphic<Partial<import("@visactor/vrender/es/core").IGraphicAttribute>>;
|
|
5
|
+
export declare function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs?: any): IGraphic<Partial<import("@visactor/vrender/es/core").IGraphicAttribute>>;
|
|
8
6
|
export declare const removeGraphicItem: (graphicItem: IGraphic) => void;
|
|
9
7
|
export declare const getMarkTypeOfLarge: (markType: string) => string;
|
package/es/graph/util/graphic.js
CHANGED
|
@@ -1,54 +1,32 @@
|
|
|
1
|
-
import { createArc, createArea, createGroup, createImage, createRect3d, createLine, createPath, createRect, createSymbol, createRichText, createText, createPolygon, createGlyph, createArc3d, createPyramid3d, createCircle } from "@visactor/vrender-core";
|
|
2
|
-
|
|
3
1
|
import { HOOK_EVENT, GrammarMarkType } from "../enums";
|
|
4
2
|
|
|
5
3
|
import { BridgeElementKey } from "../constants";
|
|
6
4
|
|
|
7
|
-
import { LargeRects } from "../mark/large-rects";
|
|
8
|
-
|
|
9
|
-
import { LargeSymbols } from "../mark/large-symbols";
|
|
10
|
-
|
|
11
5
|
import { Factory } from "../../core/factory";
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
circle: createCircle,
|
|
15
|
-
arc: createArc,
|
|
16
|
-
arc3d: createArc3d,
|
|
17
|
-
pyramid3d: createPyramid3d,
|
|
18
|
-
area: createArea,
|
|
19
|
-
group: createGroup,
|
|
20
|
-
image: createImage,
|
|
21
|
-
rect3d: createRect3d,
|
|
22
|
-
line: createLine,
|
|
23
|
-
path: createPath,
|
|
24
|
-
rect: createRect,
|
|
25
|
-
rule: createLine,
|
|
26
|
-
shape: createPath,
|
|
27
|
-
symbol: createSymbol,
|
|
28
|
-
text: createText,
|
|
29
|
-
richtext: createRichText,
|
|
30
|
-
polygon: createPolygon,
|
|
31
|
-
cell: createSymbol,
|
|
32
|
-
interval: createRect
|
|
33
|
-
};
|
|
7
|
+
import { Logger } from "@visactor/vutils";
|
|
34
8
|
|
|
35
|
-
export const isMarkType = type => !!
|
|
9
|
+
export const isMarkType = type => !!GrammarMarkType[type];
|
|
36
10
|
|
|
37
11
|
export function createGraphicItem(mark, markType, attrs = {}) {
|
|
38
12
|
var _a;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const graphicItem = itemCreator[markType] ? itemCreator[markType](attrs) : Factory.createGraphicComponent(markType, attrs, {
|
|
13
|
+
mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);
|
|
14
|
+
const graphicItem = Factory.getGraphicType(markType) ? Factory.createGraphic(markType, attrs) : Factory.createGraphicComponent(markType, attrs, {
|
|
42
15
|
skipDefault: null === (_a = null == mark ? void 0 : mark.spec) || void 0 === _a ? void 0 : _a.skipTheme
|
|
43
16
|
});
|
|
17
|
+
if (!graphicItem) {
|
|
18
|
+
Logger.getInstance().error(`create ${markType} graphic failed!`);
|
|
19
|
+
}
|
|
44
20
|
return mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK), graphicItem;
|
|
45
21
|
}
|
|
46
22
|
|
|
47
23
|
export function createGlyphGraphicItem(mark, glyphMeta, attrs = {}) {
|
|
48
|
-
mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);
|
|
49
|
-
const graphicItem =
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
if (mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK), !Factory.getGraphicType(GrammarMarkType.glyph)) return;
|
|
25
|
+
const graphicItem = Factory.createGraphic(GrammarMarkType.glyph, attrs), glyphMarks = glyphMeta.getMarks(), subGraphics = Object.keys(glyphMarks).map((name => {
|
|
26
|
+
if (Factory.getGraphicType(glyphMarks[name])) {
|
|
27
|
+
const graphic = Factory.createGraphic(glyphMarks[name]);
|
|
28
|
+
if (graphic) return graphic.name = name, graphic;
|
|
29
|
+
}
|
|
52
30
|
}));
|
|
53
31
|
return graphicItem.setSubGraphic(subGraphics), mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK),
|
|
54
32
|
graphicItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/graphic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/graphic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;IACzC,OAAO,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AA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M,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;gBACpB,OAAO,OAAO,CAAC;aAChB;SACF;IACH,CAAC,CAAC,CAAC;IACH,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAEvC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAChD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAqB,EAAE,EAAE;IACzD,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;QACrC,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,WAAW,CAAC,MAAM,EAAE;YACtB,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;SAC7C;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,eAAe,CAAC,IAAI,EAAE;QACrC,OAAO,eAAe,CAAC,UAAU,CAAC;KACnC;IAED,IAAI,QAAQ,KAAK,eAAe,CAAC,MAAM,EAAE;QACvC,OAAO,eAAe,CAAC,YAAY,CAAC;KACrC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC","file":"graphic.js","sourcesContent":["import type { IGlyphMeta, IMark } from '../../types';\nimport type { IGraphic } from '@visactor/vrender/es/core';\n// eslint-disable-next-line no-duplicate-imports\n\nimport { HOOK_EVENT, GrammarMarkType } from '../enums';\nimport { BridgeElementKey } from '../constants';\nimport { Factory } from '../../core/factory';\nimport { Logger } from '@visactor/vutils';\n\nexport const isMarkType = (type: string) => {\n return !!GrammarMarkType[type];\n};\n\nexport function createGraphicItem(mark: IMark, markType: string, attrs: any = {}) {\n mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);\n\n const graphicItem: IGraphic = Factory.getGraphicType(markType)\n ? Factory.createGraphic(markType, attrs)\n : Factory.createGraphicComponent(markType, attrs, {\n skipDefault: (mark as any)?.spec?.skipTheme\n });\n\n if (!graphicItem) {\n const logger = Logger.getInstance();\n logger.error(`create ${markType} graphic failed!`);\n }\n\n mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK);\n return graphicItem;\n}\n\nexport function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs: any = {}) {\n mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);\n if (!Factory.getGraphicType(GrammarMarkType.glyph)) {\n return;\n }\n const graphicItem = Factory.createGraphic(GrammarMarkType.glyph, attrs);\n const glyphMarks = glyphMeta.getMarks();\n const subGraphics: IGraphic[] = Object.keys(glyphMarks).map(name => {\n if (Factory.getGraphicType(glyphMarks[name])) {\n const graphic = Factory.createGraphic(glyphMarks[name]);\n if (graphic) {\n graphic.name = name;\n return graphic;\n }\n }\n });\n graphicItem.setSubGraphic(subGraphics);\n\n mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK);\n return graphicItem;\n}\n\nexport const removeGraphicItem = (graphicItem: IGraphic) => {\n if (graphicItem) {\n graphicItem[BridgeElementKey] = null;\n graphicItem.release();\n if (graphicItem.parent) {\n graphicItem.parent.removeChild(graphicItem);\n }\n }\n};\n\nexport const getMarkTypeOfLarge = (markType: string) => {\n if (markType === GrammarMarkType.rect) {\n return GrammarMarkType.largeRects;\n }\n\n if (markType === GrammarMarkType.symbol) {\n return GrammarMarkType.largeSymbols;\n }\n\n return markType;\n};\n"]}
|
package/es/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare const version = "0.10.0-alpha.
|
|
1
|
+
export declare const version = "0.10.0-alpha.3";
|
|
2
2
|
export * from './graph';
|
|
3
3
|
export * from './interactions';
|
|
4
4
|
export { View } from './view';
|
|
5
|
+
export { Scale, registerScale } from './view/scale';
|
|
6
|
+
export { Coordinate, registerCoordinate } from './view/coordinate';
|
|
5
7
|
export { parseFunctionType, invokeFunctionType } from './parse/util';
|
|
6
8
|
export { GrammarBase } from './view/grammar-base';
|
|
7
9
|
export * from './util/text';
|
|
@@ -13,8 +15,9 @@ export * from './glyph';
|
|
|
13
15
|
export * from './component';
|
|
14
16
|
export * from './transforms';
|
|
15
17
|
export * from './graph/animation/animation';
|
|
16
|
-
export { vglobal } from '@visactor/vrender
|
|
18
|
+
export { vglobal } from '@visactor/vrender/es/core';
|
|
17
19
|
export * from './env';
|
|
18
20
|
export * from './interactions';
|
|
19
21
|
export * from './semantic-marks/cell';
|
|
20
22
|
export * from './semantic-marks/interval';
|
|
23
|
+
export * from './graph/mark/graphic';
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "0.10.0-alpha.
|
|
1
|
+
export const version = "0.10.0-alpha.3";
|
|
2
2
|
|
|
3
3
|
export * from "./graph";
|
|
4
4
|
|
|
@@ -6,6 +6,10 @@ export * from "./interactions";
|
|
|
6
6
|
|
|
7
7
|
export { View } from "./view";
|
|
8
8
|
|
|
9
|
+
export { Scale, registerScale } from "./view/scale";
|
|
10
|
+
|
|
11
|
+
export { Coordinate, registerCoordinate } from "./view/coordinate";
|
|
12
|
+
|
|
9
13
|
export { parseFunctionType, invokeFunctionType } from "./parse/util";
|
|
10
14
|
|
|
11
15
|
export { GrammarBase } from "./view/grammar-base";
|
|
@@ -28,7 +32,7 @@ export * from "./transforms";
|
|
|
28
32
|
|
|
29
33
|
export * from "./graph/animation/animation";
|
|
30
34
|
|
|
31
|
-
export { vglobal } from "@visactor/vrender
|
|
35
|
+
export { vglobal } from "@visactor/vrender/es/core";
|
|
32
36
|
|
|
33
37
|
export * from "./env";
|
|
34
38
|
|
|
@@ -37,4 +41,6 @@ export * from "./interactions";
|
|
|
37
41
|
export * from "./semantic-marks/cell";
|
|
38
42
|
|
|
39
43
|
export * from "./semantic-marks/interval";
|
|
44
|
+
|
|
45
|
+
export * from "./graph/mark/graphic";
|
|
40
46
|
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.10.0-alpha.3\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender/es/core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
import type { IPolygon } from '@visactor/vrender/es/core';
|
|
2
2
|
import type { BrushActiveOptions, IView } from '../types';
|
|
3
3
|
import { BrushBase } from './brush-base';
|
|
4
4
|
import { type IBounds } from '@visactor/vutils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/brush-active.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,WAAY,SAAQ,SAA6B;IAQ5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QAPrE,SAAI,GAAW,WAAW,CAAC,IAAI,CAAC;QAUhC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;oBAE1F,IAAI,QAAQ,EAAE;wBACZ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBAClB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACjC;yBAAM;wBACL,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACpC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;IAvBF,CAAC;;AATM,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,oBAAoB,CAAC,MAAM;CACnC,CAAC","file":"brush-active.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
{"version":3,"sources":["../src/interactions/brush-active.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,WAAY,SAAQ,SAA6B;IAQ5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QAPrE,SAAI,GAAW,WAAW,CAAC,IAAI,CAAC;QAUhC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;oBAE1F,IAAI,QAAQ,EAAE;wBACZ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBAClB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACjC;yBAAM;wBACL,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACpC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;IAvBF,CAAC;;AATM,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,oBAAoB,CAAC,MAAM;CACnC,CAAC","file":"brush-active.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender/es/core';\nimport { InteractionStateEnum } from '../graph/enums';\nimport type { BrushActiveOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { type IBounds } from '@visactor/vutils';\n\nexport class BrushActive extends BrushBase<BrushActiveOptions> {\n static type: string = 'brush-active';\n type: string = BrushActive.type;\n\n static defaultOptions: BrushActiveOptions = {\n state: InteractionStateEnum.active\n };\n\n constructor(view: IView, option?: BrushActiveOptions) {\n super(view, Object.assign({}, BrushActive.defaultOptions, option));\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isActive = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isActive) {\n elements.push(el);\n el.addState(this.options.state);\n } else {\n el.removeState(this.options.state);\n }\n });\n });\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Brush } from '@visactor/vrender-components';
|
|
2
2
|
import type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';
|
|
3
3
|
import { BaseInteraction } from './base';
|
|
4
|
-
import type { IGraphic, IPolygon } from '@visactor/vrender
|
|
4
|
+
import type { IGraphic, IPolygon } from '@visactor/vrender/es/core';
|
|
5
5
|
import { type IBounds } from '@visactor/vutils';
|
|
6
6
|
export declare abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {
|
|
7
7
|
options: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/brush-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,mBAAmB,EAGnB,uBAAuB,EACvB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,OAAgB,SAAkC,SAAQ,eAAkB;IAKhF,YAAY,IAAW,EAAE,OAAW;QAClC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QA0HvB,oBAAe,GAAG,GAAG,EAAE;;YACrB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE;gBAC7B,OAAO;aACR;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAEvC,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC;gBAC1B,gBAAgB,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,mCAAI;oBACjD,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;iBACjB;gBACD,MAAM,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,mCAAI,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;gBACvD,MAAM,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,MA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AAO,CAAC,KAAK,EAAE;gBACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACrC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACxB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B;SACF;IACH,CAAC;CACF","file":"brush-base.js","sourcesContent":["import { Brush, IOperateType } from '@visactor/vrender-components';\nimport type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';\nimport { BaseInteraction } from './base';\nimport type { IGraphic, IPolygon, IRectGraphicAttribute } from '@visactor/vrender-core';\nimport {\n polygonContainPoint,\n type IBounds,\n type IPointLike,\n polygonIntersectPolygon,\n isRectIntersect\n} from '@visactor/vutils';\nimport { HOOK_EVENT } from '../graph/enums';\n\nexport abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {\n options: T;\n protected _brushComp?: Brush;\n protected _marks?: IMark[];\n\n constructor(view: IView, options?: T) {\n super(view, options);\n this.options = options;\n this._marks = view.getMarksBySelector(this.options.selector);\n }\n\n protected getEvents(): Array<{ type: string; handler: InteractionEventHandler }> {\n return [\n {\n type: HOOK_EVENT.BEFORE_DO_RENDER,\n handler: this.handleAfterDraw\n }\n ];\n }\n\n protected isPolygonBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n // 根据变换矩阵得到brushMask的实际坐标\n const points = brushMask.attribute.points;\n const { a, b, c, d, e, f } = brushMask.globalTransMatrix;\n\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const pointsCoord = points.map((p: IPointLike) => {\n return {\n x: a * p.x + c * p.y + e + dx,\n y: b * p.x + d * p.y + f + dy\n };\n });\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y) && polygonContainPoint(pointsCoord, x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n const pointsRect = [\n {\n x: x,\n y: y\n },\n {\n x: x + width,\n y: y\n },\n {\n x: x + width,\n y: y + height\n },\n {\n x: x,\n y: y + height\n }\n ];\n return polygonIntersectPolygon(pointsCoord, pointsRect);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isRectBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n return isRectIntersect(globalAABBBoundsOffset, { x1: x, y1: y, x2: x + width, y2: y + height }, false);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: { x: number; y: number }) {\n if (\n !brushMask?.globalTransMatrix ||\n !brushMask.globalAABBBounds ||\n brushMask.globalAABBBounds.empty() ||\n !graphicItem ||\n !brushMask?.attribute?.points ||\n brushMask.attribute.points.length <= 1\n ) {\n return false;\n }\n\n return this.options.brushType === 'polygon'\n ? this.isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset)\n : this.isRectBrushContainGraphicItem(brushMask, graphicItem, offset);\n }\n\n handleAfterDraw = () => {\n const stage = this.view.renderer.stage();\n if (this._brushComp || !stage) {\n return;\n }\n\n const viewBox = this.view.getViewBox();\n\n this._brushComp = new Brush({\n interactiveRange: this.options.interactiveRange ?? {\n minX: viewBox.x1,\n maxX: viewBox.x2,\n minY: viewBox.y1,\n maxY: viewBox.y2\n },\n xRange: this.options.xRange ?? [viewBox.x1, viewBox.x2],\n yRange: this.options.yRange ?? [viewBox.y1, viewBox.y2],\n brushMode: this.options.brushMode ?? 'single',\n brushType: this.options.brushType,\n brushStyle: this.options.brushStyle,\n brushMoved: this.options.brushMoved,\n removeOnClick: this.options.removeOnClick,\n sizeThreshold: this.options.sizeThreshold,\n delayType: this.options.delayType,\n delayTime: this.options.delayTime\n });\n this._brushComp.setUpdateDragMaskCallback(this.handleBrushUpdate);\n\n (stage.defaultLayer as any).appendChild(this._brushComp);\n };\n\n abstract handleBrushUpdate: (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => void;\n\n unbind(): void {\n super.unbind();\n\n if (this._brushComp) {\n this._brushComp.releaseBrushEvents();\n this._brushComp.release();\n this._brushComp = null;\n }\n }\n\n protected dispatchEvent(\n options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n },\n activeElements: (IElement | IGlyphElement)[]\n ) {\n const params = { operateType: options.operateType, operateMask: options.operateMask, activeElements };\n if (options.operateType === IOperateType.drawStart || options.operateType === IOperateType.moveStart) {\n this.view.emit('brushStart', params);\n if (this.options.onStart) {\n this.options.onStart(params);\n }\n } else if (options.operateType === IOperateType.drawing || options.operateType === IOperateType.moving) {\n this.view.emit('brushUpdate', params);\n if (this.options.onUpdate) {\n this.options.onEnd(params);\n }\n } else if (options.operateType === IOperateType.drawEnd || options.operateType === IOperateType.moveEnd) {\n this.view.emit('brushEnd', params);\n if (this.options.onEnd) {\n this.options.onEnd(params);\n }\n } else {\n this.view.emit('brushReset', params);\n if (this.options.onReset) {\n this.options.onReset(params);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interactions/brush-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,mBAAmB,EAGnB,uBAAuB,EACvB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,OAAgB,SAAkC,SAAQ,eAAkB;IAKhF,YAAY,IAAW,EAAE,OAAW;QAClC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QA0HvB,oBAAe,GAAG,GAAG,EAAE;;YACrB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE;gBAC7B,OAAO;aACR;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAEvC,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC;gBAC1B,gBAAgB,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,mCAAI;oBACjD,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,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,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,YAAY,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,YAAY,CAAC,OAAO,EAAE;YACvG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACnC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACrC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACxB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B;SACF;IACH,CAAC;CACF","file":"brush-base.js","sourcesContent":["import { Brush, IOperateType } from '@visactor/vrender-components';\nimport type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';\nimport { BaseInteraction } from './base';\nimport type { IGraphic, IPolygon, IRectGraphicAttribute } from '@visactor/vrender/es/core';\nimport {\n polygonContainPoint,\n type IBounds,\n type IPointLike,\n polygonIntersectPolygon,\n isRectIntersect\n} from '@visactor/vutils';\nimport { HOOK_EVENT } from '../graph/enums';\n\nexport abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {\n options: T;\n protected _brushComp?: Brush;\n protected _marks?: IMark[];\n\n constructor(view: IView, options?: T) {\n super(view, options);\n this.options = options;\n this._marks = view.getMarksBySelector(this.options.selector);\n }\n\n protected getEvents(): Array<{ type: string; handler: InteractionEventHandler }> {\n return [\n {\n type: HOOK_EVENT.BEFORE_DO_RENDER,\n handler: this.handleAfterDraw\n }\n ];\n }\n\n protected isPolygonBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n // 根据变换矩阵得到brushMask的实际坐标\n const points = brushMask.attribute.points;\n const { a, b, c, d, e, f } = brushMask.globalTransMatrix;\n\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const pointsCoord = points.map((p: IPointLike) => {\n return {\n x: a * p.x + c * p.y + e + dx,\n y: b * p.x + d * p.y + f + dy\n };\n });\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y) && polygonContainPoint(pointsCoord, x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n const pointsRect = [\n {\n x: x,\n y: y\n },\n {\n x: x + width,\n y: y\n },\n {\n x: x + width,\n y: y + height\n },\n {\n x: x,\n y: y + height\n }\n ];\n return polygonIntersectPolygon(pointsCoord, pointsRect);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isRectBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n return isRectIntersect(globalAABBBoundsOffset, { x1: x, y1: y, x2: x + width, y2: y + height }, false);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: { x: number; y: number }) {\n if (\n !brushMask?.globalTransMatrix ||\n !brushMask.globalAABBBounds ||\n brushMask.globalAABBBounds.empty() ||\n !graphicItem ||\n !brushMask?.attribute?.points ||\n brushMask.attribute.points.length <= 1\n ) {\n return false;\n }\n\n return this.options.brushType === 'polygon'\n ? this.isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset)\n : this.isRectBrushContainGraphicItem(brushMask, graphicItem, offset);\n }\n\n handleAfterDraw = () => {\n const stage = this.view.renderer.stage();\n if (this._brushComp || !stage) {\n return;\n }\n\n const viewBox = this.view.getViewBox();\n\n this._brushComp = new Brush({\n interactiveRange: this.options.interactiveRange ?? {\n minX: viewBox.x1,\n maxX: viewBox.x2,\n minY: viewBox.y1,\n maxY: viewBox.y2\n },\n xRange: this.options.xRange ?? [viewBox.x1, viewBox.x2],\n yRange: this.options.yRange ?? [viewBox.y1, viewBox.y2],\n brushMode: this.options.brushMode ?? 'single',\n brushType: this.options.brushType,\n brushStyle: this.options.brushStyle,\n brushMoved: this.options.brushMoved,\n removeOnClick: this.options.removeOnClick,\n sizeThreshold: this.options.sizeThreshold,\n delayType: this.options.delayType,\n delayTime: this.options.delayTime\n });\n this._brushComp.setUpdateDragMaskCallback(this.handleBrushUpdate);\n\n (stage.defaultLayer as any).appendChild(this._brushComp);\n };\n\n abstract handleBrushUpdate: (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => void;\n\n unbind(): void {\n super.unbind();\n\n if (this._brushComp) {\n this._brushComp.releaseBrushEvents();\n this._brushComp.release();\n this._brushComp = null;\n }\n }\n\n protected dispatchEvent(\n options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n },\n activeElements: (IElement | IGlyphElement)[]\n ) {\n const params = { operateType: options.operateType, operateMask: options.operateMask, activeElements };\n if (options.operateType === IOperateType.drawStart || options.operateType === IOperateType.moveStart) {\n this.view.emit('brushStart', params);\n if (this.options.onStart) {\n this.options.onStart(params);\n }\n } else if (options.operateType === IOperateType.drawing || options.operateType === IOperateType.moving) {\n this.view.emit('brushUpdate', params);\n if (this.options.onUpdate) {\n this.options.onEnd(params);\n }\n } else if (options.operateType === IOperateType.drawEnd || options.operateType === IOperateType.moveEnd) {\n this.view.emit('brushEnd', params);\n if (this.options.onEnd) {\n this.options.onEnd(params);\n }\n } else {\n this.view.emit('brushReset', params);\n if (this.options.onReset) {\n this.options.onReset(params);\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
import type { IPolygon } from '@visactor/vrender/es/core';
|
|
2
2
|
import type { BrushFilterOptions, IView } from '../types';
|
|
3
3
|
import { BrushBase } from './brush-base';
|
|
4
4
|
import { type IBounds } from '@visactor/vutils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/brush-filter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAgB,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOhD,MAAM,OAAO,WAAY,SAAQ,SAA6B;IAM5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,c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CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;YAC7C,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;YAC5C,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAC/B,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;QAChD,MAAM,aAAa,GAAG,CAAC,IAAW,EAAE,WAAgB,EAAE,EAAE;YACtD,MAAM,QAAQ,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;YACnD,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7D,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAEzF,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;;AA1BM,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuC,EAAE,CAAC","file":"brush-filter.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
{"version":3,"sources":["../src/interactions/brush-filter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAgB,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOhD,MAAM,OAAO,WAAY,SAAQ,SAA6B;IAM5D,YAAY,IAAW,EAAE,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AAQ,CAAC,CAAC;QACxC,CAAC,CAAC;QAzDA,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;YAC7C,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;YAC5C,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAC/B,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;QAChD,MAAM,aAAa,GAAG,CAAC,IAAW,EAAE,WAAgB,EAAE,EAAE;YACtD,MAAM,QAAQ,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;YACnD,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7D,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAEzF,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;;AA1BM,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuC,EAAE,CAAC","file":"brush-filter.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender/es/core';\nimport type { BrushFilterOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { isString, type IBounds, array } from '@visactor/vutils';\nimport { DataFilterRank } from '../graph/enums';\nimport type { FilterMixin } from './filter';\n\nexport interface BrushFilter\n extends Pick<FilterMixin, '_data' | '_filterValue' | '_dataFilter' | 'handleFilter' | '_filterData'>,\n BrushBase<BrushFilterOptions> {}\n\nexport class BrushFilter extends BrushBase<BrushFilterOptions> {\n static type: string = 'brush-filter';\n type: string = BrushFilter.type;\n\n static defaultOptions: Omit<BrushFilterOptions, 'target'> = {};\n\n constructor(view: IView, option?: BrushFilterOptions) {\n super(view, Object.assign({}, BrushFilter.defaultOptions, option));\n this._data = isString(this.options.target.data)\n ? view.getDataById(this.options.target.data)\n : this.options.target.data;\n }\n\n protected getEvents() {\n if (!this._data) {\n return [];\n }\n\n const transform = this.options.target.transform;\n const dataTransform = (data: any[], filterValue: any) => {\n const nextData = !filterValue ? data : filterValue;\n return transform ? transform(data, filterValue) : nextData;\n };\n\n this._filterData(this._data, null, DataFilterRank.brush, null, undefined, dataTransform);\n\n return super.getEvents();\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n let filterValue: any[] = [];\n\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isActive = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isActive) {\n elements.push(el);\n filterValue = filterValue.concat(array(el.getDatum()));\n }\n });\n });\n\n if (this._data) {\n // remove repeated datum\n filterValue = Array.from(new Set(filterValue));\n\n // shallow compare\n if (\n !this._filterValue ||\n filterValue.length !== this._filterValue.length ||\n filterValue.some(datum => !this._filterValue.includes(datum))\n ) {\n this._filterValue = filterValue;\n this.handleFilter();\n }\n }\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
import type { IPolygon } from '@visactor/vrender/es/core';
|
|
2
2
|
import type { BrushHighlightOptions, IView } from '../types';
|
|
3
3
|
import { BrushBase } from './brush-base';
|
|
4
4
|
import { type IBounds } from '@visactor/vutils';
|
|
@@ -1 +1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AAC;4BAClB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;4BACvC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;yBAC1C;6BAAM;4BACL,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;4BAC5C,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;yBACrC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;aACJ;YAED,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;IAlCF,CAAC;;AAVM,mBAAI,GAAW,iBAAiB,CAAC;AAGjC,6BAAc,GAA0B;IAC7C,cAAc,EAAE,oBAAoB,CAAC,SAAS;IAC9C,SAAS,EAAE,oBAAoB,CAAC,IAAI;CACrC,CAAC","file":"brush-highlight.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender
|
|
1
|
+
{"version":3,"sources":["../src/interactions/brush-highlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,OAAO,cAAe,SAAQ,SAAgC;IASlE,YAAY,IAAW,EAAE,MAA8B;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QARxE,SAAI,GAAW,cAAc,CAAC,IAAI,CAAC;QAWnC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,OAAO,CAAC,WAAW,KAAK,YAAY,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AAS,EAAE,oBAAoB,CAAC,IAAI;CACrC,CAAC","file":"brush-highlight.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender/es/core';\nimport { InteractionStateEnum } from '../graph/enums';\nimport type { BrushHighlightOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { type IBounds } from '@visactor/vutils';\nimport { IOperateType } from '@visactor/vrender-components';\n\nexport class BrushHighlight extends BrushBase<BrushHighlightOptions> {\n static type: string = 'brush-highlight';\n type: string = BrushHighlight.type;\n\n static defaultOptions: BrushHighlightOptions = {\n highlightState: InteractionStateEnum.highlight,\n blurState: InteractionStateEnum.blur\n };\n\n constructor(view: IView, option?: BrushHighlightOptions) {\n super(view, Object.assign({}, BrushHighlight.defaultOptions, option));\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n if (options.operateType === IOperateType.brushClear) {\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n el.removeState(this.options.blurState);\n el.removeState(this.options.highlightState);\n });\n });\n } else {\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isHighlight = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isHighlight) {\n elements.push(el);\n el.removeState(this.options.blurState);\n el.addState(this.options.highlightState);\n } else {\n el.removeState(this.options.highlightState);\n el.addState(this.options.blurState);\n }\n });\n });\n }\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
|