@visactor/vrender-components 0.16.3 → 0.16.5-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 (83) hide show
  1. package/cjs/axis/base.d.ts +2 -1
  2. package/cjs/axis/base.js +4 -1
  3. package/cjs/axis/base.js.map +1 -1
  4. package/cjs/axis/circle.d.ts +6 -1
  5. package/cjs/axis/circle.js +6 -3
  6. package/cjs/axis/circle.js.map +1 -1
  7. package/cjs/axis/util.d.ts +8 -0
  8. package/cjs/axis/util.js +34 -0
  9. package/cjs/axis/util.js.map +1 -0
  10. package/cjs/brush/type.d.ts +1 -1
  11. package/cjs/brush/type.js.map +1 -1
  12. package/cjs/checkbox/index.js +1 -2
  13. package/cjs/checkbox/type.js +2 -1
  14. package/cjs/data-zoom/config.d.ts +6 -0
  15. package/cjs/data-zoom/config.js +6 -0
  16. package/cjs/data-zoom/config.js.map +1 -1
  17. package/cjs/data-zoom/data-zoom.d.ts +16 -8
  18. package/cjs/data-zoom/data-zoom.js +54 -49
  19. package/cjs/data-zoom/data-zoom.js.map +1 -1
  20. package/cjs/data-zoom/type.d.ts +10 -5
  21. package/cjs/data-zoom/type.js.map +1 -1
  22. package/cjs/index.d.ts +1 -1
  23. package/cjs/index.js +1 -1
  24. package/cjs/index.js.map +1 -1
  25. package/cjs/indicator/config.js +1 -2
  26. package/cjs/indicator/index.js +2 -1
  27. package/cjs/interface.d.ts +1 -0
  28. package/cjs/interface.js.map +1 -1
  29. package/cjs/label/base.js +17 -15
  30. package/cjs/label/base.js.map +1 -1
  31. package/cjs/label/util.js +1 -2
  32. package/cjs/legend/base.js +2 -1
  33. package/cjs/marker/area.js +1 -1
  34. package/cjs/scrollbar/scrollbar.d.ts +4 -0
  35. package/cjs/scrollbar/scrollbar.js +33 -17
  36. package/cjs/scrollbar/scrollbar.js.map +1 -1
  37. package/cjs/scrollbar/type.d.ts +4 -1
  38. package/cjs/scrollbar/type.js.map +1 -1
  39. package/cjs/slider/slider.js +10 -14
  40. package/cjs/slider/slider.js.map +1 -1
  41. package/dist/index.js +213 -102
  42. package/dist/index.min.js +1 -1
  43. package/es/axis/base.d.ts +2 -1
  44. package/es/axis/base.js +4 -1
  45. package/es/axis/base.js.map +1 -1
  46. package/es/axis/circle.d.ts +6 -1
  47. package/es/axis/circle.js +7 -2
  48. package/es/axis/circle.js.map +1 -1
  49. package/es/axis/util.d.ts +8 -0
  50. package/es/axis/util.js +28 -0
  51. package/es/axis/util.js.map +1 -0
  52. package/es/brush/type.d.ts +1 -1
  53. package/es/brush/type.js.map +1 -1
  54. package/es/checkbox/index.js +1 -2
  55. package/es/checkbox/type.js +2 -1
  56. package/es/data-zoom/config.d.ts +6 -0
  57. package/es/data-zoom/config.js +6 -0
  58. package/es/data-zoom/config.js.map +1 -1
  59. package/es/data-zoom/data-zoom.d.ts +16 -8
  60. package/es/data-zoom/data-zoom.js +55 -49
  61. package/es/data-zoom/data-zoom.js.map +1 -1
  62. package/es/data-zoom/type.d.ts +10 -5
  63. package/es/data-zoom/type.js.map +1 -1
  64. package/es/index.d.ts +1 -1
  65. package/es/index.js +1 -1
  66. package/es/index.js.map +1 -1
  67. package/es/indicator/config.js +1 -2
  68. package/es/indicator/index.js +2 -1
  69. package/es/interface.d.ts +1 -0
  70. package/es/interface.js.map +1 -1
  71. package/es/label/base.js +16 -14
  72. package/es/label/base.js.map +1 -1
  73. package/es/label/util.js +1 -2
  74. package/es/legend/base.js +2 -1
  75. package/es/marker/area.js +1 -1
  76. package/es/scrollbar/scrollbar.d.ts +4 -0
  77. package/es/scrollbar/scrollbar.js +35 -17
  78. package/es/scrollbar/scrollbar.js.map +1 -1
  79. package/es/scrollbar/type.d.ts +4 -1
  80. package/es/scrollbar/type.js.map +1 -1
  81. package/es/slider/slider.js +10 -14
  82. package/es/slider/slider.js.map +1 -1
  83. package/package.json +5 -5
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,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,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.3\";\n\nexport * from './core/base';\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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
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,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,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.5-alpha.0\";\n\nexport * from './core/base';\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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
@@ -21,5 +21,4 @@ export const DEFAULT_INDICATOR_THEME = {
21
21
  textAlign: "center"
22
22
  }
23
23
  }
24
- };
25
- //# sourceMappingURL=config.js.map
24
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./indicator";
2
2
 
3
- export * from "./type";
3
+ export * from "./type";
4
+ //# sourceMappingURL=index.js.map
package/es/interface.d.ts CHANGED
@@ -4,3 +4,4 @@ export type OrientType = 'top' | 'right' | 'bottom' | 'left';
4
4
  export type BackgroundAttributes = {
5
5
  visible: boolean;
6
6
  } & Partial<IRectGraphicAttribute>;
7
+ export type IDelayType = 'debounce' | 'throttle';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectGraphicAttribute } from '@visactor/vrender-core';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n"]}
1
+ {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectGraphicAttribute } from '@visactor/vrender-core';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IDelayType = 'debounce' | 'throttle';\n"]}
package/es/label/base.js CHANGED
@@ -57,7 +57,7 @@ export class LabelBase extends AbstractComponent {
57
57
  labeling(textBounds, graphicBounds, position, offset) {}
58
58
  _labelLine(text) {}
59
59
  render() {
60
- if (this._prepare(), this._isCollectionBase && isNil(this._idToPoint) || !this._isCollectionBase && isNil(this._idToGraphic)) return;
60
+ if (this._prepare(), isNil(this._idToGraphic) || this._isCollectionBase && isNil(this._idToPoint)) return;
61
61
  const {overlap: overlap, smartInvert: smartInvert, dataFilter: dataFilter, customLayoutFunc: customLayoutFunc, customOverlapFunc: customOverlapFunc} = this.attribute;
62
62
  let labels, data = this.attribute.data;
63
63
  isFunction(dataFilter) && (data = dataFilter(data)), labels = isFunction(customLayoutFunc) ? customLayoutFunc(data, this.getRelatedGrphic, this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(data),
@@ -96,25 +96,27 @@ export class LabelBase extends AbstractComponent {
96
96
  this._baseMarks = currentBaseMarks, this._isCollectionBase = "line" === (null === (_c = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _c ? void 0 : _c.type) || "area" === (null === (_d = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _d ? void 0 : _d.type),
97
97
  !currentBaseMarks || 0 === currentBaseMarks.length) return;
98
98
  const {data: data} = this.attribute;
99
- if (data && 0 !== data.length) if (this._isCollectionBase) {
99
+ if (data && 0 !== data.length) if (this._idToGraphic || (this._idToGraphic = new Map),
100
+ this._isCollectionBase) {
100
101
  this._idToPoint || (this._idToPoint = new Map);
101
- const baseMark = currentBaseMarks[0], points = getPointsOfLineArea(baseMark);
102
- if (null == points ? void 0 : points.length) for (let i = 0; i < points.length; i++) {
103
- const textData = data[i];
104
- textData && points[i] && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`),
105
- this._idToPoint.set(textData.id, points[i]));
106
- }
107
- } else {
108
- this._idToGraphic || (this._idToGraphic = new Map);
102
+ let cur = 0;
109
103
  for (let i = 0; i < currentBaseMarks.length; i++) {
110
- const textData = data[i], baseMark = currentBaseMarks[i];
111
- textData && baseMark && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`),
112
- this._idToGraphic.set(textData.id, baseMark));
104
+ const baseMark = currentBaseMarks[i], points = getPointsOfLineArea(baseMark);
105
+ if (null == points ? void 0 : points.length) for (let j = 0; j < points.length; j++) {
106
+ const textData = data[cur];
107
+ textData && points[j] && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${cur}`),
108
+ this._idToPoint.set(textData.id, points[j]), this._idToGraphic.set(textData.id, baseMark)),
109
+ cur++;
110
+ }
113
111
  }
112
+ } else for (let i = 0; i < currentBaseMarks.length; i++) {
113
+ const textData = data[i], baseMark = currentBaseMarks[i];
114
+ textData && baseMark && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`),
115
+ this._idToGraphic.set(textData.id, baseMark));
114
116
  }
115
117
  }
116
118
  getRelatedGrphic(item) {
117
- return this._isCollectionBase ? this._baseMarks[0] : this._idToGraphic.get(item.id);
119
+ return this._idToGraphic.get(item.id);
118
120
  }
119
121
  _layout(data = []) {
120
122
  const {textStyle: textStyle = {}, position: position, offset: offset} = this.attribute, labels = [];
@@ -1 +1 @@
1
- {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,\n IText,\n FederatedPointerEvent,\n IColor,\n ILine,\n IArea\n} from '@visactor/vrender-core';\nimport { createText, IncreaseCount, AttributeUpdateType, IContainPointMode } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike, IPointLike } from '@visactor/vutils';\nimport {\n isFunction,\n isValidNumber,\n isEmpty,\n isValid,\n isString,\n merge,\n isRectIntersect,\n isNil,\n isArray\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\nimport { getPointsOfLineArea } from './util';\n\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _isCollectionBase: boolean;\n\n protected _bitmap?: Bitmap;\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, { text: IText; labelLine?: ILine }>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n protected _idToPoint: Map<string, IPointLike>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs) {\n super(merge({}, LabelBase.defaultAttributes, attributes));\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _labelLine(text: IText): ILine | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected render() {\n this._prepare();\n\n if ((this._isCollectionBase && isNil(this._idToPoint)) || (!this._isCollectionBase && isNil(this._idToGraphic))) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n let labels: IText[];\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(\n data,\n this.getRelatedGrphic,\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(data);\n }\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(\n labels as Text[],\n this.getRelatedGrphic,\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\n }\n\n if (smartInvert !== false) {\n this._smartInvert(labels);\n }\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStatesOfText(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _setStatesOfLabelLine(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.labelLineState;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStatesOfText(text);\n return text;\n }\n\n private _prepare() {\n const currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._idToPoint?.clear();\n this._baseMarks = currentBaseMarks;\n this._isCollectionBase = currentBaseMarks?.[0]?.type === 'line' || currentBaseMarks?.[0]?.type === 'area';\n\n if (!currentBaseMarks || currentBaseMarks.length === 0) {\n return;\n }\n\n const { data } = this.attribute;\n\n if (!data || data.length === 0) {\n return;\n }\n\n // generate id mapping before data filter\n if (this._isCollectionBase) {\n if (!this._idToPoint) {\n this._idToPoint = new Map();\n }\n const baseMark = currentBaseMarks[0];\n const points = getPointsOfLineArea(baseMark as ILine | IArea);\n\n if (points?.length) {\n for (let i = 0; i < points.length; i++) {\n const textData = data[i];\n if (textData && points[i]) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToPoint.set(textData.id, points[i]);\n }\n }\n }\n } else {\n if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const textData = data[i];\n const baseMark = currentBaseMarks[i] as IGraphic;\n if (textData && baseMark) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToGraphic.set(textData.id, baseMark);\n }\n }\n }\n }\n\n protected getRelatedGrphic(item: LabelItem) {\n return this._isCollectionBase ? this._baseMarks[0] : this._idToGraphic.get(item.id);\n }\n\n protected _layout(data: LabelItem[] = []): IText[] {\n const { textStyle = {}, position, offset } = this.attribute;\n const labels = [];\n\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this.getRelatedGrphic(textData);\n\n const labelAttribute = {\n fill: this._isCollectionBase\n ? isArray(baseMark.attribute.stroke)\n ? baseMark.attribute.stroke.find(entry => !!entry && entry !== true)\n : baseMark.attribute.stroke\n : baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n const textBounds = this.getGraphicBounds(text);\n const graphicBounds = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get(textData.id))\n : this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number });\n\n const textLocation = this.labeling(\n textBounds,\n graphicBounds,\n isFunction(position) ? position(textData) : position,\n offset\n );\n\n if (textLocation) {\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n text.setAttributes(textLocation);\n }\n\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _overlapping(labels: IText[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = this.attribute.overlap as OverlapAttrs;\n\n const result: IText[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n\n const text = labels[i] as IText;\n const baseMark = this.getRelatedGrphic(text.attribute);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((labels[i].attribute as any).id))\n : this.getGraphicBounds(baseMark, labels[i].attribute),\n this.labeling\n );\n if (hasPlace !== false) {\n text.setAttributes({ x: hasPlace.x, y: hasPlace.y });\n result.push(text);\n break;\n }\n }\n\n // 尝试向内挤压\n if (!hasPlace && clampForce) {\n const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);\n if (\n !(dx === 0 && dy === 0) &&\n canPlace(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n },\n undefined,\n overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: IText[]) {\n const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;\n\n if (disableAnimation) {\n this._renderWithOutAnimation(labels);\n } else {\n this._renderWithAnimation(labels);\n }\n }\n\n protected _renderWithAnimation(labels: IText[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach((text, index) => {\n const labelLine: ILine = this._labelLine(text);\n const relatedGraphic = this.getRelatedGrphic(text.attribute);\n const textId = (text.attribute as LabelItem).id;\n const textKey = this._isCollectionBase ? textId : relatedGraphic;\n const state = prevTextMap?.get(textKey) ? 'update' : 'enter';\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n if (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n\n if (labelLine) {\n this._setStatesOfLabelLine(labelLine);\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n relatedGraphic.once('animate-bind', a => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n const prevText = prevLabel.text;\n prevText.animate().to(text.attribute, duration, easing);\n if (prevLabel.labelLine) {\n prevLabel.labelLine.animate().to(\n merge({}, prevLabel.labelLine.attribute, {\n visible:\n ((text.attribute as ArcLabelAttrs)?.line?.visible && text.attribute?.visible) ??\n text.attribute?.visible ??\n true,\n points: (text.attribute as ArcLabelAttrs)?.points\n }),\n duration,\n easing\n );\n }\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n }\n });\n prevTextMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _renderWithOutAnimation(labels: IText[]) {\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach(text => {\n const labelLine = this._labelLine(text);\n const relatedGraphic = this.getRelatedGrphic(text.attribute);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n const textKey = this._isCollectionBase ? (text.attribute as LabelItem).id : relatedGraphic;\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n prevLabel.text.setAttributes(text.attribute);\n if (prevLabel?.labelLine) {\n prevLabel.labelLine.setAttributes({ points: (text.attribute as ArcLabelAttrs)?.points });\n }\n }\n });\n\n prevTextMap.forEach(label => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _handleRelatedGraphicSetState = (e: any) => {\n if (e.detail?.type === AttributeUpdateType.STATE) {\n const currentStates = e.target?.currentStates ?? [];\n const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];\n\n labels.forEach(label => {\n if (label) {\n if (label.text) {\n label.text.useStates(currentStates);\n }\n\n if (label.labelLine) {\n label.labelLine.useStates(currentStates);\n }\n }\n });\n }\n };\n\n protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic) {\n if (this.attribute.syncState) {\n relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);\n }\n }\n\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText,\n texts: IText[],\n index: number,\n relatedGraphic: IGraphic,\n { mode, duration, easing, to, delay }: ILabelAnimation & { to: any }\n ) {\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n\n const isValidAnimateState =\n detail &&\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n detail.animationState &&\n detail.animationState.step?.type !== 'wait';\n\n if (!isValidAnimateState) {\n return {};\n }\n\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n return;\n }\n\n const onEnd = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onEnd }).wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n if (this._isCollectionBase) {\n const point = this._idToPoint.get((text.attribute as LabelItem).id);\n\n if (\n point &&\n (!text.animates || !text.animates.has('label-animate')) &&\n this._baseMarks[0].containsPoint(point.x, point.y, IContainPointMode.LOCAL, this.stage?.pickerService)\n ) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n } else if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: IText[]) {\n const option = (this.attribute.smartInvert || {}) as SmartInvertAttrs;\n const { textType, contrastRatiosThreshold, alternativeColors } = option;\n const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this.getRelatedGrphic(label.attribute as LabelItem);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * series(baseMark色),\n * invertSeries(执行智能反色),\n * similarSeries(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n const baseColor = backgroundColor;\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n\n if (outsideEnable) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n if (isInside) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n )\n });\n continue;\n }\n\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/label/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3G,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,eAAe,EACf,KAAK,EACL,OAAO,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,OAAO,SAAoC,SAAQ,iBAAoB;IAuB3E,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAGD,aAAa,CAAC,OAAsC;QAClD,IAAI,CAAC,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gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;;AAv1BM,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QAIZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type {\n IGroup,\n Text,\n IGraphic,\n IText,\n FederatedPointerEvent,\n IColor,\n ILine,\n IArea\n} from '@visactor/vrender-core';\nimport { createText, IncreaseCount, AttributeUpdateType, IContainPointMode } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike, IPointLike } from '@visactor/vutils';\nimport {\n isFunction,\n isValidNumber,\n isEmpty,\n isValid,\n isString,\n merge,\n isRectIntersect,\n isNil,\n isArray\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\nimport { getPointsOfLineArea } from './util';\n\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _isCollectionBase: boolean;\n\n protected _bitmap?: Bitmap;\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, { text: IText; labelLine?: ILine }>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n protected _idToPoint: Map<string, IPointLike>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs) {\n super(merge({}, LabelBase.defaultAttributes, attributes));\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _labelLine(text: IText): ILine | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected render() {\n this._prepare();\n\n if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n let labels: IText[];\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(\n data,\n this.getRelatedGrphic,\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(data);\n }\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(\n labels as Text[],\n this.getRelatedGrphic,\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\n }\n\n if (smartInvert !== false) {\n this._smartInvert(labels);\n }\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStatesOfText(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _setStatesOfLabelLine(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.labelLineState;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStatesOfText(text);\n return text;\n }\n\n private _prepare() {\n const currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._idToPoint?.clear();\n this._baseMarks = currentBaseMarks;\n this._isCollectionBase = currentBaseMarks?.[0]?.type === 'line' || currentBaseMarks?.[0]?.type === 'area';\n\n if (!currentBaseMarks || currentBaseMarks.length === 0) {\n return;\n }\n\n const { data } = this.attribute;\n\n if (!data || data.length === 0) {\n return;\n }\n if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n\n // generate id mapping before data filter\n if (this._isCollectionBase) {\n if (!this._idToPoint) {\n this._idToPoint = new Map();\n }\n let cur = 0;\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const baseMark = currentBaseMarks[i];\n const points = getPointsOfLineArea(baseMark as ILine | IArea);\n\n if (points?.length) {\n for (let j = 0; j < points.length; j++) {\n const textData = data[cur];\n if (textData && points[j]) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${cur}`;\n }\n this._idToPoint.set(textData.id, points[j]);\n this._idToGraphic.set(textData.id, baseMark);\n }\n\n cur++;\n }\n }\n }\n } else {\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const textData = data[i];\n const baseMark = currentBaseMarks[i] as IGraphic;\n if (textData && baseMark) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToGraphic.set(textData.id, baseMark);\n }\n }\n }\n }\n\n protected getRelatedGrphic(item: LabelItem) {\n return this._idToGraphic.get(item.id);\n }\n\n protected _layout(data: LabelItem[] = []): IText[] {\n const { textStyle = {}, position, offset } = this.attribute;\n const labels = [];\n\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this.getRelatedGrphic(textData);\n\n const labelAttribute = {\n fill: this._isCollectionBase\n ? isArray(baseMark.attribute.stroke)\n ? baseMark.attribute.stroke.find(entry => !!entry && entry !== true)\n : baseMark.attribute.stroke\n : baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n const textBounds = this.getGraphicBounds(text);\n const graphicBounds = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get(textData.id))\n : this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number });\n\n const textLocation = this.labeling(\n textBounds,\n graphicBounds,\n isFunction(position) ? position(textData) : position,\n offset\n );\n\n if (textLocation) {\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n text.setAttributes(textLocation);\n }\n\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _overlapping(labels: IText[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = this.attribute.overlap as OverlapAttrs;\n\n const result: IText[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n\n const text = labels[i] as IText;\n const baseMark = this.getRelatedGrphic(text.attribute);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((labels[i].attribute as any).id))\n : this.getGraphicBounds(baseMark, labels[i].attribute),\n this.labeling\n );\n if (hasPlace !== false) {\n text.setAttributes({ x: hasPlace.x, y: hasPlace.y });\n result.push(text);\n break;\n }\n }\n\n // 尝试向内挤压\n if (!hasPlace && clampForce) {\n const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);\n if (\n !(dx === 0 && dy === 0) &&\n canPlace(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n },\n undefined,\n overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: IText[]) {\n const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;\n\n if (disableAnimation) {\n this._renderWithOutAnimation(labels);\n } else {\n this._renderWithAnimation(labels);\n }\n }\n\n protected _renderWithAnimation(labels: IText[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach((text, index) => {\n const labelLine: ILine = this._labelLine(text);\n const relatedGraphic = this.getRelatedGrphic(text.attribute);\n const textId = (text.attribute as LabelItem).id;\n const textKey = this._isCollectionBase ? textId : relatedGraphic;\n const state = prevTextMap?.get(textKey) ? 'update' : 'enter';\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n if (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n\n if (labelLine) {\n this._setStatesOfLabelLine(labelLine);\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n relatedGraphic.once('animate-bind', a => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n const prevText = prevLabel.text;\n prevText.animate().to(text.attribute, duration, easing);\n if (prevLabel.labelLine) {\n prevLabel.labelLine.animate().to(\n merge({}, prevLabel.labelLine.attribute, {\n visible:\n ((text.attribute as ArcLabelAttrs)?.line?.visible && text.attribute?.visible) ??\n text.attribute?.visible ??\n true,\n points: (text.attribute as ArcLabelAttrs)?.points\n }),\n duration,\n easing\n );\n }\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n }\n });\n prevTextMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _renderWithOutAnimation(labels: IText[]) {\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach(text => {\n const labelLine = this._labelLine(text);\n const relatedGraphic = this.getRelatedGrphic(text.attribute);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n const textKey = this._isCollectionBase ? (text.attribute as LabelItem).id : relatedGraphic;\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n prevLabel.text.setAttributes(text.attribute);\n if (prevLabel?.labelLine) {\n prevLabel.labelLine.setAttributes({ points: (text.attribute as ArcLabelAttrs)?.points });\n }\n }\n });\n\n prevTextMap.forEach(label => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _handleRelatedGraphicSetState = (e: any) => {\n if (e.detail?.type === AttributeUpdateType.STATE) {\n const currentStates = e.target?.currentStates ?? [];\n const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];\n\n labels.forEach(label => {\n if (label) {\n if (label.text) {\n label.text.useStates(currentStates);\n }\n\n if (label.labelLine) {\n label.labelLine.useStates(currentStates);\n }\n }\n });\n }\n };\n\n protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic) {\n if (this.attribute.syncState) {\n relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);\n }\n }\n\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText,\n texts: IText[],\n index: number,\n relatedGraphic: IGraphic,\n { mode, duration, easing, to, delay }: ILabelAnimation & { to: any }\n ) {\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n\n const isValidAnimateState =\n detail &&\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n detail.animationState &&\n detail.animationState.step?.type !== 'wait';\n\n if (!isValidAnimateState) {\n return {};\n }\n\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n return;\n }\n\n const onEnd = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onEnd }).wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n if (this._isCollectionBase) {\n const point = this._idToPoint.get((text.attribute as LabelItem).id);\n\n if (\n point &&\n (!text.animates || !text.animates.has('label-animate')) &&\n this._baseMarks[0].containsPoint(point.x, point.y, IContainPointMode.LOCAL, this.stage?.pickerService)\n ) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n } else if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: IText[]) {\n const option = (this.attribute.smartInvert || {}) as SmartInvertAttrs;\n const { textType, contrastRatiosThreshold, alternativeColors } = option;\n const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this.getRelatedGrphic(label.attribute as LabelItem);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * series(baseMark色),\n * invertSeries(执行智能反色),\n * similarSeries(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n const baseColor = backgroundColor;\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n\n if (outsideEnable) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n if (isInside) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n )\n });\n continue;\n }\n\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
package/es/label/util.js CHANGED
@@ -153,5 +153,4 @@ export const getPointsOfLineArea = graphic => {
153
153
  })), res;
154
154
  }
155
155
  return points;
156
- };
157
- //# sourceMappingURL=util.js.map
156
+ };
package/es/legend/base.js CHANGED
@@ -52,4 +52,5 @@ export class LegendBase extends AbstractComponent {
52
52
  "center" === align ? this._title.setAttribute("x", (innerViewWidth - titleWidth) / 2) : "end" === align && this._title.setAttribute("x", innerViewWidth - titleWidth);
53
53
  }
54
54
  }
55
- }
55
+ }
56
+ //# sourceMappingURL=base.js.map
package/es/marker/area.js CHANGED
@@ -78,4 +78,4 @@ export class MarkArea extends Marker {
78
78
  }
79
79
 
80
80
  MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
81
- //# sourceMappingURL=area.js.map
81
+ //# sourceMappingURL=area.js.map
@@ -14,6 +14,9 @@ export declare class ScrollBar extends AbstractComponent<Required<ScrollBarAttri
14
14
  };
15
15
  padding: number;
16
16
  scrollRange: number[];
17
+ delayType: string;
18
+ delayTime: number;
19
+ realTime: boolean;
17
20
  };
18
21
  private _container;
19
22
  private _slider;
@@ -34,6 +37,7 @@ export declare class ScrollBar extends AbstractComponent<Required<ScrollBarAttri
34
37
  private _getScrollRange;
35
38
  private _onRailPointerDown;
36
39
  private _onSliderPointerDown;
40
+ private _computeScrollValue;
37
41
  private _onSliderPointerMove;
38
42
  private _onSliderPointerUp;
39
43
  private _onChange;
@@ -1,9 +1,14 @@
1
1
  import { CustomEvent, vglobal } from "@visactor/vrender-core";
2
2
 
3
- import { merge, normalizePadding, clamp, clampRange } from "@visactor/vutils";
3
+ import { merge, normalizePadding, clamp, clampRange, debounce, throttle } from "@visactor/vutils";
4
4
 
5
5
  import { AbstractComponent } from "../core/base";
6
6
 
7
+ const delayMap = {
8
+ debounce: debounce,
9
+ throttle: throttle
10
+ };
11
+
7
12
  export class ScrollBar extends AbstractComponent {
8
13
  constructor(attributes) {
9
14
  super(merge({}, ScrollBar.defaultAttributes, attributes)), this.name = "scrollbar",
@@ -25,35 +30,43 @@ export class ScrollBar extends AbstractComponent {
25
30
  const {direction: direction} = this.attribute;
26
31
  this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMove, {
27
32
  capture: !0
28
- }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove, {
33
+ }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.addEventListener("pointermove", this._onSliderPointerMove, {
29
34
  capture: !0
30
- }), this._slider.addEventListener("pointerup", this._onSliderPointerUp), this._slider.addEventListener("pointerupoutside", this._onSliderPointerUp));
31
- }, this._onSliderPointerMove = e => {
32
- e.stopPropagation();
35
+ }), this.stage.addEventListener("pointerup", this._onSliderPointerUp), this.stage.addEventListener("pointerupoutside", this._onSliderPointerUp));
36
+ }, this._computeScrollValue = e => {
33
37
  const {direction: direction} = this.attribute;
34
38
  let currentScrollValue, currentPos, delta = 0;
35
- const preScrollRange = this.getScrollRange(), {width: width, height: height} = this._getSliderRenderBounds();
36
- "vertical" === direction ? (currentPos = e.clientY, delta = currentPos - this._prePos,
39
+ const {width: width, height: height} = this._getSliderRenderBounds();
40
+ return "vertical" === direction ? (currentPos = e.clientY, delta = currentPos - this._prePos,
37
41
  currentScrollValue = delta / height) : (currentPos = e.clientX, delta = currentPos - this._prePos,
38
- currentScrollValue = delta / width), this.setScrollRange([ preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue ], !0),
42
+ currentScrollValue = delta / width), [ currentPos, currentScrollValue ];
43
+ }, this._onSliderPointerMove = delayMap[this.attribute.delayType]((e => {
44
+ e.stopPropagation();
45
+ const preScrollRange = this.getScrollRange(), [currentPos, currentScrollValue] = this._computeScrollValue(e);
46
+ this.setScrollRange([ preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue ], !0),
39
47
  this._prePos = currentPos;
40
- }, this._onSliderPointerUp = e => {
41
- e.preventDefault(), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMove, {
48
+ }), this.attribute.delayTime), this._onSliderPointerUp = e => {
49
+ e.preventDefault();
50
+ const {realTime: realTime = !0, range: preRange, limitRange: limitRange = [ 0, 1 ]} = this.attribute, preScrollRange = this.getScrollRange(), [currentPos, currentScrollValue] = this._computeScrollValue(e), range = [ preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue ];
51
+ realTime || this._onChange({
52
+ pre: preRange,
53
+ value: clampRange(range, limitRange[0], limitRange[1])
54
+ }), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMove, {
42
55
  capture: !0
43
- }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.removeEventListener("pointermove", this._onSliderPointerMove, {
56
+ }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.removeEventListener("pointermove", this._onSliderPointerMove, {
44
57
  capture: !0
45
- }), this._slider.removeEventListener("pointerup", this._onSliderPointerUp), this._slider.removeEventListener("pointerupoutside", this._onSliderPointerUp));
58
+ }), this.stage.removeEventListener("pointerup", this._onSliderPointerUp), this.stage.removeEventListener("pointerupoutside", this._onSliderPointerUp));
46
59
  };
47
60
  }
48
61
  setScrollRange(range, render = !0) {
49
62
  var _a, _b;
50
- const {direction: direction = "horizontal", limitRange: limitRange = [ 0, 1 ], range: preRange} = this.attribute, currScrollRange = clampRange(range, limitRange[0], limitRange[1]);
63
+ const {direction: direction = "horizontal", limitRange: limitRange = [ 0, 1 ], range: preRange, realTime: realTime = !0} = this.attribute, currScrollRange = clampRange(range, limitRange[0], limitRange[1]);
51
64
  if (render) {
52
65
  const sliderPos = this._getSliderPos(currScrollRange);
53
66
  this._slider && ("horizontal" === direction ? this._slider.setAttribute("x", sliderPos[0], !0) : this._slider.setAttribute("y", sliderPos[0], !0),
54
67
  (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.autoRender) || null === (_b = this.stage) || void 0 === _b || _b.renderNextFrame());
55
68
  }
56
- this.attribute.range = currScrollRange, this._onChange({
69
+ this.attribute.range = currScrollRange, realTime && this._onChange({
57
70
  pre: preRange,
58
71
  value: currScrollRange
59
72
  });
@@ -62,8 +75,10 @@ export class ScrollBar extends AbstractComponent {
62
75
  return this.attribute.range;
63
76
  }
64
77
  bindEvents() {
65
- this.attribute.disableTriggerEvent || (this._rail && this._rail.addEventListener("pointerdown", this._onRailPointerDown),
66
- this._slider && this._slider.addEventListener("pointerdown", this._onSliderPointerDown));
78
+ if (this.attribute.disableTriggerEvent) return;
79
+ const {delayType: delayType = "throttle", delayTime: delayTime = 0} = this.attribute;
80
+ this._rail && this._rail.addEventListener("pointerdown", delayMap[delayType](this._onRailPointerDown, delayTime)),
81
+ this._slider && this._slider.addEventListener("pointerdown", this._onSliderPointerDown);
67
82
  }
68
83
  render() {
69
84
  this._reset();
@@ -151,6 +166,9 @@ ScrollBar.defaultAttributes = {
151
166
  fill: "rgba(0, 0, 0, .0)"
152
167
  },
153
168
  padding: 2,
154
- scrollRange: [ 0, 1 ]
169
+ scrollRange: [ 0, 1 ],
170
+ delayType: "throttle",
171
+ delayTime: 0,
172
+ realTime: !0
155
173
  };
156
174
  //# sourceMappingURL=scrollbar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scrollbar/scrollbar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAajD,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAgC7E,YAAY,UAA+B;QACzC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhC5D,SAAI,GAAG,WAAW,CAAC;QAyNX,uBAAkB,GAAG,CAAC,CAAwB,EAAE,EAAE;;YAGxD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAC3B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;YAClF,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1C,IAAI,kBAAkB,CAAC;YACvB,IAAI,SAAS,KAAK,UAAU,EAAE;gBAC5B,MAAM,SAAS,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sB,EAAE,CAAC;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QAEpC,OAAO,SAAS,KAAK,YAAY;YAC/B,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,EAAE,GAAG,GAAG,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,GAAG,UAAU,CAAC;YAC1E,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,MAAM,EAAE,EAAE,GAAG,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;IAClF,CAAC;IAgFO,SAAS,CAAC,MAAW;;QAC3B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAGtD,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,CAAC,OAAO,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;;AAhTM,2BAAiB,GAAG;IACzB,SAAS,EAAE,YAAY;IACvB,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,EAAE;IACd,WAAW,EAAE;QACX,IAAI,EAAE,mBAAmB;KAC1B;IACD,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;IACD,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACpB,CAAC","file":"scrollbar.js","sourcesContent":["/**\n * @description 滚动条组件\n */\nimport type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender-core';\nimport { CustomEvent, vglobal } from '@visactor/vrender-core';\nimport { merge, normalizePadding, clamp, clampRange } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\n\nimport type { ScrollBarAttributes } from './type';\n\ntype ComponentBounds = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n width: number;\n height: number;\n};\n\nexport class ScrollBar extends AbstractComponent<Required<ScrollBarAttributes>> {\n name = 'scrollbar';\n\n static defaultAttributes = {\n direction: 'horizontal',\n round: true,\n sliderSize: 20,\n sliderStyle: {\n fill: 'rgba(0, 0, 0, .5)'\n },\n railStyle: {\n fill: 'rgba(0, 0, 0, .0)'\n },\n padding: 2,\n scrollRange: [0, 1]\n };\n\n private _container!: IGroup;\n // 滚动条滑块\n private _slider!: IRect;\n // 滚动条滑轨\n private _rail!: IRect;\n // 滑块可渲染的区域包围盒\n private _sliderRenderBounds!: ComponentBounds | null;\n // 滑块滑动的范围\n private _sliderLimitRange!: [number, number] | null;\n // 保留滑块上一次的位置\n private _prePos!: number;\n // TODO: 临时方案\n private _viewPosition!: { x: number; y: number };\n private _sliderSize!: number;\n\n constructor(attributes: ScrollBarAttributes) {\n super(merge({}, ScrollBar.defaultAttributes, attributes));\n }\n\n setScrollRange(range: [number, number], render = true) {\n const { direction = 'horizontal', limitRange = [0, 1], range: preRange } = this.attribute as ScrollBarAttributes;\n\n const currScrollRange = clampRange(range, limitRange[0], limitRange[1]);\n if (render) {\n // 更新图形\n const sliderPos = this._getSliderPos(currScrollRange);\n if (this._slider) {\n if (direction === 'horizontal') {\n this._slider.setAttribute('x', sliderPos[0], true);\n } else {\n this._slider.setAttribute('y', sliderPos[0], true);\n }\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n }\n }\n (this.attribute as ScrollBarAttributes).range = currScrollRange;\n // 发射 change 事件\n this._onChange({\n pre: preRange,\n value: currScrollRange\n });\n }\n\n getScrollRange(): [number, number] {\n return (this.attribute as ScrollBarAttributes).range;\n }\n\n // public setLocation(point: PointLocationCfg) {\n // this.translateTo(point.x, point.y);\n // }\n\n // 绑定事件\n protected bindEvents(): void {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n // TODO: wheel 事件支持\n if (this._rail) {\n this._rail.addEventListener('pointerdown', this._onRailPointerDown as EventListener);\n }\n if (this._slider) {\n this._slider.addEventListener('pointerdown', this._onSliderPointerDown as EventListener);\n }\n }\n\n protected render() {\n this._reset();\n const {\n direction = 'horizontal',\n width,\n height,\n range,\n limitRange = [0, 1],\n // sliderSize = 20,\n // scrollValue = 0,\n // scrollRange = [0, 1],\n railStyle,\n sliderStyle,\n padding = 2\n } = this.attribute as ScrollBarAttributes;\n\n const group = this.createOrUpdateChild('scrollbar-container', {}, 'group') as IGroup;\n // 绘制轨道\n\n const rail = group.createOrUpdateChild(\n 'scrollbar-rail',\n {\n x: 0,\n y: 0,\n width,\n height,\n ...railStyle\n },\n 'rect'\n ) as IRect;\n this._rail = rail;\n\n // 滑块\n const sliderRenderBounds = this._getSliderRenderBounds();\n const sliderPos = this._getSliderPos(clampRange(range, limitRange[0], limitRange[1]));\n const sliderSize = sliderPos[1] - sliderPos[0];\n this._sliderSize = sliderSize;\n // const sliderRangePos = this._getScrollRange();\n\n let sliderAttribute: IRectGraphicAttribute;\n if (direction === 'horizontal') {\n sliderAttribute = {\n x: sliderPos[0],\n y: sliderRenderBounds.y1,\n width: sliderSize,\n height: sliderRenderBounds.height\n };\n } else {\n sliderAttribute = {\n x: sliderRenderBounds.x1,\n y: sliderPos[0],\n width: sliderRenderBounds.width,\n height: sliderSize\n };\n }\n\n const slider = group.createOrUpdateChild(\n 'slider',\n {\n ...sliderAttribute,\n cornerRadius: this._getDefaultSliderCornerRadius(),\n ...sliderStyle,\n boundsPadding: normalizePadding(padding),\n pickMode: 'imprecise'\n },\n 'rect'\n ) as IRect;\n this._slider = slider;\n this._container = group;\n\n const containerAABBBounds = this._container.AABBBounds;\n this._viewPosition = {\n x: containerAABBBounds.x1,\n y: containerAABBBounds.y1\n };\n }\n\n // 获取滑块渲染的包围盒区域\n private _getSliderRenderBounds() {\n if (this._sliderRenderBounds) {\n return this._sliderRenderBounds;\n }\n const { width, height, padding = 2 } = this.attribute as ScrollBarAttributes;\n const [top, right, bottom, left] = normalizePadding(padding);\n const renderBounds = {\n x1: left,\n y1: top,\n x2: width - right,\n y2: height - bottom,\n width: width - (left + right),\n height: height - (top + bottom)\n };\n this._sliderRenderBounds = renderBounds;\n return renderBounds;\n }\n\n // 获取默认的滑块圆角\n private _getDefaultSliderCornerRadius() {\n const { direction, round } = this.attribute as ScrollBarAttributes;\n\n if (round) {\n const { width, height } = this._getSliderRenderBounds();\n return direction === 'horizontal' ? height : width;\n }\n\n return 0;\n }\n\n // 计算滑块在轨道的位置\n private _getSliderPos(range: [number, number]) {\n const { direction } = this.attribute as ScrollBarAttributes;\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n\n if (direction === 'horizontal') {\n return [width * range[0] + x1, width * range[1] + x1];\n }\n return [height * range[0] + y1, height * range[1] + y1];\n }\n\n private _getScrollRange() {\n if (this._sliderLimitRange) {\n return this._sliderLimitRange;\n }\n const { limitRange = [0, 1], direction } = this.attribute as ScrollBarAttributes;\n const [min, max] = clampRange(limitRange, 0, 1);\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n const sliderSize = this._sliderSize;\n\n return direction === 'horizontal'\n ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)\n : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);\n }\n\n private _onRailPointerDown = (e: FederatedPointerEvent) => {\n // 将事件坐标转换为实际的滑块位置\n // TODO: 这里有问题,应该拿 viewX viewY,同时 graphic 要提供接口获取它的 相对 view 的坐标\n const { viewX, viewY } = e;\n const { direction, width, height, range } = this.attribute as ScrollBarAttributes;\n const sliderSize = this._sliderSize;\n const [min, max] = this._getScrollRange();\n let currentScrollValue;\n if (direction === 'vertical') {\n const relativeY = viewY - this._viewPosition.y;\n const currentYPos = clamp(relativeY - sliderSize / 2, min, max);\n currentScrollValue = relativeY / height;\n this._slider.setAttribute('y', currentYPos, true);\n } else {\n const relativeX = viewX - this._viewPosition.x;\n const currentXPos = clamp(relativeX - sliderSize / 2, min, max);\n currentScrollValue = relativeX / width;\n this._slider.setAttribute('x', currentXPos, true);\n }\n\n this.setScrollRange(\n [currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2],\n false\n );\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n };\n\n private _onSliderPointerDown = (e: FederatedPointerEvent) => {\n e.stopPropagation();\n const { direction } = this.attribute as ScrollBarAttributes;\n this._prePos = direction === 'horizontal' ? e.clientX : e.clientY;\n if (vglobal.env === 'browser') {\n vglobal.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n vglobal.addEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n this._slider.addEventListener('pointerup', this._onSliderPointerUp);\n this._slider.addEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onSliderPointerMove = (e: any) => {\n e.stopPropagation();\n\n const { direction } = this.attribute as ScrollBarAttributes;\n let currentScrollValue;\n let currentPos;\n let delta = 0;\n const preScrollRange = this.getScrollRange();\n const { width, height } = this._getSliderRenderBounds();\n if (direction === 'vertical') {\n currentPos = e.clientY;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / height;\n } else {\n currentPos = e.clientX;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / width;\n }\n this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], true);\n this._prePos = currentPos;\n };\n\n private _onSliderPointerUp = (e: any) => {\n e.preventDefault();\n if (vglobal.env === 'browser') {\n vglobal.removeEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n vglobal.removeEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.removeEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n this._slider.removeEventListener('pointerup', this._onSliderPointerUp);\n this._slider.removeEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onChange(detail: any) {\n const changeEvent = new CustomEvent('scroll', detail);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n this.dispatchEvent(changeEvent);\n }\n\n private _reset() {\n this._sliderRenderBounds = null;\n this._sliderLimitRange = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scrollbar/scrollbar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAajD,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAmC7E,YAAY,UAA+B;QACzC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAnC5D,SAAI,GAAG,WAAW,CAAC;QAuOX,uBAAkB,GAAG,CAAC,CAAwB,EAAE,EAAE;;YAGxD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAC3B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;YAClF,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1C,IAAI,kBAAkB,CAAC;YACvB,IAAI,SAAS,KAAK,UAAU,EAAE;gBAC5B,MAAM,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,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,CAAC,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,EAAE,GAAG,GAAG,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,GAAG,UAAU,CAAC;YAC1E,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,MAAM,EAAE,EAAE,GAAG,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;IAClF,CAAC;IAgGO,SAAS,CAAC,MAAW;;QAC3B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAGtD,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,CAAC,OAAO,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;;AA9UM,2BAAiB,GAAG;IACzB,SAAS,EAAE,YAAY;IACvB,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,EAAE;IACd,WAAW,EAAE;QACX,IAAI,EAAE,mBAAmB;KAC1B;IACD,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;IACD,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,SAAS,EAAE,UAAU;IACrB,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC","file":"scrollbar.js","sourcesContent":["/**\n * @description 滚动条组件\n */\nimport type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender-core';\nimport { CustomEvent, vglobal } from '@visactor/vrender-core';\nimport { merge, normalizePadding, clamp, clampRange, debounce, throttle } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\n\nimport type { ScrollBarAttributes } from './type';\n\ntype ComponentBounds = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n width: number;\n height: number;\n};\n\nconst delayMap = {\n debounce: debounce,\n throttle: throttle\n};\n\nexport class ScrollBar extends AbstractComponent<Required<ScrollBarAttributes>> {\n name = 'scrollbar';\n\n static defaultAttributes = {\n direction: 'horizontal',\n round: true,\n sliderSize: 20,\n sliderStyle: {\n fill: 'rgba(0, 0, 0, .5)'\n },\n railStyle: {\n fill: 'rgba(0, 0, 0, .0)'\n },\n padding: 2,\n scrollRange: [0, 1],\n delayType: 'throttle',\n delayTime: 0,\n realTime: true\n };\n\n private _container!: IGroup;\n // 滚动条滑块\n private _slider!: IRect;\n // 滚动条滑轨\n private _rail!: IRect;\n // 滑块可渲染的区域包围盒\n private _sliderRenderBounds!: ComponentBounds | null;\n // 滑块滑动的范围\n private _sliderLimitRange!: [number, number] | null;\n // 保留滑块上一次的位置\n private _prePos!: number;\n // TODO: 临时方案\n private _viewPosition!: { x: number; y: number };\n private _sliderSize!: number;\n\n constructor(attributes: ScrollBarAttributes) {\n super(merge({}, ScrollBar.defaultAttributes, attributes));\n }\n\n setScrollRange(range: [number, number], render = true) {\n const {\n direction = 'horizontal',\n limitRange = [0, 1],\n range: preRange,\n realTime = true\n } = this.attribute as ScrollBarAttributes;\n\n const currScrollRange = clampRange(range, limitRange[0], limitRange[1]);\n if (render) {\n // 更新图形\n const sliderPos = this._getSliderPos(currScrollRange);\n if (this._slider) {\n if (direction === 'horizontal') {\n this._slider.setAttribute('x', sliderPos[0], true);\n } else {\n this._slider.setAttribute('y', sliderPos[0], true);\n }\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n }\n }\n (this.attribute as ScrollBarAttributes).range = currScrollRange;\n // 发射 change 事件\n if (realTime) {\n this._onChange({\n pre: preRange,\n value: currScrollRange\n });\n }\n }\n\n getScrollRange(): [number, number] {\n return (this.attribute as ScrollBarAttributes).range;\n }\n\n // public setLocation(point: PointLocationCfg) {\n // this.translateTo(point.x, point.y);\n // }\n\n // 绑定事件\n protected bindEvents(): void {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n const { delayType = 'throttle', delayTime = 0 } = this.attribute as ScrollBarAttributes;\n // TODO: wheel 事件支持\n if (this._rail) {\n this._rail.addEventListener(\n 'pointerdown',\n delayMap[delayType](this._onRailPointerDown, delayTime) as EventListener\n );\n }\n if (this._slider) {\n this._slider.addEventListener('pointerdown', this._onSliderPointerDown as EventListener);\n }\n }\n\n protected render() {\n this._reset();\n const {\n direction = 'horizontal',\n width,\n height,\n range,\n limitRange = [0, 1],\n // sliderSize = 20,\n // scrollValue = 0,\n // scrollRange = [0, 1],\n railStyle,\n sliderStyle,\n padding = 2\n } = this.attribute as ScrollBarAttributes;\n\n const group = this.createOrUpdateChild('scrollbar-container', {}, 'group') as IGroup;\n // 绘制轨道\n\n const rail = group.createOrUpdateChild(\n 'scrollbar-rail',\n {\n x: 0,\n y: 0,\n width,\n height,\n ...railStyle\n },\n 'rect'\n ) as IRect;\n this._rail = rail;\n\n // 滑块\n const sliderRenderBounds = this._getSliderRenderBounds();\n const sliderPos = this._getSliderPos(clampRange(range, limitRange[0], limitRange[1]));\n const sliderSize = sliderPos[1] - sliderPos[0];\n this._sliderSize = sliderSize;\n // const sliderRangePos = this._getScrollRange();\n\n let sliderAttribute: IRectGraphicAttribute;\n if (direction === 'horizontal') {\n sliderAttribute = {\n x: sliderPos[0],\n y: sliderRenderBounds.y1,\n width: sliderSize,\n height: sliderRenderBounds.height\n };\n } else {\n sliderAttribute = {\n x: sliderRenderBounds.x1,\n y: sliderPos[0],\n width: sliderRenderBounds.width,\n height: sliderSize\n };\n }\n\n const slider = group.createOrUpdateChild(\n 'slider',\n {\n ...sliderAttribute,\n cornerRadius: this._getDefaultSliderCornerRadius(),\n ...sliderStyle,\n boundsPadding: normalizePadding(padding),\n pickMode: 'imprecise'\n },\n 'rect'\n ) as IRect;\n this._slider = slider;\n this._container = group;\n\n const containerAABBBounds = this._container.AABBBounds;\n this._viewPosition = {\n x: containerAABBBounds.x1,\n y: containerAABBBounds.y1\n };\n }\n\n // 获取滑块渲染的包围盒区域\n private _getSliderRenderBounds() {\n if (this._sliderRenderBounds) {\n return this._sliderRenderBounds;\n }\n const { width, height, padding = 2 } = this.attribute as ScrollBarAttributes;\n const [top, right, bottom, left] = normalizePadding(padding);\n const renderBounds = {\n x1: left,\n y1: top,\n x2: width - right,\n y2: height - bottom,\n width: width - (left + right),\n height: height - (top + bottom)\n };\n this._sliderRenderBounds = renderBounds;\n return renderBounds;\n }\n\n // 获取默认的滑块圆角\n private _getDefaultSliderCornerRadius() {\n const { direction, round } = this.attribute as ScrollBarAttributes;\n\n if (round) {\n const { width, height } = this._getSliderRenderBounds();\n return direction === 'horizontal' ? height : width;\n }\n\n return 0;\n }\n\n // 计算滑块在轨道的位置\n private _getSliderPos(range: [number, number]) {\n const { direction } = this.attribute as ScrollBarAttributes;\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n\n if (direction === 'horizontal') {\n return [width * range[0] + x1, width * range[1] + x1];\n }\n return [height * range[0] + y1, height * range[1] + y1];\n }\n\n private _getScrollRange() {\n if (this._sliderLimitRange) {\n return this._sliderLimitRange;\n }\n const { limitRange = [0, 1], direction } = this.attribute as ScrollBarAttributes;\n const [min, max] = clampRange(limitRange, 0, 1);\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n const sliderSize = this._sliderSize;\n\n return direction === 'horizontal'\n ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)\n : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);\n }\n\n private _onRailPointerDown = (e: FederatedPointerEvent) => {\n // 将事件坐标转换为实际的滑块位置\n // TODO: 这里有问题,应该拿 viewX viewY,同时 graphic 要提供接口获取它的 相对 view 的坐标\n const { viewX, viewY } = e;\n const { direction, width, height, range } = this.attribute as ScrollBarAttributes;\n const sliderSize = this._sliderSize;\n const [min, max] = this._getScrollRange();\n let currentScrollValue;\n if (direction === 'vertical') {\n const relativeY = viewY - this._viewPosition.y;\n const currentYPos = clamp(relativeY - sliderSize / 2, min, max);\n currentScrollValue = relativeY / height;\n this._slider.setAttribute('y', currentYPos, true);\n } else {\n const relativeX = viewX - this._viewPosition.x;\n const currentXPos = clamp(relativeX - sliderSize / 2, min, max);\n currentScrollValue = relativeX / width;\n this._slider.setAttribute('x', currentXPos, true);\n }\n\n this.setScrollRange(\n [currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2],\n false\n );\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n };\n\n private _onSliderPointerDown = (e: FederatedPointerEvent) => {\n e.stopPropagation();\n const { direction } = this.attribute as ScrollBarAttributes;\n this._prePos = direction === 'horizontal' ? e.clientX : e.clientY;\n if (vglobal.env === 'browser') {\n vglobal.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n vglobal.addEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this.stage.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n this.stage.addEventListener('pointerup', this._onSliderPointerUp);\n this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _computeScrollValue = (e: any) => {\n const { direction } = this.attribute as ScrollBarAttributes;\n let currentScrollValue;\n let currentPos;\n let delta = 0;\n\n const { width, height } = this._getSliderRenderBounds();\n if (direction === 'vertical') {\n currentPos = e.clientY;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / height;\n } else {\n currentPos = e.clientX;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / width;\n }\n return [currentPos, currentScrollValue];\n };\n\n private _onSliderPointerMove = delayMap[this.attribute.delayType]((e: any) => {\n e.stopPropagation();\n const preScrollRange = this.getScrollRange();\n const [currentPos, currentScrollValue] = this._computeScrollValue(e);\n this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], true);\n this._prePos = currentPos;\n }, this.attribute.delayTime);\n\n private _onSliderPointerUp = (e: any) => {\n e.preventDefault();\n const { realTime = true, range: preRange, limitRange = [0, 1] } = this.attribute as ScrollBarAttributes;\n // 发射 change 事件\n const preScrollRange = this.getScrollRange();\n const [currentPos, currentScrollValue] = this._computeScrollValue(e);\n const range: [number, number] = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];\n if (!realTime) {\n this._onChange({\n pre: preRange,\n value: clampRange(range, limitRange[0], limitRange[1])\n });\n }\n if (vglobal.env === 'browser') {\n vglobal.removeEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n vglobal.removeEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this.stage.removeEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n this.stage.removeEventListener('pointerup', this._onSliderPointerUp);\n this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onChange(detail: any) {\n const changeEvent = new CustomEvent('scroll', detail);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n this.dispatchEvent(changeEvent);\n }\n\n private _reset() {\n this._sliderRenderBounds = null;\n this._sliderLimitRange = null;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IGroupGraphicAttribute, IRectGraphicAttribute } from '@visactor/vrender-core';
2
- import type { Direction } from '../interface';
2
+ import type { Direction, IDelayType } from '../interface';
3
3
  import type { Padding } from '../core/type';
4
4
  export interface ScrollBarAttributes extends IGroupGraphicAttribute {
5
5
  x: number;
@@ -14,4 +14,7 @@ export interface ScrollBarAttributes extends IGroupGraphicAttribute {
14
14
  range: [number, number];
15
15
  limitRange?: [number, number];
16
16
  disableTriggerEvent?: boolean;
17
+ delayType?: IDelayType;
18
+ delayTime?: number;
19
+ realTime?: boolean;
17
20
  }