@visactor/vrender-components 1.0.37-alpha.1 → 1.1.0-alpha.0

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.
Files changed (50) hide show
  1. package/cjs/brush/brush.d.ts +0 -1
  2. package/cjs/brush/brush.js +8 -22
  3. package/cjs/brush/brush.js.map +1 -1
  4. package/cjs/brush/type.d.ts +1 -3
  5. package/cjs/brush/type.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/poptip/contribution.js +3 -10
  10. package/cjs/poptip/contribution.js.map +1 -1
  11. package/cjs/poptip/module.d.ts +0 -2
  12. package/cjs/poptip/module.js +7 -10
  13. package/cjs/poptip/module.js.map +1 -1
  14. package/cjs/poptip/poptip-plugin.js +5 -12
  15. package/cjs/poptip/poptip-plugin.js.map +1 -1
  16. package/cjs/poptip/register.js +1 -1
  17. package/cjs/poptip/register.js.map +1 -1
  18. package/cjs/scrollbar/module.d.ts +0 -2
  19. package/cjs/scrollbar/module.js +5 -6
  20. package/cjs/scrollbar/module.js.map +1 -1
  21. package/cjs/scrollbar/scrollbar-plugin.js +5 -12
  22. package/cjs/scrollbar/scrollbar-plugin.js.map +1 -1
  23. package/cjs/slider/slider.js.map +1 -1
  24. package/cjs/table-series-number/event-manager.js.map +1 -1
  25. package/dist/index.es.js +7965 -7802
  26. package/es/brush/brush.d.ts +0 -1
  27. package/es/brush/brush.js +8 -22
  28. package/es/brush/brush.js.map +1 -1
  29. package/es/brush/type.d.ts +1 -3
  30. package/es/brush/type.js.map +1 -1
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/index.js.map +1 -1
  34. package/es/poptip/contribution.js +2 -14
  35. package/es/poptip/contribution.js.map +1 -1
  36. package/es/poptip/module.d.ts +0 -2
  37. package/es/poptip/module.js +4 -8
  38. package/es/poptip/module.js.map +1 -1
  39. package/es/poptip/poptip-plugin.js +5 -19
  40. package/es/poptip/poptip-plugin.js.map +1 -1
  41. package/es/poptip/register.js +2 -0
  42. package/es/poptip/register.js.map +1 -1
  43. package/es/scrollbar/module.d.ts +0 -2
  44. package/es/scrollbar/module.js +3 -5
  45. package/es/scrollbar/module.js.map +1 -1
  46. package/es/scrollbar/scrollbar-plugin.js +5 -13
  47. package/es/scrollbar/scrollbar-plugin.js.map +1 -1
  48. package/es/slider/slider.js.map +1 -1
  49. package/es/table-series-number/event-manager.js.map +1 -1
  50. package/package.json +6 -6
@@ -62,7 +62,6 @@ export declare class Brush extends AbstractComponent<Required<BrushAttributes>>
62
62
  private _addBrushMask;
63
63
  private _isPosInBrushMask;
64
64
  private _outOfInteractiveRange;
65
- private _beforeBrushEvent;
66
65
  private _dispatchBrushEvent;
67
66
  private _clearMask;
68
67
  private _isEmptyMask;
package/es/brush/brush.js CHANGED
@@ -24,8 +24,6 @@ export class Brush extends AbstractComponent {
24
24
  this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0,
25
25
  this._operatingMaskMoveRangeX = [ -1 / 0, 1 / 0 ], this._operatingMaskMoveRangeY = [ -1 / 0, 1 / 0 ],
26
26
  this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
27
- if (!1 === this.attribute.interactive) return;
28
- if (!1 === this._beforeBrushEvent(e)) return;
29
27
  const {updateTrigger: updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger: endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved: brushMoved = !0} = this.attribute;
30
28
  array(updateTrigger).forEach((t => this.stage.addEventListener(t, this._onBrushingWithDelay))),
31
29
  array(endTrigger).forEach((t => this.stage.addEventListener(t, this._onBrushEnd))),
@@ -33,18 +31,16 @@ export class Brush extends AbstractComponent {
33
31
  this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e),
34
32
  this._cacheDrawPoints = [ this._startPos ];
35
33
  }, this._onBrushing = e => {
36
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(),
37
- this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e),
38
- this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
34
+ this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e),
35
+ this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e),
36
+ this._activeMoveState && this._moving(e)));
39
37
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime),
40
38
  this._onBrushEnd = e => {
41
- !1 !== this.attribute.interactive && (this._releaseBrushUpdateEvents(), e.preventDefault(),
42
- this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e),
43
- this._activeDrawState = !1, this._activeMoveState = !1);
39
+ this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e),
40
+ this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
44
41
  }, this._onBrushClear = e => {
45
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (e.preventDefault(),
46
- this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)),
47
- this._activeDrawState = !1, this._activeMoveState = !1);
42
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)),
43
+ this._activeDrawState = !1, this._activeMoveState = !1;
48
44
  };
49
45
  }
50
46
  _bindBrushEvents() {
@@ -54,14 +50,12 @@ export class Brush extends AbstractComponent {
54
50
  array(resetTrigger).forEach((t => this.stage.addEventListener(t, this._onBrushClear)));
55
51
  }
56
52
  _initDraw(e) {
57
- if (!1 === this.attribute.interactive) return;
58
53
  const {brushMode: brushMode} = this.attribute, pos = this.eventPosToStagePos(e);
59
54
  this._cacheDrawPoints.push(pos), "single" === brushMode && this._clearMask(), this._addBrushMask(),
60
55
  this._dispatchBrushEvent(IOperateType.drawStart, e), this._activeBrushState = !1;
61
56
  }
62
57
  _initMove(e) {
63
58
  var _a, _b;
64
- if (!1 === this.attribute.interactive) return;
65
59
  this._cacheMovePoint = this.eventPosToStagePos(e), this._operatingMaskMoveDx = null !== (_a = this._operatingMask.attribute.dx) && void 0 !== _a ? _a : 0,
66
60
  this._operatingMaskMoveDy = null !== (_b = this._operatingMask.attribute.dy) && void 0 !== _b ? _b : 0;
67
61
  const {interactiveRange: interactiveRange} = this.attribute, {minY: minY = -1 / 0, maxY: maxY = 1 / 0, minX: minX = -1 / 0, maxX: maxX = 1 / 0} = interactiveRange, {x1: x1, x2: x2, y1: y1, y2: y2} = this._operatingMask.globalAABBBounds, minMoveStepX = minX - x1, maxMoveStepX = maxX - x2, minMoveStepY = minY - y1, maxMoveStepY = maxY - y2;
@@ -70,7 +64,6 @@ export class Brush extends AbstractComponent {
70
64
  }
71
65
  _drawing(e) {
72
66
  var _a;
73
- if (!1 === this.attribute.interactive) return;
74
67
  const pos = this.eventPosToStagePos(e), {brushType: brushType, sizeThreshold: sizeThreshold = DEFAULT_SIZE_THRESHOLD} = this.attribute, cacheLength = this._cacheDrawPoints.length;
75
68
  if (cacheLength > 0) {
76
69
  const lastPos = null !== (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) && void 0 !== _a ? _a : {};
@@ -84,7 +77,6 @@ export class Brush extends AbstractComponent {
84
77
  this._dispatchBrushEvent(IOperateType.brushActive, e)));
85
78
  }
86
79
  _moving(e) {
87
- if (!1 === this.attribute.interactive) return;
88
80
  const startPos = this._cacheMovePoint, pos = this.eventPosToStagePos(e);
89
81
  if (pos.x === (null == startPos ? void 0 : startPos.x) && pos.y === (null == startPos ? void 0 : startPos.y)) return;
90
82
  const moveStepX = pos.x - startPos.x, moveStepY = pos.y - startPos.y, moveX = Math.min(this._operatingMaskMoveRangeX[1], Math.max(this._operatingMaskMoveRangeX[0], moveStepX)) + this._operatingMaskMoveDx, moveY = Math.min(this._operatingMaskMoveRangeY[1], Math.max(this._operatingMaskMoveRangeY[0], moveStepY)) + this._operatingMaskMoveDy;
@@ -95,7 +87,6 @@ export class Brush extends AbstractComponent {
95
87
  this._dispatchBrushEvent(IOperateType.moving, e);
96
88
  }
97
89
  _drawEnd(e) {
98
- if (!1 === this.attribute.interactive) return;
99
90
  const {removeOnClick: removeOnClick = !0, sizeThreshold: sizeThreshold = DEFAULT_SIZE_THRESHOLD} = this.attribute;
100
91
  if (this._outOfInteractiveRange(e)) this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)); else {
101
92
  const {x: x1, y: y1} = this._startPos, {x: x2, y: y2} = this.eventPosToStagePos(e);
@@ -107,8 +98,7 @@ export class Brush extends AbstractComponent {
107
98
  }
108
99
  }
109
100
  _moveEnd(e) {
110
- !1 !== this.attribute.interactive && (this._operatingMask && this._operatingMask.setAttribute("pickable", !1),
111
- this._dispatchBrushEvent(IOperateType.moveEnd, e));
101
+ this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e);
112
102
  }
113
103
  render() {
114
104
  this._bindBrushEvents();
@@ -190,10 +180,6 @@ export class Brush extends AbstractComponent {
190
180
  const {interactiveRange: interactiveRange} = this.attribute, {minY: minY = -1 / 0, maxY: maxY = 1 / 0, minX: minX = -1 / 0, maxX: maxX = 1 / 0} = interactiveRange, pos = this.eventPosToStagePos(e);
191
181
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
192
182
  }
193
- _beforeBrushEvent(e) {
194
- var _a, _b;
195
- return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
196
- }
197
183
  _dispatchBrushEvent(operateType, e) {
198
184
  this._dispatchEvent(operateType, {
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iB,GAAG,wBAAwB,CAAC","file":"brush.js","sourcesContent":["/**\n * @description 框选组件\n */\nimport type { FederatedPointerEvent, IGroup, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IBounds, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { array, cloneDeep, debounce, isEmpty, merge, polygonContainPoint, throttle } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { BrushAttributes } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IOperateType } from './type';\nimport { DEFAULT_BRUSH_ATTRIBUTES, DEFAULT_SIZE_THRESHOLD } from './config';\nimport type { ComponentOptions } from '../interface';\nimport { loadBrushComponent } from './register';\n\nconst delayMap = {\n debounce: debounce,\n throttle: throttle\n};\n\nloadBrushComponent();\nexport class Brush extends AbstractComponent<Required<BrushAttributes>> {\n name = 'brush';\n static defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;\n\n private _container!: IGroup;\n\n // 绘制mask时的相关属性\n private _activeBrushState = false; // 用于标记激活状态\n private _activeDrawState = false; // 用于标记绘制状态\n private _cacheDrawPoints: IPointLike[] = []; // 用于维护鼠标走过的路径,主要用于绘制mask的点\n // 移动mask时的相关属性\n private _activeMoveState = false; // 用于标记移动状态\n private _operatingMaskMoveDx = 0; // 用于标记移动的位移量\n private _operatingMaskMoveDy = 0;\n private _operatingMaskMoveRangeX: [number, number] = [-Infinity, Infinity];\n private _operatingMaskMoveRangeY: [number, number] = [-Infinity, Infinity];\n private _cacheMovePoint!: IPointLike; // 用于维护鼠标所在位置,主要用于计算位移量\n\n private _operatingMask!: IPolygon; // 用于标记正在绘制的mask 或 正在移动的mask\n\n // 透出给上层的属性(主要是所有mask的AABBBounds,这里用的是dict存储方便添加和修改)\n private _brushMaskAABBBoundsDict: { [name: string]: IBounds } = {};\n\n private _firstUpdate = true; // 用于标记第一次更新\n private _startPos!: IPointLike; // 用于标记开始绘制的位置\n\n constructor(attributes: BrushAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Brush.defaultAttributes, attributes));\n }\n\n private _bindBrushEvents(): void {\n // 绑定前先解绑, 确保事件不会重复绑定\n this.releaseBrushEvents();\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this\n .attribute as BrushAttributes;\n array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart as EventListener));\n array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear as EventListener));\n }\n\n /**\n * 开始绘制 或 移动\n * @description\n * 1. 判断状态: 如果在brushMask中,则属于移动状态; 否则属于绘制状态\n *(移动状态和绘制状态互斥, 且移动状态考虑brushMoved配置, 如果在brush点内但brushMoved为false, 则走绘制状态, 而非两个状态都不响应, 此效果与echarts保持一致)\n * 2. 如果是移动状态: 标记移动状态 & 标记正在移动的mask & 初始化mask的dx和dy\n * 3. 如果是绘制状态: 标记绘制状态 & 标记正在绘制的mask & 清除之前的mask & 添加新的mask\n */\n private _onBrushStart = (e: FederatedPointerEvent) => {\n if (this.attribute.interactive === false) {\n return;\n }\n if (this._beforeBrushEvent(e) === false) {\n return;\n }\n const {\n updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,\n endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,\n brushMoved = true\n } = this.attribute as BrushAttributes;\n array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay as EventListener));\n array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd as EventListener));\n\n e.stopPropagation();\n this._firstUpdate = true;\n this._activeMoveState = brushMoved && this._isPosInBrushMask(e); // 如果是移动状态,在这里会标记operatingMask为正在移动的mask\n this._activeDrawState = !this._activeMoveState;\n this._startPos = this.eventPosToStagePos(e);\n this._cacheDrawPoints = [this._startPos];\n };\n\n /**\n * 绘制 或 移动 中\n * @description\n * 1. 如果是绘制状态: 更新_cacheDrawPoints 和 mask的points属性\n * 2. 如果是移动状态: 标记移动状态 & 计算位移量 & 给被移动的mask偏移属性\n */\n private _onBrushing = (e: FederatedPointerEvent) => {\n if (this.attribute.interactive === false) {\n return;\n }\n if (this._beforeBrushEvent(e) === false) {\n return;\n }\n\n if (this._outOfInteractiveRange(e)) {\n return;\n }\n e.stopPropagation();\n if (this._firstUpdate) {\n this._activeDrawState && this._initDraw(e);\n this._activeMoveState && this._initMove(e);\n this._firstUpdate = false;\n } else {\n this._activeDrawState && this._drawing(e);\n this._activeMoveState && this._moving(e);\n }\n };\n\n private _onBrushingWithDelay =\n this.attribute.delayTime === 0\n ? this._onBrushing\n : delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);\n\n /**\n * 结束绘制 和 移动\n * @description 取消绘制 和 移动 状态\n */\n private _onBrushEnd = (e: FederatedPointerEvent) => {\n if (this.attribute.interactive === false) {\n return;\n }\n this._releaseBrushUpdateEvents();\n e.preventDefault();\n this._activeDrawState && this._drawEnd(e);\n this._activeMoveState && this._moveEnd(e);\n\n this._activeDrawState = false;\n this._activeMoveState = false;\n };\n\n private _onBrushClear = (e: FederatedPointerEvent) => {\n if (this.attribute.interactive === false) {\n return;\n }\n if (this._beforeBrushEvent(e) === false) {\n return;\n }\n e.preventDefault();\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n this._activeDrawState = false;\n this._activeMoveState = false;\n };\n\n /**\n * 初始化绘制状态\n * @description 清除之前的mask & 添加新的mask\n */\n private _initDraw(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n const { brushMode } = this.attribute as BrushAttributes;\n const pos = this.eventPosToStagePos(e);\n\n this._cacheDrawPoints.push(pos);\n brushMode === 'single' && this._clearMask();\n this._addBrushMask();\n this._dispatchBrushEvent(IOperateType.drawStart, e);\n this._activeBrushState = false;\n }\n\n /**\n * 初始化移动状态\n * @description 初始化mask的dx和dy\n */\n private _initMove(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n this._cacheMovePoint = this.eventPosToStagePos(e);\n\n this._operatingMaskMoveDx = this._operatingMask.attribute.dx ?? 0;\n this._operatingMaskMoveDy = this._operatingMask.attribute.dy ?? 0;\n\n // 计算最大移动范围, 为了将brushMask限制在交互范围内\n const { interactiveRange } = this.attribute as BrushAttributes;\n const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;\n\n const { x1, x2, y1, y2 } = this._operatingMask.globalAABBBounds;\n const minMoveStepX = minX - x1;\n const maxMoveStepX = maxX - x2;\n const minMoveStepY = minY - y1;\n const maxMoveStepY = maxY - y2;\n\n this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];\n this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];\n\n this._operatingMask.setAttribute('pickable', true);\n this._dispatchBrushEvent(IOperateType.moveStart, e);\n }\n\n /**\n * 绘制中\n * @description 更新_cacheDrawPoints 和 mask的points属性\n */\n private _drawing(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n const pos = this.eventPosToStagePos(e);\n const { brushType, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute as BrushAttributes;\n\n const cacheLength = this._cacheDrawPoints.length;\n\n // 如果当前点的位置和上一次点的位置一致,则无需更新\n if (cacheLength > 0) {\n const lastPos = this._cacheDrawPoints[this._cacheDrawPoints.length - 1] ?? ({} as IPointLike);\n if (pos.x === lastPos.x && pos.y === lastPos.y) {\n return;\n }\n }\n // 更新交互位置\n if (brushType === 'polygon' || cacheLength <= 1) {\n this._cacheDrawPoints.push(pos);\n } else {\n this._cacheDrawPoints[cacheLength - 1] = pos;\n }\n // 更新mask形状\n const maskPoints = this._computeMaskPoints();\n this._operatingMask.setAttribute('points', maskPoints);\n const { x: x1, y: y1 } = this._startPos;\n const { x: x2, y: y2 } = this.eventPosToStagePos(e);\n // 绘制大小超过阈值, 才激活brush\n if (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) {\n // 无论是多选,还是单选\n // 如果这是第一个brush mask\n // 证明这第一次绘制, 则触发brushActive事件\n if (Object.keys(this._brushMaskAABBBoundsDict).length === 1 && !this._activeBrushState) {\n this._activeBrushState = true;\n this._dispatchBrushEvent(IOperateType.brushActive, e);\n } else {\n this._dispatchBrushEvent(IOperateType.drawing, e);\n }\n }\n }\n\n /**\n * 移动中\n * @description 标记移动状态 & 计算位移量 & 给被移动的mask偏移属性\n */\n private _moving(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n const startPos = this._cacheMovePoint;\n const pos = this.eventPosToStagePos(e);\n // 如果当前点的位置和上一次点的位置一致,则无需更新\n if (pos.x === startPos?.x && pos.y === startPos?.y) {\n return;\n }\n\n const moveStepX = pos.x - startPos.x;\n const moveStepY = pos.y - startPos.y;\n const moveX =\n Math.min(this._operatingMaskMoveRangeX[1], Math.max(this._operatingMaskMoveRangeX[0], moveStepX)) +\n this._operatingMaskMoveDx;\n const moveY =\n Math.min(this._operatingMaskMoveRangeY[1], Math.max(this._operatingMaskMoveRangeY[0], moveStepY)) +\n this._operatingMaskMoveDy;\n\n this._operatingMask.setAttributes({\n dx: moveX,\n dy: moveY\n });\n this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;\n this._dispatchBrushEvent(IOperateType.moving, e);\n }\n\n private _drawEnd(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute as BrushAttributes;\n if (this._outOfInteractiveRange(e)) {\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n } else {\n const { x: x1, y: y1 } = this._startPos;\n const { x: x2, y: y2 } = this.eventPosToStagePos(e);\n // 1. 无效绘制: 单击\n if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n }\n // 2. 无效绘制: 绘制了mask但没有超过阈值, 仅清空当前操作的mask\n else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {\n delete this._brushMaskAABBBoundsDict[this._operatingMask.name];\n this._container.setAttributes({}); // hack逻辑, 待优化: removeChild后, vrender 无法 autoRender, setAttr手动触发render\n this._container.removeChild(this._operatingMask);\n if (this._isEmptyMask()) {\n // 说明是最后一个mask被清空了, 要抛出clear事件, 重置图元状态\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n } else {\n // 说明还有其他mask, 这次无效绘制不会重置状态\n // do nothing\n }\n }\n // 3. 有效绘制\n else {\n this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;\n this._dispatchBrushEvent(IOperateType.drawEnd, e);\n }\n }\n }\n\n private _moveEnd(e: FederatedPointerEvent) {\n if (this.attribute.interactive === false) {\n return;\n }\n if (this._operatingMask) {\n this._operatingMask.setAttribute('pickable', false);\n }\n this._dispatchBrushEvent(IOperateType.moveEnd, e);\n }\n\n protected render() {\n this._bindBrushEvents();\n const group = this.createOrUpdateChild('brush-container', {}, 'group') as unknown as IGroup;\n this._container = group;\n }\n\n releaseBrushEvents(): void {\n const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this\n .attribute as BrushAttributes;\n array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart as EventListener));\n array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear as EventListener));\n this._releaseBrushUpdateEvents();\n }\n\n private _releaseBrushUpdateEvents(): void {\n const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } =\n this.attribute as BrushAttributes;\n array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay as EventListener));\n array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd as EventListener));\n }\n\n /**\n * 构造brushMask的points属性\n * @description 根据不同的brushType从_cacheDrawPoints中取points\n * 1. 'rect': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点\n * 2. 'x': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点的x坐标\n * 3. 'y': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点的y坐标\n * 4. 'polygon': 取鼠标轨迹_cacheDrawPoints的所有点\n */\n private _computeMaskPoints() {\n const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute as BrushAttributes;\n let maskPoints: IPointLike[] = [];\n const startPoint = this._cacheDrawPoints[0];\n const endPoint = this._cacheDrawPoints[this._cacheDrawPoints.length - 1];\n\n if (brushType === 'rect') {\n maskPoints = [\n startPoint,\n {\n x: endPoint.x,\n y: startPoint.y\n },\n endPoint,\n {\n x: startPoint.x,\n y: endPoint.y\n }\n ];\n } else if (brushType === 'x') {\n maskPoints = [\n {\n x: startPoint.x,\n y: yRange[0]\n },\n {\n x: endPoint.x,\n y: yRange[0]\n },\n {\n x: endPoint.x,\n y: yRange[1]\n },\n {\n x: startPoint.x,\n y: yRange[1]\n }\n ];\n } else if (brushType === 'y') {\n maskPoints = [\n {\n x: xRange[0],\n y: startPoint.y\n },\n {\n x: xRange[0],\n y: endPoint.y\n },\n {\n x: xRange[1],\n y: endPoint.y\n },\n {\n x: xRange[1],\n y: startPoint.y\n }\n ];\n } else {\n maskPoints = cloneDeep(this._cacheDrawPoints); // _cacheDrawPoints在不断更新,所以这里需要cloneDeep\n }\n return maskPoints;\n }\n\n /**\n * 添加brushMask\n */\n private _addBrushMask() {\n const { brushStyle, hasMask } = this.attribute as BrushAttributes;\n const brushMask = graphicCreator.polygon({\n points: cloneDeep(this._cacheDrawPoints), // _cacheDrawPoints在不断更新,所以这里需要cloneDeep\n cursor: 'move',\n pickable: false,\n ...brushStyle,\n opacity: hasMask ? (brushStyle.opacity ?? 1) : 0\n });\n brushMask.name = `brush-${Date.now()}`; // 用Date给mask唯一标记\n this._operatingMask = brushMask;\n this._container.add(brushMask);\n this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;\n }\n\n /**\n * 遍历_container的所有子元素,判断鼠标是否在子元素的范围内\n */\n private _isPosInBrushMask(e: FederatedPointerEvent) {\n const pos = this.eventPosToStagePos(e);\n const brushMasks = this._container.getChildren();\n for (let i = 0; i < brushMasks.length; i++) {\n const { points = [], dx = 0, dy = 0 } = (brushMasks[i] as IPolygon).attribute;\n const pointsConsiderOffset: IPointLike[] = points.map((point: IPointLike) => {\n return {\n x: point.x + dx,\n y: point.y + dy\n };\n });\n if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {\n this._operatingMask = brushMasks[i] as IPolygon;\n return true;\n }\n }\n return false;\n }\n\n /**\n * 判断鼠标是否在交互范围内\n */\n private _outOfInteractiveRange(e: FederatedPointerEvent) {\n // 在返回坐标时,将其限制在交互范围内\n const { interactiveRange } = this.attribute as BrushAttributes;\n const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;\n const pos = this.eventPosToStagePos(e);\n if (pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY) {\n return true;\n }\n return false;\n }\n\n /**\n * 触发框选前事件\n * @returns 返回 false 表示中断后续逻辑,返回 true 或 undefined 表示继续执行\n */\n private _beforeBrushEvent(e: FederatedPointerEvent): void | boolean {\n return this.attribute.beforeBrushChange?.(e);\n }\n\n /**\n * 根据操作类型触发对应的事件\n */\n private _dispatchBrushEvent(operateType: IOperateType, e: any) {\n this._dispatchEvent(operateType, {\n operateMask: this._operatingMask as any,\n operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,\n event: e\n });\n }\n\n /**\n * 重置brush状态\n */\n private _clearMask() {\n this._brushMaskAABBBoundsDict = {};\n this._container.removeAllChild();\n this._operatingMask = null;\n }\n\n /**\n * 判断当前画布中,是否存在有效mask\n */\n private _isEmptyMask() {\n return (\n isEmpty(this._brushMaskAABBBoundsDict) ||\n Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty())\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/brush/brush.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,kBAAkB,EAAE,CAAC;AACrB,MAAM,OAAO,KAAM,SAAQ,iBAA4C;IA0BrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA1B5F,SAAI,GAAG,OAAO,CAAC;QAMP,sBAAiB,GAAG,KAAK,CAAC;QAC1B,qBAAgB,GAAG,KAAK,CAAC;QACzB,qBAAgB,GAAiB,EAAE,CAAC;QAEpC,qBAAgB,GAAG,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,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAKO,YAAY;QAClB,OAAO,CACL,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CACpG,CAAC;IACJ,CAAC;;AA/bM,uBAAiB,GAAG,wBAAwB,CAAC","file":"brush.js","sourcesContent":["/**\n * @description 框选组件\n */\nimport type { FederatedPointerEvent, IGroup, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IBounds, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { array, cloneDeep, debounce, isEmpty, merge, polygonContainPoint, throttle } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { BrushAttributes } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IOperateType } from './type';\nimport { DEFAULT_BRUSH_ATTRIBUTES, DEFAULT_SIZE_THRESHOLD } from './config';\nimport type { ComponentOptions } from '../interface';\nimport { loadBrushComponent } from './register';\n\nconst delayMap = {\n debounce: debounce,\n throttle: throttle\n};\n\nloadBrushComponent();\nexport class Brush extends AbstractComponent<Required<BrushAttributes>> {\n name = 'brush';\n static defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;\n\n private _container!: IGroup;\n\n // 绘制mask时的相关属性\n private _activeBrushState = false; // 用于标记激活状态\n private _activeDrawState = false; // 用于标记绘制状态\n private _cacheDrawPoints: IPointLike[] = []; // 用于维护鼠标走过的路径,主要用于绘制mask的点\n // 移动mask时的相关属性\n private _activeMoveState = false; // 用于标记移动状态\n private _operatingMaskMoveDx = 0; // 用于标记移动的位移量\n private _operatingMaskMoveDy = 0;\n private _operatingMaskMoveRangeX: [number, number] = [-Infinity, Infinity];\n private _operatingMaskMoveRangeY: [number, number] = [-Infinity, Infinity];\n private _cacheMovePoint!: IPointLike; // 用于维护鼠标所在位置,主要用于计算位移量\n\n private _operatingMask!: IPolygon; // 用于标记正在绘制的mask 或 正在移动的mask\n\n // 透出给上层的属性(主要是所有mask的AABBBounds,这里用的是dict存储方便添加和修改)\n private _brushMaskAABBBoundsDict: { [name: string]: IBounds } = {};\n\n private _firstUpdate = true; // 用于标记第一次更新\n private _startPos!: IPointLike; // 用于标记开始绘制的位置\n\n constructor(attributes: BrushAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Brush.defaultAttributes, attributes));\n }\n\n private _bindBrushEvents(): void {\n // 绑定前先解绑, 确保事件不会重复绑定\n this.releaseBrushEvents();\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this\n .attribute as BrushAttributes;\n array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart as EventListener));\n array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear as EventListener));\n }\n\n /**\n * 开始绘制 或 移动\n * @description\n * 1. 判断状态: 如果在brushMask中,则属于移动状态; 否则属于绘制状态\n *(移动状态和绘制状态互斥, 且移动状态考虑brushMoved配置, 如果在brush点内但brushMoved为false, 则走绘制状态, 而非两个状态都不响应, 此效果与echarts保持一致)\n * 2. 如果是移动状态: 标记移动状态 & 标记正在移动的mask & 初始化mask的dx和dy\n * 3. 如果是绘制状态: 标记绘制状态 & 标记正在绘制的mask & 清除之前的mask & 添加新的mask\n */\n private _onBrushStart = (e: FederatedPointerEvent) => {\n const {\n updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,\n endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,\n brushMoved = true\n } = this.attribute as BrushAttributes;\n array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay as EventListener));\n array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd as EventListener));\n\n e.stopPropagation();\n this._firstUpdate = true;\n this._activeMoveState = brushMoved && this._isPosInBrushMask(e); // 如果是移动状态,在这里会标记operatingMask为正在移动的mask\n this._activeDrawState = !this._activeMoveState;\n this._startPos = this.eventPosToStagePos(e);\n this._cacheDrawPoints = [this._startPos];\n };\n\n /**\n * 绘制 或 移动 中\n * @description\n * 1. 如果是绘制状态: 更新_cacheDrawPoints 和 mask的points属性\n * 2. 如果是移动状态: 标记移动状态 & 计算位移量 & 给被移动的mask偏移属性\n */\n private _onBrushing = (e: FederatedPointerEvent) => {\n if (this._outOfInteractiveRange(e)) {\n return;\n }\n e.stopPropagation();\n if (this._firstUpdate) {\n this._activeDrawState && this._initDraw(e);\n this._activeMoveState && this._initMove(e);\n this._firstUpdate = false;\n } else {\n this._activeDrawState && this._drawing(e);\n this._activeMoveState && this._moving(e);\n }\n };\n\n private _onBrushingWithDelay =\n this.attribute.delayTime === 0\n ? this._onBrushing\n : delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);\n\n /**\n * 结束绘制 和 移动\n * @description 取消绘制 和 移动 状态\n */\n private _onBrushEnd = (e: FederatedPointerEvent) => {\n this._releaseBrushUpdateEvents();\n e.preventDefault();\n this._activeDrawState && this._drawEnd(e);\n this._activeMoveState && this._moveEnd(e);\n\n this._activeDrawState = false;\n this._activeMoveState = false;\n };\n\n private _onBrushClear = (e: FederatedPointerEvent) => {\n e.preventDefault();\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n this._activeDrawState = false;\n this._activeMoveState = false;\n };\n\n /**\n * 初始化绘制状态\n * @description 清除之前的mask & 添加新的mask\n */\n private _initDraw(e: FederatedPointerEvent) {\n const { brushMode } = this.attribute as BrushAttributes;\n const pos = this.eventPosToStagePos(e);\n\n this._cacheDrawPoints.push(pos);\n brushMode === 'single' && this._clearMask();\n this._addBrushMask();\n this._dispatchBrushEvent(IOperateType.drawStart, e);\n this._activeBrushState = false;\n }\n\n /**\n * 初始化移动状态\n * @description 初始化mask的dx和dy\n */\n private _initMove(e: FederatedPointerEvent) {\n this._cacheMovePoint = this.eventPosToStagePos(e);\n\n this._operatingMaskMoveDx = this._operatingMask.attribute.dx ?? 0;\n this._operatingMaskMoveDy = this._operatingMask.attribute.dy ?? 0;\n\n // 计算最大移动范围, 为了将brushMask限制在交互范围内\n const { interactiveRange } = this.attribute as BrushAttributes;\n const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;\n\n const { x1, x2, y1, y2 } = this._operatingMask.globalAABBBounds;\n const minMoveStepX = minX - x1;\n const maxMoveStepX = maxX - x2;\n const minMoveStepY = minY - y1;\n const maxMoveStepY = maxY - y2;\n\n this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];\n this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];\n\n this._operatingMask.setAttribute('pickable', true);\n this._dispatchBrushEvent(IOperateType.moveStart, e);\n }\n\n /**\n * 绘制中\n * @description 更新_cacheDrawPoints 和 mask的points属性\n */\n private _drawing(e: FederatedPointerEvent) {\n const pos = this.eventPosToStagePos(e);\n const { brushType, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute as BrushAttributes;\n\n const cacheLength = this._cacheDrawPoints.length;\n\n // 如果当前点的位置和上一次点的位置一致,则无需更新\n if (cacheLength > 0) {\n const lastPos = this._cacheDrawPoints[this._cacheDrawPoints.length - 1] ?? ({} as IPointLike);\n if (pos.x === lastPos.x && pos.y === lastPos.y) {\n return;\n }\n }\n // 更新交互位置\n if (brushType === 'polygon' || cacheLength <= 1) {\n this._cacheDrawPoints.push(pos);\n } else {\n this._cacheDrawPoints[cacheLength - 1] = pos;\n }\n // 更新mask形状\n const maskPoints = this._computeMaskPoints();\n this._operatingMask.setAttribute('points', maskPoints);\n const { x: x1, y: y1 } = this._startPos;\n const { x: x2, y: y2 } = this.eventPosToStagePos(e);\n // 绘制大小超过阈值, 才激活brush\n if (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) {\n // 无论是多选,还是单选\n // 如果这是第一个brush mask\n // 证明这第一次绘制, 则触发brushActive事件\n if (Object.keys(this._brushMaskAABBBoundsDict).length === 1 && !this._activeBrushState) {\n this._activeBrushState = true;\n this._dispatchBrushEvent(IOperateType.brushActive, e);\n } else {\n this._dispatchBrushEvent(IOperateType.drawing, e);\n }\n }\n }\n\n /**\n * 移动中\n * @description 标记移动状态 & 计算位移量 & 给被移动的mask偏移属性\n */\n private _moving(e: FederatedPointerEvent) {\n const startPos = this._cacheMovePoint;\n const pos = this.eventPosToStagePos(e);\n // 如果当前点的位置和上一次点的位置一致,则无需更新\n if (pos.x === startPos?.x && pos.y === startPos?.y) {\n return;\n }\n\n const moveStepX = pos.x - startPos.x;\n const moveStepY = pos.y - startPos.y;\n const moveX =\n Math.min(this._operatingMaskMoveRangeX[1], Math.max(this._operatingMaskMoveRangeX[0], moveStepX)) +\n this._operatingMaskMoveDx;\n const moveY =\n Math.min(this._operatingMaskMoveRangeY[1], Math.max(this._operatingMaskMoveRangeY[0], moveStepY)) +\n this._operatingMaskMoveDy;\n\n this._operatingMask.setAttributes({\n dx: moveX,\n dy: moveY\n });\n this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;\n this._dispatchBrushEvent(IOperateType.moving, e);\n }\n\n private _drawEnd(e: FederatedPointerEvent) {\n const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute as BrushAttributes;\n if (this._outOfInteractiveRange(e)) {\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n } else {\n const { x: x1, y: y1 } = this._startPos;\n const { x: x2, y: y2 } = this.eventPosToStagePos(e);\n // 1. 无效绘制: 单击\n if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {\n if (!this._isEmptyMask()) {\n this._clearMask();\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n }\n }\n // 2. 无效绘制: 绘制了mask但没有超过阈值, 仅清空当前操作的mask\n else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {\n delete this._brushMaskAABBBoundsDict[this._operatingMask.name];\n this._container.setAttributes({}); // hack逻辑, 待优化: removeChild后, vrender 无法 autoRender, setAttr手动触发render\n this._container.removeChild(this._operatingMask);\n if (this._isEmptyMask()) {\n // 说明是最后一个mask被清空了, 要抛出clear事件, 重置图元状态\n this._dispatchBrushEvent(IOperateType.brushClear, e);\n } else {\n // 说明还有其他mask, 这次无效绘制不会重置状态\n // do nothing\n }\n }\n // 3. 有效绘制\n else {\n this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;\n this._dispatchBrushEvent(IOperateType.drawEnd, e);\n }\n }\n }\n\n private _moveEnd(e: FederatedPointerEvent) {\n if (this._operatingMask) {\n this._operatingMask.setAttribute('pickable', false);\n }\n this._dispatchBrushEvent(IOperateType.moveEnd, e);\n }\n\n protected render() {\n this._bindBrushEvents();\n const group = this.createOrUpdateChild('brush-container', {}, 'group') as unknown as IGroup;\n this._container = group;\n }\n\n releaseBrushEvents(): void {\n const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this\n .attribute as BrushAttributes;\n array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart as EventListener));\n array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear as EventListener));\n this._releaseBrushUpdateEvents();\n }\n\n private _releaseBrushUpdateEvents(): void {\n const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } =\n this.attribute as BrushAttributes;\n array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay as EventListener));\n array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd as EventListener));\n }\n\n /**\n * 构造brushMask的points属性\n * @description 根据不同的brushType从_cacheDrawPoints中取points\n * 1. 'rect': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点\n * 2. 'x': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点的x坐标\n * 3. 'y': 只取鼠标轨迹_cacheDrawPoints的第一个点和最后一个点的y坐标\n * 4. 'polygon': 取鼠标轨迹_cacheDrawPoints的所有点\n */\n private _computeMaskPoints() {\n const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute as BrushAttributes;\n let maskPoints: IPointLike[] = [];\n const startPoint = this._cacheDrawPoints[0];\n const endPoint = this._cacheDrawPoints[this._cacheDrawPoints.length - 1];\n\n if (brushType === 'rect') {\n maskPoints = [\n startPoint,\n {\n x: endPoint.x,\n y: startPoint.y\n },\n endPoint,\n {\n x: startPoint.x,\n y: endPoint.y\n }\n ];\n } else if (brushType === 'x') {\n maskPoints = [\n {\n x: startPoint.x,\n y: yRange[0]\n },\n {\n x: endPoint.x,\n y: yRange[0]\n },\n {\n x: endPoint.x,\n y: yRange[1]\n },\n {\n x: startPoint.x,\n y: yRange[1]\n }\n ];\n } else if (brushType === 'y') {\n maskPoints = [\n {\n x: xRange[0],\n y: startPoint.y\n },\n {\n x: xRange[0],\n y: endPoint.y\n },\n {\n x: xRange[1],\n y: endPoint.y\n },\n {\n x: xRange[1],\n y: startPoint.y\n }\n ];\n } else {\n maskPoints = cloneDeep(this._cacheDrawPoints); // _cacheDrawPoints在不断更新,所以这里需要cloneDeep\n }\n return maskPoints;\n }\n\n /**\n * 添加brushMask\n */\n private _addBrushMask() {\n const { brushStyle, hasMask } = this.attribute as BrushAttributes;\n const brushMask = graphicCreator.polygon({\n points: cloneDeep(this._cacheDrawPoints), // _cacheDrawPoints在不断更新,所以这里需要cloneDeep\n cursor: 'move',\n pickable: false,\n ...brushStyle,\n opacity: hasMask ? (brushStyle.opacity ?? 1) : 0\n });\n brushMask.name = `brush-${Date.now()}`; // 用Date给mask唯一标记\n this._operatingMask = brushMask;\n this._container.add(brushMask);\n this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;\n }\n\n /**\n * 遍历_container的所有子元素,判断鼠标是否在子元素的范围内\n */\n private _isPosInBrushMask(e: FederatedPointerEvent) {\n const pos = this.eventPosToStagePos(e);\n const brushMasks = this._container.getChildren();\n for (let i = 0; i < brushMasks.length; i++) {\n const { points = [], dx = 0, dy = 0 } = (brushMasks[i] as IPolygon).attribute;\n const pointsConsiderOffset: IPointLike[] = points.map((point: IPointLike) => {\n return {\n x: point.x + dx,\n y: point.y + dy\n };\n });\n if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {\n this._operatingMask = brushMasks[i] as IPolygon;\n return true;\n }\n }\n return false;\n }\n\n /**\n * 判断鼠标是否在交互范围内\n */\n private _outOfInteractiveRange(e: FederatedPointerEvent) {\n // 在返回坐标时,将其限制在交互范围内\n const { interactiveRange } = this.attribute as BrushAttributes;\n const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;\n const pos = this.eventPosToStagePos(e);\n if (pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY) {\n return true;\n }\n return false;\n }\n\n /**\n * 根据操作类型触发对应的事件\n */\n private _dispatchBrushEvent(operateType: IOperateType, e: any) {\n this._dispatchEvent(operateType, {\n operateMask: this._operatingMask as any,\n operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,\n event: e\n });\n }\n\n /**\n * 重置brush状态\n */\n private _clearMask() {\n this._brushMaskAABBBoundsDict = {};\n this._container.removeAllChild();\n this._operatingMask = null;\n }\n\n /**\n * 判断当前画布中,是否存在有效mask\n */\n private _isEmptyMask() {\n return (\n isEmpty(this._brushMaskAABBBoundsDict) ||\n Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty())\n );\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
- import type { FederatedPointerEvent, GraphicEventType, IGroupGraphicAttribute, IPolygonGraphicAttribute } from '@visactor/vrender-core';
1
+ import type { GraphicEventType, IGroupGraphicAttribute, IPolygonGraphicAttribute } from '@visactor/vrender-core';
2
2
  import type { IDelayType } from '../interface';
3
3
  export interface BrushAttributes extends IGroupGraphicAttribute {
4
- interactive?: boolean;
5
4
  trigger?: GraphicEventType | GraphicEventType[];
6
5
  updateTrigger?: GraphicEventType | GraphicEventType[];
7
6
  endTrigger?: GraphicEventType | GraphicEventType[];
@@ -24,7 +23,6 @@ export interface BrushAttributes extends IGroupGraphicAttribute {
24
23
  delayType?: IDelayType;
25
24
  delayTime?: number;
26
25
  disableTriggerEvent?: boolean;
27
- beforeBrushChange?: (e: FederatedPointerEvent) => void | boolean;
28
26
  }
29
27
  export type IBrushType = 'x' | 'y' | 'rect' | 'polygon';
30
28
  export type IBrushMode = 'single' | 'multiple';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/brush/type.ts"],"names":[],"mappings":"AAsGA,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;AAC3B,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","file":"type.js","sourcesContent":["import type {\n FederatedPointerEvent,\n GraphicEventType,\n IGroupGraphicAttribute,\n IPolygonGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { IDelayType } from '../interface';\n\nexport interface BrushAttributes extends IGroupGraphicAttribute {\n /**\n * 是否禁止交互,默认为 true\n */\n interactive?: boolean;\n /**\n * 触发框选的事件名称\n */\n trigger?: GraphicEventType | GraphicEventType[];\n /**\n * 更新框选的事件名称\n */\n updateTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 结束框选的事件名称\n */\n endTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 清空框选的事件名称\n */\n resetTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 可交互范围\n */\n interactiveRange?: {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n };\n /**\n * 框选模式\n * @default 'single'\n */\n brushMode?: IBrushMode;\n /**\n * 框选类型\n * @default 'rect'\n */\n brushType?: IBrushType;\n /**\n * brushType为'y'时, x的左右边界位置, 不配置的话不会生效\n * @default [0,0]\n */\n xRange?: [number, number];\n /**\n * brushType为'x'时, y的左右边界位置, 不配置的话不会生效\n * @default [0,0]\n */\n yRange?: [number, number];\n /** 是否展示brush mask */\n hasMask?: boolean;\n /**\n * 框选区域的样式\n */\n brushStyle?: IPolygonGraphicAttribute;\n /**\n * 是否可被平移\n * @default true\n */\n brushMoved?: boolean;\n /**\n * 是否单击空白处, 清除选框\n * @default true\n */\n removeOnClick?: boolean;\n /**\n * brush选框的大小阈值\n */\n sizeThreshold?: number;\n /**\n * 事件触发延迟类型\n * @default 'throttle'\n */\n delayType?: IDelayType;\n /**\n * 事件触发延迟时长\n * @default 0\n */\n delayTime?: number;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n /**\n * 框选前触发事件\n */\n beforeBrushChange?: (e: FederatedPointerEvent) => void | boolean;\n}\n\nexport type IBrushType = 'x' | 'y' | 'rect' | 'polygon';\nexport type IBrushMode = 'single' | 'multiple';\n\nexport enum IOperateType {\n drawStart = 'drawStart',\n drawEnd = 'drawEnd',\n drawing = 'drawing',\n moving = 'moving',\n moveStart = 'moveStart',\n moveEnd = 'moveEnd',\n brushActive = 'brushActive',\n brushClear = 'brushClear'\n}\n"]}
1
+ {"version":3,"sources":["../src/brush/type.ts"],"names":[],"mappings":"AAyFA,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;AAC3B,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","file":"type.js","sourcesContent":["import type { GraphicEventType, IGroupGraphicAttribute, IPolygonGraphicAttribute } from '@visactor/vrender-core';\nimport type { IDelayType } from '../interface';\n\nexport interface BrushAttributes extends IGroupGraphicAttribute {\n /**\n * 触发框选的事件名称\n */\n trigger?: GraphicEventType | GraphicEventType[];\n /**\n * 更新框选的事件名称\n */\n updateTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 结束框选的事件名称\n */\n endTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 清空框选的事件名称\n */\n resetTrigger?: GraphicEventType | GraphicEventType[];\n /**\n * 可交互范围\n */\n interactiveRange?: {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n };\n /**\n * 框选模式\n * @default 'single'\n */\n brushMode?: IBrushMode;\n /**\n * 框选类型\n * @default 'rect'\n */\n brushType?: IBrushType;\n /**\n * brushType为'y'时, x的左右边界位置, 不配置的话不会生效\n * @default [0,0]\n */\n xRange?: [number, number];\n /**\n * brushType为'x'时, y的左右边界位置, 不配置的话不会生效\n * @default [0,0]\n */\n yRange?: [number, number];\n /** 是否展示brush mask */\n hasMask?: boolean;\n /**\n * 框选区域的样式\n */\n brushStyle?: IPolygonGraphicAttribute;\n /**\n * 是否可被平移\n * @default true\n */\n brushMoved?: boolean;\n /**\n * 是否单击空白处, 清除选框\n * @default true\n */\n removeOnClick?: boolean;\n /**\n * brush选框的大小阈值\n */\n sizeThreshold?: number;\n /**\n * 事件触发延迟类型\n * @default 'throttle'\n */\n delayType?: IDelayType;\n /**\n * 事件触发延迟时长\n * @default 0\n */\n delayTime?: number;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport type IBrushType = 'x' | 'y' | 'rect' | 'polygon';\nexport type IBrushMode = 'single' | 'multiple';\n\nexport enum IOperateType {\n drawStart = 'drawStart',\n drawEnd = 'drawEnd',\n drawing = 'drawing',\n moving = 'moving',\n moveStart = 'moveStart',\n moveEnd = 'moveEnd',\n brushActive = 'brushActive',\n brushClear = 'brushClear'\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "1.0.37-alpha.1";
1
+ export declare const version = "1.1.0-alpha.0";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "1.0.37-alpha.1";
1
+ export const version = "1.1.0-alpha.0";
2
2
 
3
3
  export * from "./core/base";
4
4
 
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,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.0.37-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.1.0-alpha.0\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
@@ -1,11 +1,3 @@
1
- var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
2
- var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
4
- return c > 3 && r && Object.defineProperty(target, key, r), r;
5
- };
6
-
7
- import { injectable } from "@visactor/vrender-core";
8
-
9
1
  import { PopTip } from "./poptip";
10
2
 
11
3
  import { merge } from "@visactor/vutils";
@@ -16,7 +8,7 @@ function wrapPoptip(target, source) {
16
8
  return merge(target, theme.poptip, source), target;
17
9
  }
18
10
 
19
- let PopTipRenderContribution = class {
11
+ export class PopTipRenderContribution {
20
12
  render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
21
13
  var _a, _b;
22
14
  if (1 === graphic._showPoptip) {
@@ -48,9 +40,5 @@ let PopTipRenderContribution = class {
48
40
  }), null === (_b = this.poptipComponent.parent) || void 0 === _b || _b.removeChild(this.poptipComponent),
49
41
  this.poptipComponent = null));
50
42
  }
51
- };
52
-
53
- PopTipRenderContribution = __decorate([ injectable() ], PopTipRenderContribution);
54
-
55
- export { PopTipRenderContribution };
43
+ }
56
44
  //# sourceMappingURL=contribution.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH,EACnH,OAAa;;QAEb,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YAC7B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAI,OAAO,CAAC,SAAiB,CAAC,MAAM,IAAI,EAAE,CAAC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BAAgB,IACxC,CAAC;YAEH,WAAW,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAC5C,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC5C;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,MAAA,IAAI,CAAC,eAAe,CAAC,MAAM,0CAAE,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC/D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;SACF;IACH,CAAC;CACF,CAAA;AAtEY,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CAsEpC;SAtEY,wBAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n // 默认使用bounds作为锚点\n poptipAnchor: 'bounds',\n ...poptip,\n x: matrix.e,\n y: matrix.f,\n positionBounds: graphic.globalAABBBounds\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n if (this.poptipComponent) {\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n this.poptipComponent.parent?.removeChild(this.poptipComponent);\n this.poptipComponent = null;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EA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veSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n // 默认使用bounds作为锚点\n poptipAnchor: 'bounds',\n ...poptip,\n x: matrix.e,\n y: matrix.f,\n positionBounds: graphic.globalAABBBounds\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n if (this.poptipComponent) {\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n this.poptipComponent.parent?.removeChild(this.poptipComponent);\n this.poptipComponent = null;\n }\n }\n }\n}\n"]}
@@ -1,3 +1 @@
1
- import { ContainerModule } from '@visactor/vrender-core';
2
- export declare const popTipModule: ContainerModule;
3
1
  export declare function loadPoptip(): void;
@@ -1,17 +1,13 @@
1
- import { InteractiveSubRenderContribution, AutoEnablePlugins, ContainerModule, container } from "@visactor/vrender-core";
1
+ import { InteractiveSubRenderContribution, AutoEnablePlugins, contributionRegistry } from "@visactor/vrender-core";
2
2
 
3
3
  import { PopTipRenderContribution } from "./contribution";
4
4
 
5
5
  import { PopTipPlugin, PopTipForClipedTextPlugin } from "./poptip-plugin";
6
6
 
7
- export const popTipModule = new ContainerModule(((bind, unbind, isBound, rebind) => {
8
- isBound(PopTipRenderContribution) || (bind(PopTipRenderContribution).toSelf().inSingletonScope(),
9
- bind(InteractiveSubRenderContribution).toService(PopTipRenderContribution)), isBound(PopTipPlugin) || (bind(PopTipPlugin).toSelf(),
10
- bind(AutoEnablePlugins).toService(PopTipPlugin)), isBound(PopTipForClipedTextPlugin) || (bind(PopTipForClipedTextPlugin).toSelf(),
11
- bind(AutoEnablePlugins).toService(PopTipForClipedTextPlugin));
12
- }));
7
+ let _registered = !1;
13
8
 
14
9
  export function loadPoptip() {
15
- container.load(popTipModule);
10
+ _registered || (_registered = !0, contributionRegistry.register(InteractiveSubRenderContribution, new PopTipRenderContribution),
11
+ contributionRegistry.register(AutoEnablePlugins, new PopTipPlugin), contributionRegistry.register(AutoEnablePlugins, new PopTipForClipedTextPlugin));
16
12
  }
17
13
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,iBAAiB,EACjB,eAAe,EACf,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAChF,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,EAAE;QACtC,IAAI,CAAC,wBAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAC3D,IAAI,CAAC,gCAAgC,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;KAC5E;IACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAC1B,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KACjD;IACD,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE;QACvC,IAAI,CAAC,yBAAyB,CAAC,CAAC,MAAM,EAAE,CAAC;QACzC,IAAI,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;KAC9D;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,UAAU;IACxB,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAC/B,CAAC","file":"module.js","sourcesContent":["import {\n InteractiveSubRenderContribution,\n AutoEnablePlugins,\n ContainerModule,\n container\n} from '@visactor/vrender-core';\nimport { PopTipRenderContribution } from './contribution';\nimport { PopTipPlugin, PopTipForClipedTextPlugin } from './poptip-plugin';\n\nexport const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n if (!isBound(PopTipRenderContribution)) {\n bind(PopTipRenderContribution).toSelf().inSingletonScope();\n bind(InteractiveSubRenderContribution).toService(PopTipRenderContribution);\n }\n if (!isBound(PopTipPlugin)) {\n bind(PopTipPlugin).toSelf();\n bind(AutoEnablePlugins).toService(PopTipPlugin);\n }\n if (!isBound(PopTipForClipedTextPlugin)) {\n bind(PopTipForClipedTextPlugin).toSelf();\n bind(AutoEnablePlugins).toService(PopTipForClipedTextPlugin);\n }\n});\n\nexport function loadPoptip() {\n container.load(popTipModule);\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,MAAM,UAAU,UAAU;IACxB,IAAI,WAAW,EAAE;QACf,OAAO;KACR;IACD,WAAW,GAAG,IAAI,CAAC;IACnB,oBAAoB,CAAC,QAAQ,CAAC,gCAAgC,EAAE,IAAI,wBAAwB,EAAE,CAAC,CAAC;IAChG,oBAAoB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,YAAY,EAAE,CAAC,CAAC;IACrE,oBAAoB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,yBAAyB,EAAE,CAAC,CAAC;AACpF,CAAC","file":"module.js","sourcesContent":["import { InteractiveSubRenderContribution, AutoEnablePlugins, contributionRegistry } from '@visactor/vrender-core';\nimport { PopTipRenderContribution } from './contribution';\nimport { PopTipPlugin, PopTipForClipedTextPlugin } from './poptip-plugin';\n\nlet _registered = false;\nexport function loadPoptip() {\n if (_registered) {\n return;\n }\n _registered = true;\n contributionRegistry.register(InteractiveSubRenderContribution, new PopTipRenderContribution());\n contributionRegistry.register(AutoEnablePlugins, new PopTipPlugin());\n contributionRegistry.register(AutoEnablePlugins, new PopTipForClipedTextPlugin());\n}\n"]}
@@ -1,10 +1,4 @@
1
- var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
2
- var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
4
- return c > 3 && r && Object.defineProperty(target, key, r), r;
5
- };
6
-
7
- import { Generator, injectable } from "@visactor/vrender-core";
1
+ import { Generator } from "@visactor/vrender-core";
8
2
 
9
3
  export class PopTipPluginBase {
10
4
  constructor() {
@@ -38,17 +32,13 @@ export class PopTipPluginBase {
38
32
  }
39
33
  }
40
34
 
41
- let PopTipPlugin = class extends PopTipPluginBase {
35
+ export class PopTipPlugin extends PopTipPluginBase {
42
36
  constructor() {
43
37
  super(...arguments), this.name = "poptip", this.key = this.name + this._uid;
44
38
  }
45
- };
46
-
47
- PopTipPlugin = __decorate([ injectable() ], PopTipPlugin);
48
-
49
- export { PopTipPlugin };
39
+ }
50
40
 
51
- let PopTipForClipedTextPlugin = class extends PopTipPluginBase {
41
+ export class PopTipForClipedTextPlugin extends PopTipPluginBase {
52
42
  constructor() {
53
43
  super(...arguments), this.name = "poptipForText", this.key = this.name + this._uid,
54
44
  this.pointerlave = e => {
@@ -71,9 +61,5 @@ let PopTipForClipedTextPlugin = class extends PopTipPluginBase {
71
61
  const {stage: stage} = this.pluginService;
72
62
  super.deactivate(context), stage.removeEventListener("pointerleave", this.pointerlave);
73
63
  }
74
- };
75
-
76
- PopTipForClipedTextPlugin = __decorate([ injectable() ], PopTipForClipedTextPlugin);
77
-
78
- export { PopTipForClipedTextPlugin };
64
+ }
79
65
  //# sourceMappingURL=poptip-plugin.js.map
@@ -1 +1 @@
1
- {"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IAAI,CAAC,aAAa,CAAC;YACrC,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,EAAE;gBACtB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAClB;QACH,CAAC,CAAC;IAoBJ,CAAC;IAhCC,QAAQ,CAAC,OAAuB;QAC9B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QAErC,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAQD,QAAQ,CAAC,OAAiB;QACxB,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,MAAM;YACvB,CAAC,OAAO,CAAC,MAAM;YACf,OAAO,CAAC,WAAW;YACnB,CAAC,OAAO,CAAC,SAAS;YACjB,OAAe,CAAC,SAAS,CAAC,uBAAuB,CACnD,CAAC;IACJ,CAAC;IACD,QAAQ,CAAC,OAAiB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,OAAuB;QAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1B,KAAK,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AApCY,yBAAyB;IADrC,UAAU,EAAE;GACA,yBAAyB,CAoCrC;SApCY,yBAAyB","file":"poptip-plugin.js","sourcesContent":["import type { FederatedPointerEvent, IGraphic, IPlugin, IPluginService } from '@visactor/vrender-core';\nimport { Generator, injectable } from '@visactor/vrender-core';\n\n// _showPoptip: 0-没有,1-添加,2-删除\n\nexport abstract class PopTipPluginBase {\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n activeGraphic: IGraphic;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerover', this.poptip);\n }\n\n needHide(graphic: IGraphic) {\n return graphic.isContainer || !graphic.attribute;\n }\n\n needShow(graphic: IGraphic) {\n return !!(graphic.attribute as any).poptip;\n }\n\n poptip = (e: FederatedPointerEvent) => {\n const graphic = e.target as any;\n if (this.needHide(graphic)) {\n this.unpoptip(e);\n return;\n }\n // 触发graphic重绘\n if (graphic === this.activeGraphic) {\n return;\n }\n if (this.needShow(graphic)) {\n graphic.setAttributes({});\n graphic._showPoptip = 1;\n }\n\n if (this.activeGraphic) {\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n }\n // console.log(graphic)\n this.setActiveGraphic(graphic, true);\n };\n\n unpoptip = (e: FederatedPointerEvent) => {\n if (!this.activeGraphic) {\n return;\n }\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n this.setActiveGraphic(null, true);\n };\n\n setActiveGraphic(graphic: any | null, rerender?: boolean) {\n this.activeGraphic = graphic;\n // 触发重绘\n this.pluginService.stage.renderNextFrame();\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('pointerover', this.poptip);\n }\n}\n\n@injectable()\nexport class PopTipPlugin extends PopTipPluginBase implements IPlugin {\n name: 'poptip' = 'poptip';\n key: string = this.name + this._uid;\n}\n\n@injectable()\nexport class PopTipForClipedTextPlugin extends PopTipPluginBase implements IPlugin {\n name: 'poptipForText' = 'poptipForText';\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n super.activate(context);\n\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerleave', this.pointerlave);\n }\n pointerlave = (e: any) => {\n const { stage } = this.pluginService;\n if (e.target === stage) {\n this.unpoptip(e);\n }\n };\n\n needHide(graphic: IGraphic) {\n return (\n graphic.type !== 'text' ||\n !graphic.cliped ||\n graphic.isContainer ||\n !graphic.attribute ||\n (graphic as any).attribute.disableAutoClipedPoptip\n );\n }\n needShow(graphic: IGraphic): boolean {\n return true;\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n super.deactivate(context);\n stage.removeEventListener('pointerleave', this.pointerlave);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/poptip-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,OAAgB,gBAAgB;IAAtC;QACE,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAkB9C,WAAM,GAAG,CAAC,CAAwB,EAAE,EAAE;YACpC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAa,CAAC;YAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAC1B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACjB,OAAO;aACR;YAED,IAAI,OAAO,KAAK,IAAI,CAAC,aAAa,EAAE;gBAClC,OAAO;aACR;YACD,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAC1B,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBACzB,OAAe,CAAC,WAAW,GAAG,CAAC,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBACpC,IAAI,CAAC,aAAqB,CAAC,WAAW,GAAG,CAAC,CAAC;aAC7C;YAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,CAAwB,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;gBACvB,OAAO;aACR;YACD,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YACpC,IAAI,CAAC,aA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EAAE;YACvB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;YACrC,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,EAAE;gBACtB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAClB;QACH,CAAC,CAAC;IAoBJ,CAAC;IAhCC,QAAQ,CAAC,OAAuB;QAC9B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QAErC,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAQD,QAAQ,CAAC,OAAiB;QACxB,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,MAAM;YACvB,CAAC,OAAO,CAAC,MAAM;YACf,OAAO,CAAC,WAAW;YACnB,CAAC,OAAO,CAAC,SAAS;YACjB,OAAe,CAAC,SAAS,CAAC,uBAAuB,CACnD,CAAC;IACJ,CAAC;IACD,QAAQ,CAAC,OAAiB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,OAAuB;QAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1B,KAAK,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF","file":"poptip-plugin.js","sourcesContent":["import type { FederatedPointerEvent, IGraphic, IPlugin, IPluginService } from '@visactor/vrender-core';\nimport { Generator } from '@visactor/vrender-core';\n\n// _showPoptip: 0-没有,1-添加,2-删除\n\nexport abstract class PopTipPluginBase {\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n activeGraphic: IGraphic;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerover', this.poptip);\n }\n\n needHide(graphic: IGraphic) {\n return graphic.isContainer || !graphic.attribute;\n }\n\n needShow(graphic: IGraphic) {\n return !!(graphic.attribute as any).poptip;\n }\n\n poptip = (e: FederatedPointerEvent) => {\n const graphic = e.target as any;\n if (this.needHide(graphic)) {\n this.unpoptip(e);\n return;\n }\n // 触发graphic重绘\n if (graphic === this.activeGraphic) {\n return;\n }\n if (this.needShow(graphic)) {\n graphic.setAttributes({});\n (graphic as any)._showPoptip = 1;\n }\n\n if (this.activeGraphic) {\n this.activeGraphic.setAttributes({});\n (this.activeGraphic as any)._showPoptip = 2;\n }\n // console.log(graphic)\n this.setActiveGraphic(graphic, true);\n };\n\n unpoptip = (e: FederatedPointerEvent) => {\n if (!this.activeGraphic) {\n return;\n }\n this.activeGraphic.setAttributes({});\n (this.activeGraphic as any)._showPoptip = 2;\n this.setActiveGraphic(null, true);\n };\n\n setActiveGraphic(graphic: any | null, rerender?: boolean) {\n this.activeGraphic = graphic;\n // 触发重绘\n this.pluginService.stage.renderNextFrame();\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('pointerover', this.poptip);\n }\n}\n\nexport class PopTipPlugin extends PopTipPluginBase implements IPlugin {\n name: 'poptip' = 'poptip';\n key: string = this.name + this._uid;\n}\n\nexport class PopTipForClipedTextPlugin extends PopTipPluginBase implements IPlugin {\n name: 'poptipForText' = 'poptipForText';\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n super.activate(context);\n\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerleave', this.pointerlave);\n }\n pointerlave = (e: any) => {\n const { stage } = this.pluginService;\n if (e.target === stage) {\n this.unpoptip(e);\n }\n };\n\n needHide(graphic: IGraphic) {\n return (\n graphic.type !== 'text' ||\n !graphic.cliped ||\n graphic.isContainer ||\n !graphic.attribute ||\n (graphic as any).attribute.disableAutoClipedPoptip\n );\n }\n needShow(graphic: IGraphic): boolean {\n return true;\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n super.deactivate(context);\n stage.removeEventListener('pointerleave', this.pointerlave);\n }\n}\n"]}
@@ -4,6 +4,8 @@ import { DEFAULT_THEME, theme } from "./theme";
4
4
 
5
5
  import { registerGroup, registerRect, registerSymbol, registerText } from "@visactor/vrender-kits";
6
6
 
7
+ const _registered = !1;
8
+
7
9
  export function loadPoptipComponent() {
8
10
  registerGroup(), registerText(), registerSymbol(), registerRect();
9
11
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEnG,MAAM,UAAU,mBAAmB;IACjC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,kBAAoC;IACjE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;AACzD,CAAC","file":"register.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { PopTipAttributes } from './type';\nimport { DEFAULT_THEME, theme } from './theme';\nimport { registerGroup, registerRect, registerSymbol, registerText } from '@visactor/vrender-kits';\n\nexport function loadPoptipComponent() {\n registerGroup();\n registerText();\n registerSymbol();\n registerRect();\n}\n\nexport function setPoptipTheme(defaultPoptipTheme: PopTipAttributes) {\n merge(theme.poptip, DEFAULT_THEME, defaultPoptipTheme);\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEnG,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,UAAU,mBAAmB;IACjC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,kBAAoC;IACjE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;AACzD,CAAC","file":"register.js","sourcesContent":["import { InteractiveSubRenderContribution, AutoEnablePlugins } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { PopTipAttributes } from './type';\nimport { DEFAULT_THEME, theme } from './theme';\nimport { registerGroup, registerRect, registerSymbol, registerText } from '@visactor/vrender-kits';\n\nconst _registered = false;\nexport function loadPoptipComponent() {\n registerGroup();\n registerText();\n registerSymbol();\n registerRect();\n}\n\nexport function setPoptipTheme(defaultPoptipTheme: PopTipAttributes) {\n merge(theme.poptip, DEFAULT_THEME, defaultPoptipTheme);\n}\n"]}
@@ -1,3 +1 @@
1
- import { ContainerModule } from '@visactor/vrender-core';
2
- export declare const scrollbarModule: ContainerModule;
3
1
  export declare function loadScrollbar(): void;
@@ -1,12 +1,10 @@
1
- import { AutoEnablePlugins, ContainerModule, container } from "@visactor/vrender-core";
1
+ import { AutoEnablePlugins, contributionRegistry } from "@visactor/vrender-core";
2
2
 
3
3
  import { ScrollBarPlugin } from "./scrollbar-plugin";
4
4
 
5
- export const scrollbarModule = new ContainerModule(((bind, unbind, isBound, rebind) => {
6
- isBound(ScrollBarPlugin) || (bind(ScrollBarPlugin).toSelf(), bind(AutoEnablePlugins).toService(ScrollBarPlugin));
7
- }));
5
+ let _registered = !1;
8
6
 
9
7
  export function loadScrollbar() {
10
- container.load(scrollbarModule);
8
+ _registered || (_registered = !0, contributionRegistry.register(AutoEnablePlugins, new ScrollBarPlugin));
11
9
  }
12
10
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scrollbar/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACnF,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAC7B,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;KACpD;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,aAAa;IAC3B,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC","file":"module.js","sourcesContent":["import { AutoEnablePlugins, ContainerModule, container } from '@visactor/vrender-core';\nimport { ScrollBarPlugin } from './scrollbar-plugin';\n\nexport const scrollbarModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n if (!isBound(ScrollBarPlugin)) {\n bind(ScrollBarPlugin).toSelf();\n bind(AutoEnablePlugins).toService(ScrollBarPlugin);\n }\n});\n\nexport function loadScrollbar() {\n container.load(scrollbarModule);\n}\n"]}
1
+ {"version":3,"sources":["../src/scrollbar/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,MAAM,UAAU,aAAa;IAC3B,IAAI,WAAW,EAAE;QACf,OAAO;KACR;IACD,WAAW,GAAG,IAAI,CAAC;IACnB,oBAAoB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,eAAe,EAAE,CAAC,CAAC;AAC1E,CAAC","file":"module.js","sourcesContent":["import { AutoEnablePlugins, contributionRegistry } from '@visactor/vrender-core';\nimport { ScrollBarPlugin } from './scrollbar-plugin';\n\nlet _registered = false;\nexport function loadScrollbar() {\n if (_registered) {\n return;\n }\n _registered = true;\n contributionRegistry.register(AutoEnablePlugins, new ScrollBarPlugin());\n}\n"]}
@@ -1,10 +1,4 @@
1
- var ScrollBarPlugin_1, __decorate = this && this.__decorate || function(decorators, target, key, desc) {
2
- var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
4
- return c > 3 && r && Object.defineProperty(target, key, r), r;
5
- };
6
-
7
- import { Generator, injectable } from "@visactor/vrender-core";
1
+ import { Generator } from "@visactor/vrender-core";
8
2
 
9
3
  import { ScrollBar } from "./scrollbar";
10
4
 
@@ -12,7 +6,7 @@ import { AABBBounds, abs, Bounds } from "@visactor/vutils";
12
6
 
13
7
  import { SCROLLBAR_EVENT } from "../constant";
14
8
 
15
- let ScrollBarPlugin = ScrollBarPlugin_1 = class {
9
+ export class ScrollBarPlugin {
16
10
  constructor() {
17
11
  this.name = "scrollbar", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
18
12
  this.key = this.name + this._uid, this.scroll = e => {
@@ -64,7 +58,7 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class {
64
58
  this.pluginService = context;
65
59
  const {stage: stage} = this.pluginService;
66
60
  this.childrenBounds = new AABBBounds, stage.addEventListener("wheel", this.scroll),
67
- this.params = ScrollBarPlugin_1.defaultParams;
61
+ this.params = ScrollBarPlugin.defaultParams;
68
62
  }
69
63
  initEventOfScrollbar(scrollContainer, scrollbar, isHorozntal) {
70
64
  scrollContainer.addEventListener("pointerover", (() => {
@@ -165,11 +159,9 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class {
165
159
  const {stage: stage} = this.pluginService;
166
160
  stage.removeEventListener("wheel", this.scroll);
167
161
  }
168
- };
162
+ }
169
163
 
170
164
  ScrollBarPlugin.defaultParams = {
171
165
  timeout: 500
172
- }, ScrollBarPlugin = ScrollBarPlugin_1 = __decorate([ injectable() ], ScrollBarPlugin);
173
-
174
- export { ScrollBarPlugin };
166
+ };
175
167
  //# sourceMappingURL=scrollbar-plugin.js.map