@visactor/vgrammar-core 0.10.0-alpha.2 → 0.10.0-alpha.4
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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":";;;AACA,6CAAiD;AAEjD,
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":";;;AACA,6CAAiD;AAEjD,oDAAwF;AAOxF,MAAa,YAAa,SAAQ,YAAK;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,C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I,CAAC,SAAS,GAAG,EAAE,CAAC;QACnB,QAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF;AA/BD,oCA+BC","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/cjs/graph/util/env.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.configureEnvironment = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const core_1 = require("@visactor/vrender/es/core");
|
|
8
8
|
|
|
9
9
|
function configureEnvironment(options) {
|
|
10
|
-
options.mode &&
|
|
10
|
+
options.mode && core_1.vglobal.setEnv(options.mode, options.modeParams || {});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
exports.configureEnvironment = configureEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AAGpD,SAAgB,oBAAoB,CAAC,OAA4B;IAC/D,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,cAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;KACxD;AACH,CAAC;AAJD,oDAIC","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,mCAAgC;AAChC,oDAA2D;AAG3D,SAAwB,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,+BAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,IAAA,aAAK,EAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC;AAfD,oCAeC","file":"events-extend.js","sourcesContent":["import type { FederatedEvent } from '@visactor/vrender
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/events-extend.ts"],"names":[],"mappings":";;AAGA,mCAAgC;AAChC,oDAA2D;AAG3D,SAAwB,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,+BAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,IAAA,aAAK,EAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC;AAfD,oCAeC","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;
|
|
@@ -4,43 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.getMarkTypeOfLarge = exports.removeGraphicItem = exports.createGlyphGraphicItem = exports.createGraphicItem = exports.isMarkType = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
circle: vrender_core_1.createCircle,
|
|
9
|
-
arc: vrender_core_1.createArc,
|
|
10
|
-
arc3d: vrender_core_1.createArc3d,
|
|
11
|
-
pyramid3d: vrender_core_1.createPyramid3d,
|
|
12
|
-
area: vrender_core_1.createArea,
|
|
13
|
-
group: vrender_core_1.createGroup,
|
|
14
|
-
image: vrender_core_1.createImage,
|
|
15
|
-
rect3d: vrender_core_1.createRect3d,
|
|
16
|
-
line: vrender_core_1.createLine,
|
|
17
|
-
path: vrender_core_1.createPath,
|
|
18
|
-
rect: vrender_core_1.createRect,
|
|
19
|
-
rule: vrender_core_1.createLine,
|
|
20
|
-
shape: vrender_core_1.createPath,
|
|
21
|
-
symbol: vrender_core_1.createSymbol,
|
|
22
|
-
text: vrender_core_1.createText,
|
|
23
|
-
richtext: vrender_core_1.createRichText,
|
|
24
|
-
polygon: vrender_core_1.createPolygon,
|
|
25
|
-
cell: vrender_core_1.createSymbol,
|
|
26
|
-
interval: vrender_core_1.createRect
|
|
27
|
-
}, isMarkType = type => !!itemCreator[type];
|
|
7
|
+
const enums_1 = require("../enums"), constants_1 = require("../constants"), factory_1 = require("../../core/factory"), vutils_1 = require("@visactor/vutils"), isMarkType = type => !!enums_1.GrammarMarkType[type];
|
|
28
8
|
|
|
29
9
|
function createGraphicItem(mark, markType, attrs = {}) {
|
|
30
10
|
var _a;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const graphicItem = itemCreator[markType] ? itemCreator[markType](attrs) : factory_1.Factory.createGraphicComponent(markType, attrs, {
|
|
11
|
+
mark.emit(enums_1.HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);
|
|
12
|
+
const graphicItem = factory_1.Factory.getGraphicType(markType) ? factory_1.Factory.createGraphic(markType, attrs) : factory_1.Factory.createGraphicComponent(markType, attrs, {
|
|
34
13
|
skipDefault: null === (_a = null == mark ? void 0 : mark.spec) || void 0 === _a ? void 0 : _a.skipTheme
|
|
35
14
|
});
|
|
15
|
+
if (!graphicItem) {
|
|
16
|
+
vutils_1.Logger.getInstance().error(`create ${markType} graphic failed!`);
|
|
17
|
+
}
|
|
36
18
|
return mark.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_MARK), graphicItem;
|
|
37
19
|
}
|
|
38
20
|
|
|
39
21
|
function createGlyphGraphicItem(mark, glyphMeta, attrs = {}) {
|
|
40
|
-
mark.emit(enums_1.HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);
|
|
41
|
-
const graphicItem = (
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
if (mark.emit(enums_1.HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK), !factory_1.Factory.getGraphicType(enums_1.GrammarMarkType.glyph)) return;
|
|
23
|
+
const graphicItem = factory_1.Factory.createGraphic(enums_1.GrammarMarkType.glyph, attrs), glyphMarks = glyphMeta.getMarks(), subGraphics = Object.keys(glyphMarks).map((name => {
|
|
24
|
+
if (factory_1.Factory.getGraphicType(glyphMarks[name])) {
|
|
25
|
+
const graphic = factory_1.Factory.createGraphic(glyphMarks[name]);
|
|
26
|
+
if (graphic) return graphic.name = name, graphic;
|
|
27
|
+
}
|
|
44
28
|
}));
|
|
45
29
|
return graphicItem.setSubGraphic(subGraphics), mark.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_MARK),
|
|
46
30
|
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,oCAAuD;AACvD,4CAAgD;AAChD,gDAA6C;AAC7C,6CAA0C;AAEnC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;IACzC,OAAO,CAAC,CAAC,uBAAe,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF,SAAgB,iBAAiB,CAAC,IAAW,EAAE,QAAgB,EAAE,QAAa,EAAE;;IAC9E,IAAI,CAAC,IAAI,CAAC,kBAAU,CAAC,0BAA0B,CAAC,CAAC;IAEjD,MAAM,WAAW,GAAa,iBAAO,CAAC,cAAc,CAAC,QAAQ,CAAC;QAC5D,CAAC,CAAC,iBAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC;QACxC,CAAC,CAAC,iBAAO,CAAC,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE;YAC9C,WAAW,EAAE,MAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,IAAI,0CAAE,SAAS;SAC5C,CAAC,CAAC;IAEP,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,MAAM,GAAG,eAAM,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,UAAU,QAAQ,kBAAkB,CAAC,CAAC;KACpD;IAED,IAAI,CAAC,IAAI,CAAC,kBAAU,CAAC,yBAAyB,C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C7C;KACF;AACH,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B;AAEK,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,uBAAe,CAAC,IAAI,EAAE;QACrC,OAAO,uBAAe,CAAC,UAAU,CAAC;KACnC;IAED,IAAI,QAAQ,KAAK,uBAAe,CAAC,MAAM,EAAE;QACvC,OAAO,uBAAe,CAAC,YAAY,CAAC;KACrC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B","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/cjs/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.4";
|
|
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/cjs/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.vglobal = exports.ThemeManager = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.View = exports.version = void 0,
|
|
21
|
-
exports.version = "0.10.0-alpha.
|
|
20
|
+
}), exports.vglobal = exports.ThemeManager = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.registerCoordinate = exports.Coordinate = exports.registerScale = exports.Scale = exports.View = exports.version = void 0,
|
|
21
|
+
exports.version = "0.10.0-alpha.4", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
|
|
22
22
|
|
|
23
23
|
var view_1 = require("./view");
|
|
24
24
|
|
|
@@ -29,6 +29,34 @@ Object.defineProperty(exports, "View", {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
var scale_1 = require("./view/scale");
|
|
33
|
+
|
|
34
|
+
Object.defineProperty(exports, "Scale", {
|
|
35
|
+
enumerable: !0,
|
|
36
|
+
get: function() {
|
|
37
|
+
return scale_1.Scale;
|
|
38
|
+
}
|
|
39
|
+
}), Object.defineProperty(exports, "registerScale", {
|
|
40
|
+
enumerable: !0,
|
|
41
|
+
get: function() {
|
|
42
|
+
return scale_1.registerScale;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var coordinate_1 = require("./view/coordinate");
|
|
47
|
+
|
|
48
|
+
Object.defineProperty(exports, "Coordinate", {
|
|
49
|
+
enumerable: !0,
|
|
50
|
+
get: function() {
|
|
51
|
+
return coordinate_1.Coordinate;
|
|
52
|
+
}
|
|
53
|
+
}), Object.defineProperty(exports, "registerCoordinate", {
|
|
54
|
+
enumerable: !0,
|
|
55
|
+
get: function() {
|
|
56
|
+
return coordinate_1.registerCoordinate;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
32
60
|
var util_1 = require("./parse/util");
|
|
33
61
|
|
|
34
62
|
Object.defineProperty(exports, "parseFunctionType", {
|
|
@@ -110,13 +138,14 @@ Object.defineProperty(exports, "ThemeManager", {
|
|
|
110
138
|
}), __exportStar(require("./glyph"), exports), __exportStar(require("./component"), exports),
|
|
111
139
|
__exportStar(require("./transforms"), exports), __exportStar(require("./graph/animation/animation"), exports);
|
|
112
140
|
|
|
113
|
-
var
|
|
141
|
+
var core_1 = require("@visactor/vrender/es/core");
|
|
114
142
|
|
|
115
143
|
Object.defineProperty(exports, "vglobal", {
|
|
116
144
|
enumerable: !0,
|
|
117
145
|
get: function() {
|
|
118
|
-
return
|
|
146
|
+
return core_1.vglobal;
|
|
119
147
|
}
|
|
120
148
|
}), __exportStar(require("./env"), exports), __exportStar(require("./interactions"), exports),
|
|
121
|
-
__exportStar(require("./semantic-marks/cell"), exports), __exportStar(require("./semantic-marks/interval"), exports)
|
|
149
|
+
__exportStar(require("./semantic-marks/cell"), exports), __exportStar(require("./semantic-marks/interval"), exports),
|
|
150
|
+
__exportStar(require("./graph/mark/graphic"), exports);
|
|
122
151
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IA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ErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,kDAAoD;AAA3C,+FAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.10.0-alpha.4\";\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,0CAAsD;AAEtD,6CAAyC;AAGzC,MAAa,WAAY,SAAQ,sBAA6B;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;;AAVH,kCAkCC;AAjCQ,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,4BAAoB,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,0CAAsD;AAEtD,6CAAyC;AAGzC,MAAa,WAAY,SAAQ,sBAA6B;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;;AAVH,kCAkCC;AAjCQ,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,4BAAoB,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,qEAAmE;AAEnE,iCAAyC;AAEzC,6CAM0B;AAC1B,0CAA4C;AAE5C,MAAsB,SAAkC,SAAQ,sBAAkB;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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,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,MAAM,EAAE;YACtG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,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;AA9MD,8BA8MC","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,qEAAmE;AAEnE,iCAAyC;AAEzC,6CAM0B;AAC1B,0CAA4C;AAE5C,MAAsB,SAAkC,SAAQ,sBAAkB;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,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ACxB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,MAAM,EAAE;YACtG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,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;AA9MD,8BA8MC","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/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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 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/brush-highlight.ts"],"names":[],"mappings":";;;AACA,0CAAsD;AAEtD,6CAAyC;AAEzC,qEAA4D;AAE5D,MAAa,cAAe,SAAQ,sBAAgC;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,iCAAY,CAAC,UAAU,EAAE;gBACnD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;wBACzB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;wBACvC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;oBAC9C,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;wBACzB,MAAM,WAAW,GAAG,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;wBAE7F,IAAI,WAAW,EAAE;4BACf,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;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;;AAXH,wCA8CC;AA7CQ,mBAAI,GAAW,iBAAiB,CAAC;AAGjC,6BAAc,GAA0B;IAC7C,cAAc,EAAE,4BAAoB,CAAC,SAAS;IAC9C,SAAS,EAAE,4BAAoB,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,0CAAsD;AAEtD,6CAAyC;AAEzC,qEAA4D;AAE5D,MAAa,cAAe,SAAQ,sBAAgC;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,iCAAY,CAAC,UAAU,EAAE;gBACnD,IAAI,CAAC,MA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C,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/crosshair.ts"],"names":[],"mappings":";;;AAEA,6CAAiF;AAUjF,qEAMsC;AAUtC,iCAAyC;AACzC,0CAA+C;AAG/C,6CAA4D;AAC5D,wCAAmD;AAInD,MAAM,wBAAwB,GAAG,CAC/B,KAAiB,EACjB,KAAiB,EACjB,IAAmB,EACnB,SAA4C,EAC5C,MAAW,EACX,SAAiB,CAAC,EAClB,EAA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I,CAAC,mBAAmB,GAAG,IAAI,oCAAe,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC;gBACpF,MAAM;SACT;QACA,KAAK,CAAC,YAAoB,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACpE,CAAC;IAED,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC5B,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;YACnC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;SACjC;IACH,CAAC;;AApLH,8BAqLC;AApLQ,cAAI,GAAW,WAAW,CAAC;AAI3B,wBAAc,GAAqC;IACxD,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,GAAG;IAClB,cAAc,EAAE,MAAM;CACvB,CAAC","file":"crosshair.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { clampRadian, getAngleByPoint, isString, merge } from '@visactor/vutils';\nimport type { IRectGraphicAttribute } from '@visactor/vrender-core';\nimport type {\n CircleCrosshairAttrs,\n LineCrosshairAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n SectorCrosshairAttrs\n} from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n CircleCrosshair,\n LineCrosshair,\n PolygonCrosshair,\n RectCrosshair,\n SectorCrosshair\n} from '@visactor/vrender-components';\nimport type {\n CrosshairOptions,\n CrosshairType,\n IGroupMark,\n ITheme,\n IView,\n InteractionEvent,\n RecursivePartial\n} from '../types';\nimport { BaseInteraction } from './base';\nimport { CrosshairEnum } from '../graph/enums';\nimport type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { isContinuous, isDiscrete } from '@visactor/vscale';\nimport { invokeFunctionType } from '../parse/util';\n\ntype CrosshairComponent = CircleCrosshair | LineCrosshair | PolygonCrosshair | RectCrosshair | SectorCrosshair;\n\nconst computeCrosshairStartEnd = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n offset: number = 0\n) => {\n const start = { x: 0, y: 0 };\n const end = { x: 0, y: 0 };\n const radius = type === 'angle' ? config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2 : null;\n const center = type === 'angle' ? config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 } : null;\n\n let current = 0;\n if (isDiscrete(scale.type)) {\n if (type === 'x') {\n current = scale.scale(scale.invert(point.x));\n } else if (type === 'y') {\n current = scale.scale(scale.invert(point.y));\n } else if (type === 'angle') {\n const angle = clampRadian(getAngleByPoint(center, point) + Math.PI * 2);\n current = scale.scale(scale.invert(angle));\n }\n } else if (isContinuous(scale.type)) {\n if (type === 'x') {\n current = point.x;\n } else if (type === 'y') {\n current = point.y;\n } else if (type === 'angle') {\n current = getAngleByPoint(center, point);\n }\n }\n current += offset;\n switch (type) {\n case 'x':\n start.x = current;\n start.y = 0;\n end.x = current;\n end.y = groupSize.height;\n break;\n case 'y':\n start.x = 0;\n start.y = current;\n end.x = groupSize.width;\n end.y = current;\n break;\n case 'angle':\n start.x = center.x;\n start.y = center.y;\n end.x = center.x + radius * Math.cos(current);\n end.y = center.y + radius * Math.sin(current);\n break;\n }\n return { start, end };\n};\n\nconst computeRadiusOfTangential = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n addition?:\n | RecursivePartial<PolygonCrosshairAttrs>\n | RecursivePartial<CircleCrosshairAttrs>\n | RecursivePartial<SectorCrosshairAttrs>\n) => {\n const center = addition?.center ?? config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 };\n let currentRadius = 0;\n\n if (isDiscrete(scale.type)) {\n const offset = scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0;\n const radius = Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2);\n currentRadius = scale.scale(scale.invert(radius)) + offset;\n } else if (isContinuous(scale.type)) {\n const maxRadius = config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2;\n currentRadius = Math.min(maxRadius, Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2));\n }\n\n return { radius: currentRadius, center };\n};\n\nexport const generateLineCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<LineCrosshairAttrs> & any\n): LineCrosshairAttrs => {\n const crosshairTheme = theme?.components?.lineCrosshair;\n const offset = scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0;\n const points = computeCrosshairStartEnd(\n point,\n scale,\n type,\n groupSize,\n {\n radius: addition?.radius ?? config?.radius,\n center: addition?.center ?? config?.center\n },\n offset\n );\n return merge({}, crosshairTheme, points, addition ?? {});\n};\n\nexport const generateRectCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<RectCrosshairAttrs>\n): RectCrosshairAttrs => {\n const crosshairTheme = theme?.components?.rectCrosshair;\n const defaultSize = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : undefined;\n const customRectStyle = addition?.rectStyle;\n const size =\n defaultSize ??\n (type === 'y'\n ? customRectStyle?.width ?? crosshairTheme.rectStyle.width\n : customRectStyle?.height ?? crosshairTheme.rectStyle.height);\n const points = computeCrosshairStartEnd(point, scale, type, groupSize, config, scale.type === 'band' ? 0 : -size / 2);\n const rectStyle: Partial<IRectGraphicAttribute> = {};\n if (type === 'x') {\n rectStyle.width = size;\n } else {\n rectStyle.height = size;\n }\n const attribute = merge(\n {},\n crosshairTheme,\n {\n start: points.start,\n end: points.end,\n rectStyle\n },\n addition ?? {}\n );\n if (type === 'x') {\n attribute.rectStyle.height = attribute.end.y - attribute.start.y;\n } else {\n attribute.rectStyle.width = attribute.end.x - attribute.start.x;\n }\n return attribute;\n};\n\nexport const generateRingCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<SectorCrosshairAttrs>\n): SectorCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n const deltaRadius = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : 0;\n\n return merge(\n {},\n crosshairTheme,\n { center, innerRadius: radius - deltaRadius / 2, radius: radius + deltaRadius / 2, startAngle, endAngle },\n addition ?? {}\n );\n};\n\nexport const generateSectorCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<SectorCrosshairAttrs>\n): SectorCrosshairAttrs => {\n const crosshairTheme = theme?.components?.sectorCrosshair;\n const radius = addition?.radius ?? config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2;\n const center = (addition?.center ??\n config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 }) as IPointLike;\n const defaultAngle = crosshairTheme.endAngle - crosshairTheme.startAngle;\n const angle = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : defaultAngle;\n let currentAngle = 0;\n if (isDiscrete(scale.type)) {\n const angle = clampRadian(getAngleByPoint(center, point) + Math.PI * 2);\n currentAngle =\n scale.scale(scale.invert(angle)) + (scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0);\n } else if (isContinuous(scale.type)) {\n currentAngle = getAngleByPoint(center, point);\n }\n const startAngle = currentAngle - angle / 2;\n const endAngle = currentAngle + angle / 2;\n return merge({}, crosshairTheme, { center, radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport const generateCircleCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<CircleCrosshairAttrs>\n): CircleCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n\n return merge({}, crosshairTheme, { center, radius: radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport const generatePolygonCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<PolygonCrosshairAttrs>\n): PolygonCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n return merge({}, crosshairTheme, { center, radius: radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport class Crosshair extends BaseInteraction<CrosshairOptions> {\n static type: string = 'crosshair';\n type: string = Crosshair.type;\n options: CrosshairOptions;\n\n static defaultOptions: Omit<CrosshairOptions, 'target'> = {\n trigger: 'pointermove',\n resetTrigger: 'pointerleave',\n crosshairType: 'x',\n crosshairShape: 'line'\n };\n\n protected _crosshairComponent?: CrosshairComponent;\n protected _crosshairComponentType?: keyof typeof CrosshairEnum;\n protected _container: IGroupMark;\n\n constructor(view: IView, options?: CrosshairOptions) {\n super(view, options);\n this.options = Object.assign({}, Crosshair.defaultOptions, options);\n this._container = (view.getMarksBySelector(this.options.container)?.[0] as IGroupMark) ?? view.rootMark;\n }\n\n protected getEvents() {\n return [\n {\n type: this.options.trigger,\n handler: this.handleCrosshairShow\n },\n {\n type: this.options.resetTrigger,\n handler: this.handleCrosshairHide\n }\n ];\n }\n\n protected handleCrosshairShow = (event: InteractionEvent) => {\n if (!this._crosshairComponent) {\n return;\n }\n const groupGraphicItem = this._container.getGroupGraphicItem();\n // FIXME: waiting for vRender to add transformed position to event\n const point = { x: 0, y: 0 };\n const globalTransMatrix = groupGraphicItem.globalTransMatrix;\n const containerPoint = { x: globalTransMatrix.e, y: globalTransMatrix.f };\n globalTransMatrix.transformPoint(event.canvas, point);\n\n if (\n point.x < 0 ||\n point.x > groupGraphicItem.attribute.width ||\n point.y < 0 ||\n point.y > groupGraphicItem.attribute.height\n ) {\n this._crosshairComponent.hideAll();\n return;\n }\n\n const crosshairType = this.options.crosshairType ?? 'x';\n const groupSize = { width: groupGraphicItem.attribute.width, height: groupGraphicItem.attribute.height };\n const scaleGrammar = isString(this.options.scale) ? this.view.getScaleById(this.options.scale) : this.options.scale;\n const scale = scaleGrammar.getScale();\n const config = { center: this.options.center, radius: this.options.radius };\n const theme = this.view.getCurrentTheme();\n const addition = invokeFunctionType(this.options.attributes, this.parameters(), {}, {}) as any;\n\n let attributes: any = {};\n switch (this.getCrosshairComponentType()) {\n case CrosshairEnum.lineCrosshair:\n attributes = generateLineCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.rectCrosshair:\n attributes = generateRectCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.sectorCrosshair:\n attributes = generateSectorCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.circleCrosshair:\n attributes = generateCircleCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.polygonCrosshair:\n attributes = generatePolygonCrosshairAttributes(\n point,\n scale,\n crosshairType,\n groupSize,\n config,\n theme,\n addition\n );\n break;\n case CrosshairEnum.ringCrosshair:\n attributes = generateRingCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n }\n // Hack: waiting for component to fix\n if (this.getCrosshairComponentType() !== CrosshairEnum.circleCrosshair) {\n attributes.x = containerPoint.x;\n attributes.y = containerPoint.y;\n }\n this._crosshairComponent.showAll();\n this._crosshairComponent.setAttributes(attributes);\n };\n\n protected handleCrosshairHide = () => {\n this._crosshairComponent.hideAll();\n };\n\n protected getCrosshairComponentType() {\n if (this._crosshairComponentType) {\n return this._crosshairComponentType;\n }\n const shape = this.options.crosshairShape ?? 'line';\n const type = this.options.crosshairType ?? 'x';\n if (shape === 'rect') {\n if (type === 'angle') {\n this._crosshairComponentType = CrosshairEnum.sectorCrosshair;\n } else if (type === 'radius') {\n this._crosshairComponentType = CrosshairEnum.ringCrosshair;\n } else if (type === 'radius-polygon') {\n this._crosshairComponentType = CrosshairEnum.polygonCrosshair;\n } else {\n this._crosshairComponentType = CrosshairEnum.rectCrosshair;\n }\n } else {\n if (type === 'radius') {\n this._crosshairComponentType = CrosshairEnum.circleCrosshair;\n } else if (type === 'radius-polygon') {\n this._crosshairComponentType = CrosshairEnum.polygonCrosshair;\n } else {\n this._crosshairComponentType = CrosshairEnum.lineCrosshair;\n }\n }\n return this._crosshairComponentType;\n }\n\n protected getDefaultCrosshairAttribute(): any {\n const type = this.options.crosshairType ?? 'x';\n if (type === 'radius' || type === 'radius-polygon') {\n return { center: { x: 0, y: 0 }, zIndex: -1 };\n }\n return { start: { x: 0, y: 0 }, end: { x: 0, y: 0 }, zIndex: -1 };\n }\n\n bind(): void {\n super.bind();\n\n const stage = this.view.renderer.stage();\n if (this._crosshairComponent || !stage) {\n return;\n }\n\n switch (this.getCrosshairComponentType()) {\n case CrosshairEnum.lineCrosshair:\n this._crosshairComponent = new LineCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.rectCrosshair:\n this._crosshairComponent = new RectCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.sectorCrosshair:\n this._crosshairComponent = new SectorCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.circleCrosshair:\n this._crosshairComponent = new CircleCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.polygonCrosshair:\n this._crosshairComponent = new PolygonCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.ringCrosshair:\n this._crosshairComponent = new SectorCrosshair(this.getDefaultCrosshairAttribute());\n break;\n }\n (stage.defaultLayer as any).appendChild(this._crosshairComponent);\n }\n\n unbind(): void {\n super.unbind();\n\n if (this._crosshairComponent) {\n this._crosshairComponent.release();\n this._crosshairComponent = null;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interactions/crosshair.ts"],"names":[],"mappings":";;;AAEA,6CAAiF;AAUjF,qEAMsC;AAUtC,iCAAyC;AACzC,0CAA+C;AAG/C,6CAA4D;AAC5D,wCAAmD;AAInD,MAAM,wBAAwB,GAAG,CAC/B,KAAiB,EACjB,KAAiB,EACjB,IAAmB,EACnB,SAA4C,EAC5C,MAAW,EACX,SAAiB,CAAC,EAClB,EAAE;;IACF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,mCAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3G,MAAM,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,mCAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,MAA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utils';\n// eslint-disable-next-line no-duplicate-imports\nimport { clampRadian, getAngleByPoint, isString, merge } from '@visactor/vutils';\nimport type { IRectGraphicAttribute } from '@visactor/vrender/es/core';\nimport type {\n CircleCrosshairAttrs,\n LineCrosshairAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n SectorCrosshairAttrs\n} from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n CircleCrosshair,\n LineCrosshair,\n PolygonCrosshair,\n RectCrosshair,\n SectorCrosshair\n} from '@visactor/vrender-components';\nimport type {\n CrosshairOptions,\n CrosshairType,\n IGroupMark,\n ITheme,\n IView,\n InteractionEvent,\n RecursivePartial\n} from '../types';\nimport { BaseInteraction } from './base';\nimport { CrosshairEnum } from '../graph/enums';\nimport type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { isContinuous, isDiscrete } from '@visactor/vscale';\nimport { invokeFunctionType } from '../parse/util';\n\ntype CrosshairComponent = CircleCrosshair | LineCrosshair | PolygonCrosshair | RectCrosshair | SectorCrosshair;\n\nconst computeCrosshairStartEnd = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n offset: number = 0\n) => {\n const start = { x: 0, y: 0 };\n const end = { x: 0, y: 0 };\n const radius = type === 'angle' ? config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2 : null;\n const center = type === 'angle' ? config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 } : null;\n\n let current = 0;\n if (isDiscrete(scale.type)) {\n if (type === 'x') {\n current = scale.scale(scale.invert(point.x));\n } else if (type === 'y') {\n current = scale.scale(scale.invert(point.y));\n } else if (type === 'angle') {\n const angle = clampRadian(getAngleByPoint(center, point) + Math.PI * 2);\n current = scale.scale(scale.invert(angle));\n }\n } else if (isContinuous(scale.type)) {\n if (type === 'x') {\n current = point.x;\n } else if (type === 'y') {\n current = point.y;\n } else if (type === 'angle') {\n current = getAngleByPoint(center, point);\n }\n }\n current += offset;\n switch (type) {\n case 'x':\n start.x = current;\n start.y = 0;\n end.x = current;\n end.y = groupSize.height;\n break;\n case 'y':\n start.x = 0;\n start.y = current;\n end.x = groupSize.width;\n end.y = current;\n break;\n case 'angle':\n start.x = center.x;\n start.y = center.y;\n end.x = center.x + radius * Math.cos(current);\n end.y = center.y + radius * Math.sin(current);\n break;\n }\n return { start, end };\n};\n\nconst computeRadiusOfTangential = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n addition?:\n | RecursivePartial<PolygonCrosshairAttrs>\n | RecursivePartial<CircleCrosshairAttrs>\n | RecursivePartial<SectorCrosshairAttrs>\n) => {\n const center = addition?.center ?? config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 };\n let currentRadius = 0;\n\n if (isDiscrete(scale.type)) {\n const offset = scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0;\n const radius = Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2);\n currentRadius = scale.scale(scale.invert(radius)) + offset;\n } else if (isContinuous(scale.type)) {\n const maxRadius = config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2;\n currentRadius = Math.min(maxRadius, Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2));\n }\n\n return { radius: currentRadius, center };\n};\n\nexport const generateLineCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<LineCrosshairAttrs> & any\n): LineCrosshairAttrs => {\n const crosshairTheme = theme?.components?.lineCrosshair;\n const offset = scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0;\n const points = computeCrosshairStartEnd(\n point,\n scale,\n type,\n groupSize,\n {\n radius: addition?.radius ?? config?.radius,\n center: addition?.center ?? config?.center\n },\n offset\n );\n return merge({}, crosshairTheme, points, addition ?? {});\n};\n\nexport const generateRectCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<RectCrosshairAttrs>\n): RectCrosshairAttrs => {\n const crosshairTheme = theme?.components?.rectCrosshair;\n const defaultSize = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : undefined;\n const customRectStyle = addition?.rectStyle;\n const size =\n defaultSize ??\n (type === 'y'\n ? customRectStyle?.width ?? crosshairTheme.rectStyle.width\n : customRectStyle?.height ?? crosshairTheme.rectStyle.height);\n const points = computeCrosshairStartEnd(point, scale, type, groupSize, config, scale.type === 'band' ? 0 : -size / 2);\n const rectStyle: Partial<IRectGraphicAttribute> = {};\n if (type === 'x') {\n rectStyle.width = size;\n } else {\n rectStyle.height = size;\n }\n const attribute = merge(\n {},\n crosshairTheme,\n {\n start: points.start,\n end: points.end,\n rectStyle\n },\n addition ?? {}\n );\n if (type === 'x') {\n attribute.rectStyle.height = attribute.end.y - attribute.start.y;\n } else {\n attribute.rectStyle.width = attribute.end.x - attribute.start.x;\n }\n return attribute;\n};\n\nexport const generateRingCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<SectorCrosshairAttrs>\n): SectorCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n const deltaRadius = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : 0;\n\n return merge(\n {},\n crosshairTheme,\n { center, innerRadius: radius - deltaRadius / 2, radius: radius + deltaRadius / 2, startAngle, endAngle },\n addition ?? {}\n );\n};\n\nexport const generateSectorCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<SectorCrosshairAttrs>\n): SectorCrosshairAttrs => {\n const crosshairTheme = theme?.components?.sectorCrosshair;\n const radius = addition?.radius ?? config?.radius ?? Math.min(groupSize.width, groupSize.height) / 2;\n const center = (addition?.center ??\n config?.center ?? { x: groupSize.width / 2, y: groupSize.height / 2 }) as IPointLike;\n const defaultAngle = crosshairTheme.endAngle - crosshairTheme.startAngle;\n const angle = scale.type === 'band' || scale.type === 'point' ? (scale as IBandLikeScale).step() : defaultAngle;\n let currentAngle = 0;\n if (isDiscrete(scale.type)) {\n const angle = clampRadian(getAngleByPoint(center, point) + Math.PI * 2);\n currentAngle =\n scale.scale(scale.invert(angle)) + (scale.type === 'band' ? (scale as IBandLikeScale).bandwidth() / 2 : 0);\n } else if (isContinuous(scale.type)) {\n currentAngle = getAngleByPoint(center, point);\n }\n const startAngle = currentAngle - angle / 2;\n const endAngle = currentAngle + angle / 2;\n return merge({}, crosshairTheme, { center, radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport const generateCircleCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<CircleCrosshairAttrs>\n): CircleCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n\n return merge({}, crosshairTheme, { center, radius: radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport const generatePolygonCrosshairAttributes = (\n point: IPointLike,\n scale: IBaseScale,\n type: CrosshairType,\n groupSize: { width: number; height: number },\n config: any,\n theme?: ITheme,\n addition?: RecursivePartial<PolygonCrosshairAttrs>\n): PolygonCrosshairAttrs => {\n const crosshairTheme = theme?.components?.circleCrosshair;\n const { center, radius } = computeRadiusOfTangential(point, scale, type, groupSize, config, addition);\n\n const startAngle = crosshairTheme.startAngle;\n const endAngle = crosshairTheme.endAngle;\n return merge({}, crosshairTheme, { center, radius: radius, startAngle, endAngle }, addition ?? {});\n};\n\nexport class Crosshair extends BaseInteraction<CrosshairOptions> {\n static type: string = 'crosshair';\n type: string = Crosshair.type;\n options: CrosshairOptions;\n\n static defaultOptions: Omit<CrosshairOptions, 'target'> = {\n trigger: 'pointermove',\n resetTrigger: 'pointerleave',\n crosshairType: 'x',\n crosshairShape: 'line'\n };\n\n protected _crosshairComponent?: CrosshairComponent;\n protected _crosshairComponentType?: keyof typeof CrosshairEnum;\n protected _container: IGroupMark;\n\n constructor(view: IView, options?: CrosshairOptions) {\n super(view, options);\n this.options = Object.assign({}, Crosshair.defaultOptions, options);\n this._container = (view.getMarksBySelector(this.options.container)?.[0] as IGroupMark) ?? view.rootMark;\n }\n\n protected getEvents() {\n return [\n {\n type: this.options.trigger,\n handler: this.handleCrosshairShow\n },\n {\n type: this.options.resetTrigger,\n handler: this.handleCrosshairHide\n }\n ];\n }\n\n protected handleCrosshairShow = (event: InteractionEvent) => {\n if (!this._crosshairComponent) {\n return;\n }\n const groupGraphicItem = this._container.getGroupGraphicItem();\n // FIXME: waiting for vRender to add transformed position to event\n const point = { x: 0, y: 0 };\n const globalTransMatrix = groupGraphicItem.globalTransMatrix;\n const containerPoint = { x: globalTransMatrix.e, y: globalTransMatrix.f };\n globalTransMatrix.transformPoint(event.canvas, point);\n\n if (\n point.x < 0 ||\n point.x > groupGraphicItem.attribute.width ||\n point.y < 0 ||\n point.y > groupGraphicItem.attribute.height\n ) {\n this._crosshairComponent.hideAll();\n return;\n }\n\n const crosshairType = this.options.crosshairType ?? 'x';\n const groupSize = { width: groupGraphicItem.attribute.width, height: groupGraphicItem.attribute.height };\n const scaleGrammar = isString(this.options.scale) ? this.view.getScaleById(this.options.scale) : this.options.scale;\n const scale = scaleGrammar.getScale();\n const config = { center: this.options.center, radius: this.options.radius };\n const theme = this.view.getCurrentTheme();\n const addition = invokeFunctionType(this.options.attributes, this.parameters(), {}, {}) as any;\n\n let attributes: any = {};\n switch (this.getCrosshairComponentType()) {\n case CrosshairEnum.lineCrosshair:\n attributes = generateLineCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.rectCrosshair:\n attributes = generateRectCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.sectorCrosshair:\n attributes = generateSectorCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.circleCrosshair:\n attributes = generateCircleCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n case CrosshairEnum.polygonCrosshair:\n attributes = generatePolygonCrosshairAttributes(\n point,\n scale,\n crosshairType,\n groupSize,\n config,\n theme,\n addition\n );\n break;\n case CrosshairEnum.ringCrosshair:\n attributes = generateRingCrosshairAttributes(point, scale, crosshairType, groupSize, config, theme, addition);\n break;\n }\n // Hack: waiting for component to fix\n if (this.getCrosshairComponentType() !== CrosshairEnum.circleCrosshair) {\n attributes.x = containerPoint.x;\n attributes.y = containerPoint.y;\n }\n this._crosshairComponent.showAll();\n this._crosshairComponent.setAttributes(attributes);\n };\n\n protected handleCrosshairHide = () => {\n this._crosshairComponent.hideAll();\n };\n\n protected getCrosshairComponentType() {\n if (this._crosshairComponentType) {\n return this._crosshairComponentType;\n }\n const shape = this.options.crosshairShape ?? 'line';\n const type = this.options.crosshairType ?? 'x';\n if (shape === 'rect') {\n if (type === 'angle') {\n this._crosshairComponentType = CrosshairEnum.sectorCrosshair;\n } else if (type === 'radius') {\n this._crosshairComponentType = CrosshairEnum.ringCrosshair;\n } else if (type === 'radius-polygon') {\n this._crosshairComponentType = CrosshairEnum.polygonCrosshair;\n } else {\n this._crosshairComponentType = CrosshairEnum.rectCrosshair;\n }\n } else {\n if (type === 'radius') {\n this._crosshairComponentType = CrosshairEnum.circleCrosshair;\n } else if (type === 'radius-polygon') {\n this._crosshairComponentType = CrosshairEnum.polygonCrosshair;\n } else {\n this._crosshairComponentType = CrosshairEnum.lineCrosshair;\n }\n }\n return this._crosshairComponentType;\n }\n\n protected getDefaultCrosshairAttribute(): any {\n const type = this.options.crosshairType ?? 'x';\n if (type === 'radius' || type === 'radius-polygon') {\n return { center: { x: 0, y: 0 }, zIndex: -1 };\n }\n return { start: { x: 0, y: 0 }, end: { x: 0, y: 0 }, zIndex: -1 };\n }\n\n bind(): void {\n super.bind();\n\n const stage = this.view.renderer.stage();\n if (this._crosshairComponent || !stage) {\n return;\n }\n\n switch (this.getCrosshairComponentType()) {\n case CrosshairEnum.lineCrosshair:\n this._crosshairComponent = new LineCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.rectCrosshair:\n this._crosshairComponent = new RectCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.sectorCrosshair:\n this._crosshairComponent = new SectorCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.circleCrosshair:\n this._crosshairComponent = new CircleCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.polygonCrosshair:\n this._crosshairComponent = new PolygonCrosshair(this.getDefaultCrosshairAttribute());\n break;\n case CrosshairEnum.ringCrosshair:\n this._crosshairComponent = new SectorCrosshair(this.getDefaultCrosshairAttribute());\n break;\n }\n (stage.defaultLayer as any).appendChild(this._crosshairComponent);\n }\n\n unbind(): void {\n super.unbind();\n\n if (this._crosshairComponent) {\n this._crosshairComponent.release();\n this._crosshairComponent = null;\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 { DrillDownOptions, IView, InteractionEvent } from '../types';
|
|
3
3
|
import { BrushBase } from './brush-base';
|
|
4
4
|
import { type IBounds } from '@visactor/vutils';
|