@visactor/vrender-components 0.14.1-alpha.1 → 0.14.1-alpha.2

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 (51) hide show
  1. package/cjs/core/type.js +2 -1
  2. package/cjs/crosshair/type.js +1 -2
  3. package/cjs/data-zoom/data-zoom.js +2 -2
  4. package/cjs/data-zoom/data-zoom.js.map +1 -1
  5. package/cjs/index.d.ts +1 -1
  6. package/cjs/index.js +1 -1
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/label/base.d.ts +5 -2
  9. package/cjs/label/base.js +32 -20
  10. package/cjs/label/base.js.map +1 -1
  11. package/cjs/label/type.d.ts +1 -0
  12. package/cjs/label/type.js.map +1 -1
  13. package/cjs/marker/base.js +3 -5
  14. package/cjs/marker/base.js.map +1 -1
  15. package/cjs/marker/type.d.ts +0 -6
  16. package/cjs/marker/type.js.map +1 -1
  17. package/cjs/player/continuous-player.js +5 -5
  18. package/cjs/player/continuous-player.js.map +1 -1
  19. package/cjs/player/discrete-player.js +4 -4
  20. package/cjs/player/discrete-player.js.map +1 -1
  21. package/cjs/scrollbar/scrollbar.js +4 -4
  22. package/cjs/scrollbar/scrollbar.js.map +1 -1
  23. package/cjs/slider/slider.js +8 -8
  24. package/cjs/slider/slider.js.map +1 -1
  25. package/dist/index.js +2292 -2969
  26. package/dist/index.min.js +1 -1
  27. package/es/core/type.js +2 -1
  28. package/es/crosshair/type.js +1 -2
  29. package/es/data-zoom/data-zoom.js +3 -3
  30. package/es/data-zoom/data-zoom.js.map +1 -1
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/index.js.map +1 -1
  34. package/es/label/base.d.ts +5 -2
  35. package/es/label/base.js +30 -17
  36. package/es/label/base.js.map +1 -1
  37. package/es/label/type.d.ts +1 -0
  38. package/es/label/type.js.map +1 -1
  39. package/es/marker/base.js +2 -6
  40. package/es/marker/base.js.map +1 -1
  41. package/es/marker/type.d.ts +0 -6
  42. package/es/marker/type.js.map +1 -1
  43. package/es/player/continuous-player.js +5 -5
  44. package/es/player/continuous-player.js.map +1 -1
  45. package/es/player/discrete-player.js +5 -5
  46. package/es/player/discrete-player.js.map +1 -1
  47. package/es/scrollbar/scrollbar.js +5 -5
  48. package/es/scrollbar/scrollbar.js.map +1 -1
  49. package/es/slider/slider.js +9 -9
  50. package/es/slider/slider.js.map +1 -1
  51. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["label/base.ts"],"names":[],"mappings":";;;AAIA,+CAA+F;AAE/F,6CAAyF;AACzF,uCAAiD;AAEjD,+DAA4D;AAC5D,kCAAiF;AACjF,0CAAyC;AAEzC,uCAAiG;AAEjG,+CAAkF;AAGlF,MAAsB,SAAoC,SAAQ,wBAAoB;IAAtF;;QACE,SAAI,GAAG,OAAO,CAAC;QA6GP,aAAQ,GAAG,CAAC,CAAwB,EAAE,EAAE;YAC9C,MAAM,MAAM,GAAG,CAAC,CAAC,MAA6B,CAAC;YAC/C,IAAI,MAAM,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBACzD,MAAM,CAAC,QAAQ,CAAC,qBAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACxC,IAAA,oBAAa,EAAC,IAA2B,EAAE,CAAC,IAAc,EAAE,EAAE;oBAC5D,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE;wBAC5C,IAAI,CAAC,QAAQ,CAAC,qBAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;aAC1B;QACH,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,CAAwB,EAAE,EAAE;YAChD,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAA,oBA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,uBAAuB,EAAE,iBAAiB,CAAC;iBAC/G,CAAC,CAAC;aACJ;SACF;IACH,CAAC;IAED,WAAW,CAAC,KAAuB;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF;AA1pBD,8BA0pBC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, IPath, Path } from '@visactor/vrender';\nimport { createText, IncreaseCount, AttributeUpdateType, createPath } from '@visactor/vrender';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty, isValid, isString } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, canPlaceInside, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\nimport type { ArcInfo } from './arc';\n\nexport abstract class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\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, IText>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n protected abstract labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined;\n\n protected layoutArcLabels(\n position?: BaseLabelAttrs['position'],\n attribute?: any,\n currentMarks?: IGraphic[],\n data?: any[],\n textBoundsArray?: any[]\n ): any {\n const arcs: ArcInfo[] = [];\n return arcs;\n }\n\n protected render() {\n this._prepare();\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(data, (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this.layout(data);\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(labels as Text[], (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\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 (!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 _setStates(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 _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 private _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStates(text);\n return text;\n }\n\n private _prepare() {\n const baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n const currentBaseMarks: IGraphic[] = [];\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._baseMarks = currentBaseMarks;\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 if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n // generate id mapping before data filter\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 protected layout(data: LabelItem[] = []): IText[] {\n const { textStyle = {}, position, offset } = this.attribute;\n const labels = [];\n const textBoundsArray = [];\n\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this._idToGraphic.get(textData.id);\n\n const labelAttribute = {\n fill: baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n const textBounds = this.getGraphicBounds(text);\n textBoundsArray.push(textBounds);\n const graphicBounds = 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 if (!textLocation) {\n continue;\n }\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n\n text.setAttributes(textLocation);\n labels.push(text);\n }\n\n if (this.attribute.type === 'arc') {\n const arcs: ArcInfo[] = this.layoutArcLabels(\n position,\n this.attribute,\n Array.from(this._idToGraphic.values()),\n data,\n textBoundsArray\n );\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const basedArc = arcs.find(arc => arc.labelText === textData.text);\n\n const labelAttribute = {\n x: basedArc.labelPosition.x,\n y: basedArc.labelPosition.y,\n angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle,\n labelLinePath: basedArc.labelLinePath\n };\n\n labels[i].setAttributes(labelAttribute);\n }\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 { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [] } = 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 const text = labels[i] as IText;\n const baseMark = this._idToGraphic.get((text.attribute as LabelItem).id);\n text.update();\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {\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 && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n // 尝试向内挤压\n if (clampForce) {\n const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);\n if (\n !(dx === 0 && dy === 0) &&\n canPlace(bmpTool, bitmap, {\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 ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\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.getGraphicBounds(baseMark, labels[i]),\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(bmpTool, bitmap, {\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 ) {\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 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 animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n const disableAnimation = this._enableAnimation === false || (animationConfig as unknown as boolean) === false;\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 = new Map();\n const prevTextMap = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach((text, index) => {\n const labelLine: IPath = (text.attribute as ArcLabelAttrs)?.labelLinePath\n ? (createPath({\n visible: text.attribute?.visible ?? true,\n stroke: (text.attribute as ArcLabelAttrs)?.line?.stroke ?? text.attribute?.fill,\n lineWidth: 1,\n path: (text.attribute as ArcLabelAttrs)?.labelLinePath\n }) as Path)\n : undefined;\n const relatedGraphic = this._idToGraphic.get((text.attribute as LabelItem).id);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(relatedGraphic, text);\n if (!disableAnimation && relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n relatedGraphic.onAnimateBind = () => {\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 } else {\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n }\n }\n\n if (state === 'update') {\n const prevText = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevText);\n if (!disableAnimation) {\n prevText.animate().to(text.attribute, duration, easing);\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 } else {\n prevText.setAttributes(text.attribute);\n }\n }\n });\n prevTextMap.forEach(label => {\n if (disableAnimation) {\n this.removeChild(label);\n } else {\n label\n ?.animate()\n .to(getAnimationAttributes(label.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label);\n });\n }\n });\n\n this._graphicToText = currentTextMap;\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 // 1. 与当前关联图元的动画播放同时进行\n if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\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\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._idToGraphic.get((label.attribute as LabelItem).id);\n let isInside = canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n\n if (this.attribute.type === 'arc') {\n if (this.attribute.position === 'inside') {\n isInside = true;\n } else {\n isInside = false;\n }\n }\n\n /**\n * stroke 的处理逻辑\n * 1. 当文本在图元内部时,有两种情况:\n * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色\n * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色\n * 2. 当文本在图元外部时,有两种情况:\n * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。\n * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n if (label.attribute.stroke && label.attribute.lineWidth > 0) {\n /**\n * 1-b, 2-b\n * 若label存在stroke,label填充色为前景色,label描边色为背景色\n * WCAG 2 字母周围的文本发光/光晕可用作背景颜色\n */\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 } else if (isInside) {\n /**\n * 1-a\n * label在图元内部时,label填充色为前景色,baseMark填充色为背景色\n */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n } else if (label.attribute.lineWidth > 0) {\n /**\n * 2-a\n * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n const backgroundColor = label.attribute.stroke as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n stroke: baseMark.attribute.fill,\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n }\n }\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":["label/base.ts"],"names":[],"mappings":";;;AAIA,+CAA+F;AAE/F,6CAAyF;AACzF,uCAAiD;AAEjD,+DAA4D;AAC5D,kCAAiF;AACjF,0CAAyC;AAEzC,uCAAiG;AAEjG,+CAAkF;AAElF,6CAAyC;AAEzC,MAAsB,SAAoC,SAAQ,wBAAoB;IAAtF;;QACE,SAAI,GAAG,OAAO,CAAC;QA6GP,aAAQ,GAAG,CAAC,CAAwB,EAAE,EAAE;YAC9C,MAAM,MAAM,GAAG,CAAC,CAAC,MAA6B,CAAC;YAC/C,IAAI,MAAM,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBACzD,MAAM,CAAC,QAAQ,CAAC,qBAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACxC,IAAA,oBAAa,EAAC,IAA2B,EAAE,CAAC,IAAc,EAAE,EAAE;oBAC5D,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE;wBAC5C,IAAI,CAAC,QAAQ,CAAC,qBAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;aAC1B;QACH,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,CAAwB,EAAE,EAAE;YAChD,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAA,oBAAa,EAAC,IAA2B,EAAE,CAAC,IAAc,EAAE,EAAE;oBAC5D,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI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"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, ILine, Line } from '@visactor/vrender';\nimport { createText, IncreaseCount, AttributeUpdateType, createLine } from '@visactor/vrender';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty, isValid, isString } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, canPlaceInside, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\nimport type { ArcInfo } from './arc';\nimport { merge } from '@visactor/vutils';\n\nexport abstract class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\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 onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n protected abstract labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined;\n\n protected layoutArcLabels(\n position?: BaseLabelAttrs['position'],\n attribute?: any,\n currentMarks?: IGraphic[],\n data?: any[],\n textBoundsArray?: any[]\n ): any {\n const arcs: ArcInfo[] = [];\n return arcs;\n }\n\n protected render() {\n this._prepare();\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(data, (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this.layout(data);\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(labels as Text[], (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\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 (!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 _setStates(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 _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 private _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStates(text);\n return text;\n }\n\n private _prepare() {\n const baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n const currentBaseMarks: IGraphic[] = [];\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._baseMarks = currentBaseMarks;\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 if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n // generate id mapping before data filter\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 protected layout(data: LabelItem[] = []): IText[] {\n const { textStyle = {}, position, offset } = this.attribute;\n const labels = [];\n const textBoundsArray = [];\n\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this._idToGraphic.get(textData.id);\n\n const labelAttribute = {\n fill: baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n const textBounds = this.getGraphicBounds(text);\n textBoundsArray.push(textBounds);\n const graphicBounds = 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 if (!textLocation) {\n continue;\n }\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n\n text.setAttributes(textLocation);\n labels.push(text);\n }\n\n if (this.attribute.type === 'arc') {\n const arcs: ArcInfo[] = this.layoutArcLabels(\n position,\n this.attribute,\n Array.from(this._idToGraphic.values()),\n data,\n textBoundsArray\n );\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const basedArc = arcs.find(arc => arc.labelText === textData.text);\n\n const labelAttribute = {\n x: basedArc.labelPosition.x,\n y: basedArc.labelPosition.y,\n angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle,\n points: [basedArc.pointA, basedArc.pointB, basedArc.pointC]\n };\n\n labels[i].setAttributes(labelAttribute);\n }\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 { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [] } = 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 const text = labels[i] as IText;\n const baseMark = this._idToGraphic.get((text.attribute as LabelItem).id);\n text.update();\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {\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 && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n // 尝试向内挤压\n if (clampForce) {\n const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);\n if (\n !(dx === 0 && dy === 0) &&\n canPlace(bmpTool, bitmap, {\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 ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\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.getGraphicBounds(baseMark, labels[i]),\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(bmpTool, bitmap, {\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 ) {\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 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 animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n const disableAnimation = this._enableAnimation === false || (animationConfig as unknown as boolean) === false;\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 = (text.attribute as ArcLabelAttrs)?.points\n ? (createLine({\n visible: text.attribute?.visible ?? true,\n stroke: (text.attribute as ArcLabelAttrs)?.line?.stroke ?? text.attribute?.fill,\n lineWidth: 1,\n points: (text.attribute as ArcLabelAttrs)?.points\n }) as Line)\n : undefined;\n const relatedGraphic = this._idToGraphic.get((text.attribute as LabelItem).id);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });\n if (!disableAnimation && relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n relatedGraphic.onAnimateBind = () => {\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 } else {\n this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n }\n }\n\n if (state === 'update') {\n const prevLabel = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevLabel);\n if (!disableAnimation) {\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 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 } else {\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 if (disableAnimation) {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n } else {\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\n this._graphicToText = currentTextMap;\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 // 1. 与当前关联图元的动画播放同时进行\n if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\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\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._idToGraphic.get((label.attribute as LabelItem).id);\n let isInside = canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n\n if (this.attribute.type === 'arc') {\n if (this.attribute.position === 'inside') {\n isInside = true;\n } else {\n isInside = false;\n }\n }\n\n /**\n * stroke 的处理逻辑\n * 1. 当文本在图元内部时,有两种情况:\n * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色\n * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色\n * 2. 当文本在图元外部时,有两种情况:\n * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。\n * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n if (label.attribute.stroke && label.attribute.lineWidth > 0) {\n /**\n * 1-b, 2-b\n * 若label存在stroke,label填充色为前景色,label描边色为背景色\n * WCAG 2 字母周围的文本发光/光晕可用作背景颜色\n */\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 } else if (isInside) {\n /**\n * 1-a\n * label在图元内部时,label填充色为前景色,baseMark填充色为背景色\n */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n } else if (label.attribute.lineWidth > 0) {\n /**\n * 2-a\n * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n const backgroundColor = label.attribute.stroke as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n stroke: baseMark.attribute.fill,\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n }\n }\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"]}
@@ -91,6 +91,7 @@ export interface ArcLabelAttrs extends BaseLabelAttrs {
91
91
  line?: IArcLabelLineSpec;
92
92
  layout?: IArcLabelLayoutSpec;
93
93
  labelLinePath?: string;
94
+ points?: IPoint[];
94
95
  }
95
96
  export interface IArcLabelLineSpec {
96
97
  stroke?: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["label/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGraphic,\n IGroupGraphicAttribute,\n ITextGraphicAttribute,\n Text,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender';\n\nexport type LabelItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type LabelItem = {\n // 用于动画\n id?: string;\n // 原始数据\n data?: any;\n [key: string]: any;\n} & ITextGraphicAttribute;\n\nexport interface BaseLabelAttrs extends IGroupGraphicAttribute {\n type: string;\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 标签数据\n */\n data: LabelItem[];\n\n /** 文本样式,优先级低于 data */\n textStyle?: Partial<ITextGraphicAttribute>;\n\n /** 文本交互样式 */\n state?: LabelItemStateStyle<ITextGraphicAttribute>;\n\n /** 标签默认位置 */\n position?: Functional<string>;\n\n /** 偏移量 */\n offset?: number;\n\n /** 是否开启防重叠\n * @default true\n */\n overlap?: OverlapAttrs | false;\n\n /** 智能反色 */\n smartInvert?: SmartInvertAttrs | false;\n\n /** 动画配置 */\n animation?: ILabelAnimation | false;\n\n // 排序 or 删减\n dataFilter?: (data: LabelItem[]) => LabelItem[];\n\n /** 自定义布局函数\n * @description 当配置了 customLayoutFunc 后,默认布局和防重叠逻辑将不再生效。(overlap/position/offset不生效)\n */\n customLayoutFunc?: (data: LabelItem[], getRelatedGraphic: (data: LabelItem) => IGraphic) => Text[];\n\n /** 自定义标签躲避函数\n * @description 当配置了 customOverlapFunc 后,会根据 position 和 offset 进行初始布局。配置的防重叠逻辑(overlap)不生效。\n */\n customOverlapFunc?: (label: Text[], getRelatedGraphic: (data: LabelItem) => IGraphic) => Text[];\n}\n\nexport interface OverlapAttrs {\n /**\n * 防重叠的区域大小\n */\n size?: { width: number; height: number };\n\n /**\n * 发生重叠后,是否隐藏标签\n * @default true\n */\n hideOnHit?: boolean;\n\n /**\n * 是否约束标签在指定 size 的范围内。开启后若标签被区域裁剪,会向内收缩。\n * @default true\n */\n clampForce?: boolean;\n\n /**\n * 是否躲避基础图元\n * @default false\n */\n avoidBaseMark?: boolean;\n\n /**\n * 躲避指定图元\n * @default []\n */\n avoidMarks?: string[] | IGraphic[];\n\n /**\n * 发生重叠后的躲避策略\n */\n strategy?: Strategy[];\n}\n\nexport interface SmartInvertAttrs {\n /**\n * 文本类型\n * 包含普通文本和大文本,对应不同的对比度标准,label默认为普通文本\n * 'normalText' | 'largeText'\n * @default 'normalText'\n */\n textType?: string;\n /**\n * 自定义对比度阈值\n */\n contrastRatiosThreshold?: number;\n /**\n * 自定义备选label颜色\n */\n alternativeColors?: string | string[];\n}\n\nexport type PositionStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则考虑 position 内的备选位置。\n */\n type: 'position';\n position?: Functional<LabelPosition[]>;\n};\n\nexport type BoundStrategy = {\n /**\n * 标签配置在图形内部时使用。\n * 当图形大小不足以放下标签,则考虑 position 内的备选位置。\n */\n type: 'bound';\n position?: Functional<LabelPosition[]>;\n};\n\nexport type MoveYStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则根据 offset 在Y方向上寻找位置。\n */\n type: 'moveY';\n /**\n * Y方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type MoveXStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则根据 offset 在X方向上寻找位置。\n */\n type: 'moveX';\n /**\n * X方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type Strategy = PositionStrategy | BoundStrategy | MoveYStrategy | MoveXStrategy;\n\nexport type LabelPosition = SymbolLabelAttrs['position'] | RectLabelAttrs['position'];\n\nexport interface SymbolLabelAttrs extends BaseLabelAttrs {\n type: 'symbol';\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<\n 'top' | 'bottom' | 'left' | 'right' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center'\n >;\n}\n\nexport interface RectLabelAttrs extends BaseLabelAttrs {\n type: 'rect';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<\n 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'inside-top' | 'inside-bottom' | 'inside-right' | 'inside-left'\n >;\n}\n\nexport interface LineLabelAttrs extends BaseLabelAttrs {\n type: 'line';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface ArcLabelAttrs extends BaseLabelAttrs {\n type: 'arc';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'outside'\n */\n position?: Functional<'inside' | 'outside'>;\n\n // 画布宽度\n width?: number;\n // 画布高度\n height?: number;\n\n /**\n * 是否允许标签重叠\n * @default false\n */\n coverEnable?: boolean;\n /**\n * 是否允许标签旋转\n * @default true\n */\n rotate?: boolean;\n\n /**\n * 文字与引导线间隔宽度\n * @default 5\n */\n spaceWidth?: number;\n /**\n * 标签旋转角度\n */\n angle?: number;\n /**\n * 标签横向点对齐\n */\n textAlign?: TextAlignType;\n /**\n * 标签纵向点对齐\n */\n textBaseline?: TextBaselineType;\n /**\n * 扇区间标签的间隔\n * @default 6\n */\n layoutArcGap?: number;\n /** 标签引导线样式 */\n line?: IArcLabelLineSpec;\n /** 标签布局配置 */\n layout?: IArcLabelLayoutSpec;\n /** 标签引导线path */\n labelLinePath?: string;\n}\n\nexport interface IArcLabelLineSpec {\n stroke?: string;\n /**\n * 是否显示引导线\n * @default true\n */\n visible?: boolean;\n /**\n * 引导线 line1 部分最小长度\n * @default 20\n */\n line1MinLength?: number;\n /**\n * 引导线 line2 部分最小长度\n * @default 10\n */\n line2MinLength?: number;\n}\n\nexport type ArcLabelAlignType = 'arc' | 'labelLine' | 'edge';\n\nexport type ArcLabelStrategyType = 'priority' | 'vertical' | 'none';\n\nexport interface IArcLabelLayoutSpec {\n /**\n * 标签对齐方式\n * @default 'arc'\n */\n textAlign?: ArcLabelAlignType;\n /** @deprecate 建议统一使用textAlign,后续将废除 */\n align?: ArcLabelAlignType;\n /**\n * 标签布局策略\n * @default 'priority'\n */\n strategy?: ArcLabelStrategyType;\n /**\n * 是否启用切线约束\n * @default true\n */\n tangentConstraint?: boolean;\n}\n\nexport interface DataLabelAttrs extends IGroupGraphicAttribute {\n dataLabels: (RectLabelAttrs | SymbolLabelAttrs | ArcLabelAttrs)[];\n /**\n * 防重叠的区域大小\n */\n size: { width: number; height: number };\n}\n\nexport type Functional<T> = T | ((data: any) => T);\n\nexport interface ILabelAnimation {\n mode?: 'same-time' | 'after' | 'after-all';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n /** 是否开启 increaseCount 动画\n * @default true\n */\n increaseEffect?: boolean;\n}\n\nexport interface IPoint {\n x: number;\n y: number;\n}\n\nexport interface IPolarPoint {\n radius: number;\n angle: number;\n}\n\nexport type Quadrant = 1 | 2 | 3 | 4;\n\nexport type TextAlign = 'left' | 'right' | 'center';\n"]}
1
+ {"version":3,"sources":["label/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGraphic,\n IGroupGraphicAttribute,\n ITextGraphicAttribute,\n Text,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender';\n\nexport type LabelItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type LabelItem = {\n // 用于动画\n id?: string;\n // 原始数据\n data?: any;\n [key: string]: any;\n} & ITextGraphicAttribute;\n\nexport interface BaseLabelAttrs extends IGroupGraphicAttribute {\n type: string;\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 标签数据\n */\n data: LabelItem[];\n\n /** 文本样式,优先级低于 data */\n textStyle?: Partial<ITextGraphicAttribute>;\n\n /** 文本交互样式 */\n state?: LabelItemStateStyle<ITextGraphicAttribute>;\n\n /** 标签默认位置 */\n position?: Functional<string>;\n\n /** 偏移量 */\n offset?: number;\n\n /** 是否开启防重叠\n * @default true\n */\n overlap?: OverlapAttrs | false;\n\n /** 智能反色 */\n smartInvert?: SmartInvertAttrs | false;\n\n /** 动画配置 */\n animation?: ILabelAnimation | false;\n\n // 排序 or 删减\n dataFilter?: (data: LabelItem[]) => LabelItem[];\n\n /** 自定义布局函数\n * @description 当配置了 customLayoutFunc 后,默认布局和防重叠逻辑将不再生效。(overlap/position/offset不生效)\n */\n customLayoutFunc?: (data: LabelItem[], getRelatedGraphic: (data: LabelItem) => IGraphic) => Text[];\n\n /** 自定义标签躲避函数\n * @description 当配置了 customOverlapFunc 后,会根据 position 和 offset 进行初始布局。配置的防重叠逻辑(overlap)不生效。\n */\n customOverlapFunc?: (label: Text[], getRelatedGraphic: (data: LabelItem) => IGraphic) => Text[];\n}\n\nexport interface OverlapAttrs {\n /**\n * 防重叠的区域大小\n */\n size?: { width: number; height: number };\n\n /**\n * 发生重叠后,是否隐藏标签\n * @default true\n */\n hideOnHit?: boolean;\n\n /**\n * 是否约束标签在指定 size 的范围内。开启后若标签被区域裁剪,会向内收缩。\n * @default true\n */\n clampForce?: boolean;\n\n /**\n * 是否躲避基础图元\n * @default false\n */\n avoidBaseMark?: boolean;\n\n /**\n * 躲避指定图元\n * @default []\n */\n avoidMarks?: string[] | IGraphic[];\n\n /**\n * 发生重叠后的躲避策略\n */\n strategy?: Strategy[];\n}\n\nexport interface SmartInvertAttrs {\n /**\n * 文本类型\n * 包含普通文本和大文本,对应不同的对比度标准,label默认为普通文本\n * 'normalText' | 'largeText'\n * @default 'normalText'\n */\n textType?: string;\n /**\n * 自定义对比度阈值\n */\n contrastRatiosThreshold?: number;\n /**\n * 自定义备选label颜色\n */\n alternativeColors?: string | string[];\n}\n\nexport type PositionStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则考虑 position 内的备选位置。\n */\n type: 'position';\n position?: Functional<LabelPosition[]>;\n};\n\nexport type BoundStrategy = {\n /**\n * 标签配置在图形内部时使用。\n * 当图形大小不足以放下标签,则考虑 position 内的备选位置。\n */\n type: 'bound';\n position?: Functional<LabelPosition[]>;\n};\n\nexport type MoveYStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则根据 offset 在Y方向上寻找位置。\n */\n type: 'moveY';\n /**\n * Y方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type MoveXStrategy = {\n /**\n * 可选位置策略。\n * 若默认位置没有足够的空间放置标签,则根据 offset 在X方向上寻找位置。\n */\n type: 'moveX';\n /**\n * X方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type Strategy = PositionStrategy | BoundStrategy | MoveYStrategy | MoveXStrategy;\n\nexport type LabelPosition = SymbolLabelAttrs['position'] | RectLabelAttrs['position'];\n\nexport interface SymbolLabelAttrs extends BaseLabelAttrs {\n type: 'symbol';\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<\n 'top' | 'bottom' | 'left' | 'right' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center'\n >;\n}\n\nexport interface RectLabelAttrs extends BaseLabelAttrs {\n type: 'rect';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<\n 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'inside-top' | 'inside-bottom' | 'inside-right' | 'inside-left'\n >;\n}\n\nexport interface LineLabelAttrs extends BaseLabelAttrs {\n type: 'line';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface ArcLabelAttrs extends BaseLabelAttrs {\n type: 'arc';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'outside'\n */\n position?: Functional<'inside' | 'outside'>;\n\n // 画布宽度\n width?: number;\n // 画布高度\n height?: number;\n\n /**\n * 是否允许标签重叠\n * @default false\n */\n coverEnable?: boolean;\n /**\n * 是否允许标签旋转\n * @default true\n */\n rotate?: boolean;\n\n /**\n * 文字与引导线间隔宽度\n * @default 5\n */\n spaceWidth?: number;\n /**\n * 标签旋转角度\n */\n angle?: number;\n /**\n * 标签横向点对齐\n */\n textAlign?: TextAlignType;\n /**\n * 标签纵向点对齐\n */\n textBaseline?: TextBaselineType;\n /**\n * 扇区间标签的间隔\n * @default 6\n */\n layoutArcGap?: number;\n /** 标签引导线样式 */\n line?: IArcLabelLineSpec;\n /** 标签布局配置 */\n layout?: IArcLabelLayoutSpec;\n /** 标签引导线path */\n labelLinePath?: string;\n /** 标签引导线点集 */\n points?: IPoint[];\n}\n\nexport interface IArcLabelLineSpec {\n stroke?: string;\n /**\n * 是否显示引导线\n * @default true\n */\n visible?: boolean;\n /**\n * 引导线 line1 部分最小长度\n * @default 20\n */\n line1MinLength?: number;\n /**\n * 引导线 line2 部分最小长度\n * @default 10\n */\n line2MinLength?: number;\n}\n\nexport type ArcLabelAlignType = 'arc' | 'labelLine' | 'edge';\n\nexport type ArcLabelStrategyType = 'priority' | 'vertical' | 'none';\n\nexport interface IArcLabelLayoutSpec {\n /**\n * 标签对齐方式\n * @default 'arc'\n */\n textAlign?: ArcLabelAlignType;\n /** @deprecate 建议统一使用textAlign,后续将废除 */\n align?: ArcLabelAlignType;\n /**\n * 标签布局策略\n * @default 'priority'\n */\n strategy?: ArcLabelStrategyType;\n /**\n * 是否启用切线约束\n * @default true\n */\n tangentConstraint?: boolean;\n}\n\nexport interface DataLabelAttrs extends IGroupGraphicAttribute {\n dataLabels: (RectLabelAttrs | SymbolLabelAttrs | ArcLabelAttrs)[];\n /**\n * 防重叠的区域大小\n */\n size: { width: number; height: number };\n}\n\nexport type Functional<T> = T | ((data: any) => T);\n\nexport interface ILabelAnimation {\n mode?: 'same-time' | 'after' | 'after-all';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n /** 是否开启 increaseCount 动画\n * @default true\n */\n increaseEffect?: boolean;\n}\n\nexport interface IPoint {\n x: number;\n y: number;\n}\n\nexport interface IPolarPoint {\n radius: number;\n angle: number;\n}\n\nexport type Quadrant = 1 | 2 | 3 | 4;\n\nexport type TextAlign = 'left' | 'right' | 'center';\n"]}
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Marker = void 0;
6
6
 
7
- const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base");
7
+ const vrender_1 = require("@visactor/vrender"), base_1 = require("../core/base");
8
8
 
9
9
  class Marker extends base_1.AbstractComponent {
10
10
  render() {
11
- var _a, _b, _c, _d, _e;
11
+ var _a, _b;
12
12
  const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
13
13
  if (null !== (_b = this.attribute.interactive) && void 0 !== _b && _b || (this.setAttribute("pickable", !1),
14
14
  this.setAttribute("childrenPickable", !1)), markerVisible) if (this._container) this.updateMarker(); else {
15
- const group = (0, vrender_1.createGroup)(Object.assign(Object.assign({}, null === (_c = this.attribute) || void 0 === _c ? void 0 : _c.clipRange), {
16
- clip: null !== (_e = (0, vutils_1.isValid)(null === (_d = this.attribute) || void 0 === _d ? void 0 : _d.clipRange)) && void 0 !== _e && _e
17
- }));
15
+ const group = (0, vrender_1.createGroup)({});
18
16
  group.name = "marker-container", this.add(group), this._container = group, this.initMarker(group);
19
17
  }
20
18
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["marker/base.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,6CAA2C;AAC3C,uCAAiD;AAIjD,MAAsB,MAA8B,SAAQ,wBAA8B;IAS9E,MAAM;;QACd,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,IAAI,CAAC;QACrD,MAAM,iBAAiB,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,mCAAI,KAAK,CAAC;QAE9D,IAAI,CAAC,iBAAiB,EAAE;YACtB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,MAAM,KAAK,GAAG,IAAA,qBAAW,kCACpB,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,KAC5B,IAAI,EAAE,MAAA,IAAA,gBAAO,EAAC,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,mCAAI,KAAK,IACjD,CAAC;gBACH,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;gBAChC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aACxB;iBAAM;gBACL,IAAI,CAAC,YAAY,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CACF;AAjCD,wBAiCC","file":"base.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport { createGroup } from '@visactor/vrender';\nimport { isValid } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { Tag } from '../tag';\nimport type { MarkerAttrs } from './type';\n\nexport abstract class Marker<T extends MarkerAttrs> extends AbstractComponent<Required<T>> {\n private _container!: IGroup;\n\n protected _label!: Tag;\n\n protected abstract setLabelPos(): any;\n protected abstract initMarker(container: IGroup): any;\n protected abstract updateMarker(): any;\n\n protected render() {\n const markerVisible = this.attribute.visible ?? true;\n const markerInteractive = this.attribute.interactive ?? false;\n\n if (!markerInteractive) {\n this.setAttribute('pickable', false);\n this.setAttribute('childrenPickable', false);\n }\n\n if (markerVisible) {\n if (!this._container) {\n const group = createGroup({\n ...this.attribute?.clipRange,\n clip: isValid(this.attribute?.clipRange) ?? false\n });\n group.name = 'marker-container';\n this.add(group);\n this._container = group;\n this.initMarker(group);\n } else {\n this.updateMarker();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["marker/base.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,uCAAiD;AAIjD,MAAsB,MAA8B,SAAQ,wBAA8B;IAS9E,MAAM;;QAEd,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,IAAI,CAAC;QACrD,MAAM,iBAAiB,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,mCAAI,KAAK,CAAC;QAE9D,IAAI,CAAC,iBAAiB,EAAE;YACtB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,EAAE,CAAC,CAAC;gBAC9B,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;gBAChC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aACxB;iBAAM;gBACL,IAAI,CAAC,YAAY,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CACF;AA/BD,wBA+BC","file":"base.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport { createGroup } from '@visactor/vrender';\nimport { AbstractComponent } from '../core/base';\nimport type { Tag } from '../tag';\nimport type { MarkerAttrs } from './type';\n\nexport abstract class Marker<T extends MarkerAttrs> extends AbstractComponent<Required<T>> {\n private _container!: IGroup;\n\n protected _label!: Tag;\n\n protected abstract setLabelPos(): any;\n protected abstract initMarker(container: IGroup): any;\n protected abstract updateMarker(): any;\n\n protected render() {\n // this.removeAllChild();\n const markerVisible = this.attribute.visible ?? true;\n const markerInteractive = this.attribute.interactive ?? false;\n\n if (!markerInteractive) {\n this.setAttribute('pickable', false);\n this.setAttribute('childrenPickable', false);\n }\n\n if (markerVisible) {\n if (!this._container) {\n const group = createGroup({});\n group.name = 'marker-container';\n this.add(group);\n this._container = group;\n this.initMarker(group);\n } else {\n this.updateMarker();\n }\n }\n }\n}\n"]}
@@ -50,12 +50,6 @@ export interface MarkerAttrs extends IGroupGraphicAttribute {
50
50
  type?: 'line' | 'area' | 'point';
51
51
  interactive?: boolean;
52
52
  visible?: boolean;
53
- clipRange?: {
54
- x: number;
55
- y: number;
56
- width: number;
57
- height: number;
58
- };
59
53
  }
60
54
  export interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {
61
55
  type?: 'line';
@@ -1 +1 @@
1
- {"version":3,"sources":["marker/type.ts"],"names":[],"mappings":";;;AAaA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport { IGraphic } from '@visactor/vrender';\nimport type { Dict, IPointLike } from '@visactor/vutils';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport interface IMarkLabel extends Omit<TagAttributes, 'x' | 'y' | 'panel'> {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n}\n\nexport interface IMarkRef {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\nexport interface MarkerAttrs extends IGroupGraphicAttribute {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * clip范围配置\n */\n clipRange?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\nexport interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: IPointLike[];\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n } & IMarkRef &\n IMarkLabel;\n}\n\nexport interface MarkAreaAttrs extends MarkerAttrs {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: IPointLike[];\n /**\n * 标签\n */\n label?: {\n position?: IMarkAreaLabelPosition;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n}\n\nexport interface IItemContent extends IMarkRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n}\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport interface MarkPointAttrs extends Omit<MarkerAttrs, 'labelStyle'> {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: IPointLike;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n}\n"]}
1
+ {"version":3,"sources":["marker/type.ts"],"names":[],"mappings":";;;AAaA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport { IGraphic } from '@visactor/vrender';\nimport type { Dict, IPointLike } from '@visactor/vutils';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport interface IMarkLabel extends Omit<TagAttributes, 'x' | 'y' | 'panel'> {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n}\n\nexport interface IMarkRef {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\nexport interface MarkerAttrs extends IGroupGraphicAttribute {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n}\n\nexport interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: IPointLike[];\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n } & IMarkRef &\n IMarkLabel;\n}\n\nexport interface MarkAreaAttrs extends MarkerAttrs {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: IPointLike[];\n /**\n * 标签\n */\n label?: {\n position?: IMarkAreaLabelPosition;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n}\n\nexport interface IItemContent extends IMarkRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n}\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport interface MarkPointAttrs extends Omit<MarkerAttrs, 'labelStyle'> {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: IPointLike;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n}\n"]}
@@ -73,17 +73,17 @@ class ContinuousPlayer extends base_player_1.BasePlayer {
73
73
  }, this.play = () => __awaiter(this, void 0, void 0, (function*() {
74
74
  this._isPlaying || (this._controller.togglePause(), this._isPlaying = !0, this._elapsed >= this._totalDuration && (this._elapsed = 0),
75
75
  this._startTime = Date.now() - this._elapsed, this.dispatchCustomEvent(type_1.PlayerEventEnum.OnPlay),
76
- this._rafId = vrender_1.global.getRequestAnimationFrame()(this._play.bind(this)));
76
+ this._rafId = vrender_1.vglobal.getRequestAnimationFrame()(this._play.bind(this)));
77
77
  })), this._play = () => {
78
78
  this._elapsed = Date.now() - this._startTime;
79
79
  const value = this._getSliderValue();
80
- this._updateSlider(), value >= this._maxIndex ? this._playEnd() : this._rafId = vrender_1.global.getRequestAnimationFrame()(this._play.bind(this));
80
+ this._updateSlider(), value >= this._maxIndex ? this._playEnd() : this._rafId = vrender_1.vglobal.getRequestAnimationFrame()(this._play.bind(this));
81
81
  }, this._playEnd = () => {
82
- this._isPlaying = !1, vrender_1.global.getCancelAnimationFrame()(this._rafId), this._controller.togglePlay(),
83
- this.dispatchCustomEvent(type_1.PlayerEventEnum.OnEnd);
82
+ this._isPlaying = !1, vrender_1.vglobal.getCancelAnimationFrame()(this._rafId),
83
+ this._controller.togglePlay(), this.dispatchCustomEvent(type_1.PlayerEventEnum.OnEnd);
84
84
  }, this.pause = () => {
85
85
  this._isPlaying && (this._isPlaying = !1, this._elapsed = Date.now() - this._startTime,
86
- vrender_1.global.getCancelAnimationFrame()(this._rafId), this._controller.togglePlay(),
86
+ vrender_1.vglobal.getCancelAnimationFrame()(this._rafId), this._controller.togglePlay(),
87
87
  this.dispatchCustomEvent(type_1.PlayerEventEnum.OnPause));
88
88
  }, this.backward = () => {
89
89
  const now = Date.now(), interval = 1 * this._interval, elapsed = this._elapsed - interval;
@@ -1 +1 @@
1
- {"version":3,"sources":["player/continuous-player.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+CAA2C;AAC3C,+CAA2C;AAE3C,iCAAyC;AACzC,oDAA4D;AAS5D,MAAa,gBAAiB,SAAQ,wBAAsC;IAe1E,YAAY,UAAsC;QAChD,KAAK,CAAC,UAAU,CAAC,CAAC;QANZ,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAcxC,oBAAe,GAAG,GAAG,EAAE;;YACrB,KAAK,CAAC,eAAe,EAAE,CAAC;YAExB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,K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,CAAC;IACrB,CAAC;IA2GD,mBAAmB,CAAC,SAA0B;QAC5C,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAiID,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;CACF;AArQD,4CAqQC","file":"continuous-player.js","sourcesContent":["import type { FederatedPointerEvent } from '@visactor/vrender';\nimport { global } from '@visactor/vrender';\nimport { BasePlayer } from './base-player';\nimport type { ContinuousPlayerAttributes } from './type';\nimport { PlayerEventEnum } from './type';\nimport { ControllerEventEnum } from './controller/constant';\n\nexport interface IContinuousPlayer {\n play: () => Promise<void>;\n pause: () => void;\n forward: () => void;\n backward: () => void;\n}\n\nexport class ContinuousPlayer extends BasePlayer<ContinuousPlayerAttributes> implements IContinuousPlayer {\n declare attribute: ContinuousPlayerAttributes;\n\n private _dataIndex: number;\n private _activeIndex: number;\n\n protected _alternate: boolean;\n protected _interval: number;\n protected _totalDuration: number;\n\n private _isPlaying = false;\n private _startTime: number = Date.now();\n private _elapsed: number;\n private _rafId: number;\n\n constructor(attributes: ContinuousPlayerAttributes) {\n super(attributes);\n\n this._initAttributes();\n this._initEvents();\n }\n\n /**\n * 初始化属性\n */\n _initAttributes = () => {\n super._initAttributes();\n // 新增一个占位数据\n this._maxIndex = this._data.length;\n this._slider.setAttribute('max', this._maxIndex);\n\n this._isPlaying = false;\n this._elapsed = 0;\n this._interval = this.attribute.interval ?? 1000;\n this._dataIndex = this.attribute.dataIndex ?? this._minIndex;\n\n // 播放帧数(10条数据, 需要10个播放帧)\n const frames = this._data.length;\n\n // 若用户配置了总时长\n if (this.attribute.totalDuration && this._data.length) {\n this._totalDuration = this.attribute.totalDuration;\n // 避免除0\n this._interval = this._totalDuration / (frames ?? 1);\n }\n // 若未配置总时长, 则根据interval算出一个总时长, interval有默认值\n else {\n this._totalDuration = this._interval * frames;\n this._interval = this.attribute.interval;\n }\n };\n\n /**\n * 初始化事件\n */\n private _initEvents = () => {\n this._controller.addEventListener(ControllerEventEnum.OnPlay, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.play();\n });\n this._controller.addEventListener(ControllerEventEnum.OnPause, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.pause();\n });\n this._controller.addEventListener(ControllerEventEnum.OnForward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n this._controller.addEventListener(ControllerEventEnum.OnBackward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._slider.addEventListener('change', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n /**\n * 根据value, 反推开始时间\n * 1. 计算进度\n * 2. 计算流逝时间\n * 3. 用现在的时间, 模拟一个开始时间\n */\n const value = (e.detail as unknown as { value: number; position: number })?.value;\n const progress = value / this._maxIndex;\n this._elapsed = progress * this._totalDuration;\n this._startTime = Date.now() - this._elapsed;\n\n this._dispatchChange(value);\n });\n };\n\n /**\n * 根据已流逝时间和总时长, 计算slider的值\n */\n private _getSliderValue = () => {\n const progress = this._elapsed / this._totalDuration;\n return Math.min(progress * this._maxIndex, this._maxIndex);\n };\n\n /**\n * 根据流逝时间, 更新Slider的值\n */\n private _updateSlider = () => {\n const value = this._getSliderValue();\n this._dataIndex = Math.floor(value);\n this._slider.setValue(Math.min(value, this._maxIndex));\n this._dispatchChange(Math.floor(value));\n };\n\n /**\n * 根据Slider的值, 判断是否要触发Change事件.\n */\n private _dispatchChange = (value: number) => {\n const index = Math.floor(value);\n if (index !== this._activeIndex) {\n this._dataIndex = index;\n this._activeIndex = index;\n\n if (index !== this._maxIndex) {\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n }\n }\n };\n\n /**\n * 派遣事件\n * @param eventType 事件类型\n */\n dispatchCustomEvent(eventType: PlayerEventEnum) {\n super.dispatchCustomEvent(eventType, this._dataIndex);\n }\n\n /**\n * 播放接口\n */\n play = async () => {\n if (this._isPlaying) {\n return;\n }\n // 切换按钮\n this._controller.togglePause();\n // 播放状态更新\n this._isPlaying = true;\n // 播放结束后再点击play, 此条件下生效.\n if (this._elapsed >= this._totalDuration) {\n this._elapsed = 0;\n }\n // 此时此刻减去已流逝的时间, 则为起点对应的时间戳.\n this._startTime = Date.now() - this._elapsed;\n // 事件\n this.dispatchCustomEvent(PlayerEventEnum.OnPlay);\n // 开始播放动画\n this._rafId = global.getRequestAnimationFrame()(this._play.bind(this));\n };\n\n /**\n * 播放动画主要逻辑\n */\n private _play = () => {\n // 计算已流逝的时间, 但不需要保存\n this._elapsed = Date.now() - this._startTime;\n // 计算Slider的值.\n const value = this._getSliderValue();\n // 更新Slider的值.\n this._updateSlider();\n\n // 播放终止条件\n if (value >= this._maxIndex) {\n this._playEnd();\n return;\n }\n\n // 持续播放\n this._rafId = global.getRequestAnimationFrame()(this._play.bind(this));\n };\n\n /**\n * 播放结束时触发\n */\n private _playEnd = () => {\n // 播放状态更新\n this._isPlaying = false;\n // 取消播放动画\n global.getCancelAnimationFrame()(this._rafId);\n // 切换按钮\n this._controller.togglePlay();\n // 事件\n this.dispatchCustomEvent(PlayerEventEnum.OnEnd);\n };\n\n /**\n * 暂停接口\n */\n pause = () => {\n if (!this._isPlaying) {\n return;\n }\n this._isPlaying = false;\n // 计算已流逝的时间, 需要记录下来\n this._elapsed = Date.now() - this._startTime;\n global.getCancelAnimationFrame()(this._rafId);\n this._controller.togglePlay();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnPause);\n };\n\n /**\n * 前进接口\n */\n backward = () => {\n // 按下按钮的时间\n const now = Date.now();\n // 步长\n const interval = this._interval * 1;\n // 流逝时间 减去 interval\n const elapsed = this._elapsed - interval;\n\n // 若到达起点\n if (elapsed <= 0) {\n this._elapsed = 0;\n this._startTime = now;\n }\n // 若未到达起点\n else {\n this._elapsed = elapsed;\n this._startTime = this._startTime + this._interval;\n }\n // 更新slider\n this._updateSlider();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnBackward);\n };\n\n /**\n * 后退接口\n */\n forward = () => {\n // 按下按钮的时间\n const now = Date.now();\n // 步长\n const interval = this._interval * 1;\n // 流逝时间 加上 1个interval\n const elapsed = this._elapsed + interval;\n // 若超过终点\n if (elapsed >= this._totalDuration) {\n this._startTime = now - this._totalDuration;\n this._elapsed = this._totalDuration;\n }\n // 未超过终点\n else {\n this._startTime = this._startTime - interval;\n this._elapsed = elapsed;\n }\n // 更新slider\n this._updateSlider();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnForward);\n };\n\n render() {\n super.render();\n }\n}\n"]}
1
+ {"version":3,"sources":["player/continuous-player.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+CAA4C;AAC5C,+CAA2C;AAE3C,iCAAyC;AACzC,oDAA4D;AAS5D,MAAa,gBAAiB,SAAQ,wBAAsC;IAe1E,YAAY,UAAsC;QAChD,KAAK,CAAC,UAAU,CAAC,CAAC;QANZ,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAcxC,oBAAe,GAAG,GAAG,EAAE;;YACrB,KAAK,CAAC,eAAe,EAAE,CAAC;YAExB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAEjD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YAClB,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,mCAAI,IAAI,CAAC;YACjD,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,SAAS,mCAAI,IAAI,CAAC,SAAS,CAAC;YAG7D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YAGjC,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,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IAAI,CAAC,aAAa,EAAE,CAAC;YAErB,IAAI,CAAC,mBAAmB,CAAC,sBAAe,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC,CAAC;QAKF,YAAO,GAAG,GAAG,EAAE;YAEb,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;YAEpC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAEzC,IAAI,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE;gBAClC,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;gBAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;aACrC;iBAEI;gBACH,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;gBAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;aACzB;YAED,IAAI,CAAC,aAAa,EAAE,CAAC;YAErB,IAAI,CAAC,mBAAmB,CAAC,sBAAe,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC,CAAC;QA9OA,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IA2GD,mBAAmB,CAAC,SAA0B;QAC5C,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAiID,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;CACF;AArQD,4CAqQC","file":"continuous-player.js","sourcesContent":["import type { FederatedPointerEvent } from '@visactor/vrender';\nimport { vglobal } from '@visactor/vrender';\nimport { BasePlayer } from './base-player';\nimport type { ContinuousPlayerAttributes } from './type';\nimport { PlayerEventEnum } from './type';\nimport { ControllerEventEnum } from './controller/constant';\n\nexport interface IContinuousPlayer {\n play: () => Promise<void>;\n pause: () => void;\n forward: () => void;\n backward: () => void;\n}\n\nexport class ContinuousPlayer extends BasePlayer<ContinuousPlayerAttributes> implements IContinuousPlayer {\n declare attribute: ContinuousPlayerAttributes;\n\n private _dataIndex: number;\n private _activeIndex: number;\n\n protected _alternate: boolean;\n protected _interval: number;\n protected _totalDuration: number;\n\n private _isPlaying = false;\n private _startTime: number = Date.now();\n private _elapsed: number;\n private _rafId: number;\n\n constructor(attributes: ContinuousPlayerAttributes) {\n super(attributes);\n\n this._initAttributes();\n this._initEvents();\n }\n\n /**\n * 初始化属性\n */\n _initAttributes = () => {\n super._initAttributes();\n // 新增一个占位数据\n this._maxIndex = this._data.length;\n this._slider.setAttribute('max', this._maxIndex);\n\n this._isPlaying = false;\n this._elapsed = 0;\n this._interval = this.attribute.interval ?? 1000;\n this._dataIndex = this.attribute.dataIndex ?? this._minIndex;\n\n // 播放帧数(10条数据, 需要10个播放帧)\n const frames = this._data.length;\n\n // 若用户配置了总时长\n if (this.attribute.totalDuration && this._data.length) {\n this._totalDuration = this.attribute.totalDuration;\n // 避免除0\n this._interval = this._totalDuration / (frames ?? 1);\n }\n // 若未配置总时长, 则根据interval算出一个总时长, interval有默认值\n else {\n this._totalDuration = this._interval * frames;\n this._interval = this.attribute.interval;\n }\n };\n\n /**\n * 初始化事件\n */\n private _initEvents = () => {\n this._controller.addEventListener(ControllerEventEnum.OnPlay, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.play();\n });\n this._controller.addEventListener(ControllerEventEnum.OnPause, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.pause();\n });\n this._controller.addEventListener(ControllerEventEnum.OnForward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n this._controller.addEventListener(ControllerEventEnum.OnBackward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._slider.addEventListener('change', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n /**\n * 根据value, 反推开始时间\n * 1. 计算进度\n * 2. 计算流逝时间\n * 3. 用现在的时间, 模拟一个开始时间\n */\n const value = (e.detail as unknown as { value: number; position: number })?.value;\n const progress = value / this._maxIndex;\n this._elapsed = progress * this._totalDuration;\n this._startTime = Date.now() - this._elapsed;\n\n this._dispatchChange(value);\n });\n };\n\n /**\n * 根据已流逝时间和总时长, 计算slider的值\n */\n private _getSliderValue = () => {\n const progress = this._elapsed / this._totalDuration;\n return Math.min(progress * this._maxIndex, this._maxIndex);\n };\n\n /**\n * 根据流逝时间, 更新Slider的值\n */\n private _updateSlider = () => {\n const value = this._getSliderValue();\n this._dataIndex = Math.floor(value);\n this._slider.setValue(Math.min(value, this._maxIndex));\n this._dispatchChange(Math.floor(value));\n };\n\n /**\n * 根据Slider的值, 判断是否要触发Change事件.\n */\n private _dispatchChange = (value: number) => {\n const index = Math.floor(value);\n if (index !== this._activeIndex) {\n this._dataIndex = index;\n this._activeIndex = index;\n\n if (index !== this._maxIndex) {\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n }\n }\n };\n\n /**\n * 派遣事件\n * @param eventType 事件类型\n */\n dispatchCustomEvent(eventType: PlayerEventEnum) {\n super.dispatchCustomEvent(eventType, this._dataIndex);\n }\n\n /**\n * 播放接口\n */\n play = async () => {\n if (this._isPlaying) {\n return;\n }\n // 切换按钮\n this._controller.togglePause();\n // 播放状态更新\n this._isPlaying = true;\n // 播放结束后再点击play, 此条件下生效.\n if (this._elapsed >= this._totalDuration) {\n this._elapsed = 0;\n }\n // 此时此刻减去已流逝的时间, 则为起点对应的时间戳.\n this._startTime = Date.now() - this._elapsed;\n // 事件\n this.dispatchCustomEvent(PlayerEventEnum.OnPlay);\n // 开始播放动画\n this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this));\n };\n\n /**\n * 播放动画主要逻辑\n */\n private _play = () => {\n // 计算已流逝的时间, 但不需要保存\n this._elapsed = Date.now() - this._startTime;\n // 计算Slider的值.\n const value = this._getSliderValue();\n // 更新Slider的值.\n this._updateSlider();\n\n // 播放终止条件\n if (value >= this._maxIndex) {\n this._playEnd();\n return;\n }\n\n // 持续播放\n this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this));\n };\n\n /**\n * 播放结束时触发\n */\n private _playEnd = () => {\n // 播放状态更新\n this._isPlaying = false;\n // 取消播放动画\n vglobal.getCancelAnimationFrame()(this._rafId);\n // 切换按钮\n this._controller.togglePlay();\n // 事件\n this.dispatchCustomEvent(PlayerEventEnum.OnEnd);\n };\n\n /**\n * 暂停接口\n */\n pause = () => {\n if (!this._isPlaying) {\n return;\n }\n this._isPlaying = false;\n // 计算已流逝的时间, 需要记录下来\n this._elapsed = Date.now() - this._startTime;\n vglobal.getCancelAnimationFrame()(this._rafId);\n this._controller.togglePlay();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnPause);\n };\n\n /**\n * 前进接口\n */\n backward = () => {\n // 按下按钮的时间\n const now = Date.now();\n // 步长\n const interval = this._interval * 1;\n // 流逝时间 减去 interval\n const elapsed = this._elapsed - interval;\n\n // 若到达起点\n if (elapsed <= 0) {\n this._elapsed = 0;\n this._startTime = now;\n }\n // 若未到达起点\n else {\n this._elapsed = elapsed;\n this._startTime = this._startTime + this._interval;\n }\n // 更新slider\n this._updateSlider();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnBackward);\n };\n\n /**\n * 后退接口\n */\n forward = () => {\n // 按下按钮的时间\n const now = Date.now();\n // 步长\n const interval = this._interval * 1;\n // 流逝时间 加上 1个interval\n const elapsed = this._elapsed + interval;\n // 若超过终点\n if (elapsed >= this._totalDuration) {\n this._startTime = now - this._totalDuration;\n this._elapsed = this._totalDuration;\n }\n // 未超过终点\n else {\n this._startTime = this._startTime - interval;\n this._elapsed = elapsed;\n }\n // 更新slider\n this._updateSlider();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnForward);\n };\n\n render() {\n super.render();\n }\n}\n"]}
@@ -44,7 +44,7 @@ class DiscretePlayer extends base_player_1.BasePlayer {
44
44
  direction: this._direction
45
45
  })) && (this._direction === type_1.DirectionEnum.Default ? this._updateDataIndex(this._minIndex) : this._updateDataIndex(this._maxIndex)),
46
46
  this.dispatchCustomEvent(type_1.PlayerEventEnum.OnPlay), this._isReachEnd = !1,
47
- this._tickTime = Date.now(), this._rafId = vrender_1.global.getRequestAnimationFrame()(this._play.bind(this, !0)));
47
+ this._tickTime = Date.now(), this._rafId = vrender_1.vglobal.getRequestAnimationFrame()(this._play.bind(this, !0)));
48
48
  }, this._play = isFirstPlay => {
49
49
  const now = Date.now();
50
50
  if (this._isReachEnd && now - this._tickTime >= this._interval) return this._isReachEnd = !1,
@@ -54,14 +54,14 @@ class DiscretePlayer extends base_player_1.BasePlayer {
54
54
  this._updateDataIndex((0, utils_1.forwardStep)(this._direction, this._dataIndex, this._minIndex, this._maxIndex)),
55
55
  this._activeIndex = this._dataIndex, this.dispatchCustomEvent(type_1.PlayerEventEnum.OnChange)),
56
56
  ("default" === this._direction && this._dataIndex >= this._maxIndex || "reverse" === this._direction && this._dataIndex <= this._minIndex) && (this._isReachEnd = !0),
57
- this._rafId = vrender_1.global.getRequestAnimationFrame()(this._play.bind(this, !1));
57
+ this._rafId = vrender_1.vglobal.getRequestAnimationFrame()(this._play.bind(this, !1));
58
58
  }, this._updateDataIndex = dataIndex => {
59
59
  this._dataIndex = dataIndex, this._slider.setValue(this._dataIndex);
60
60
  }, this._playEnd = () => {
61
- this._isPlaying = !1, this._controller.togglePlay(), vrender_1.global.getCancelAnimationFrame()(this._rafId),
61
+ this._isPlaying = !1, this._controller.togglePlay(), vrender_1.vglobal.getCancelAnimationFrame()(this._rafId),
62
62
  this._activeIndex = -1, this.dispatchCustomEvent(type_1.PlayerEventEnum.OnEnd);
63
63
  }, this.pause = () => {
64
- this._isPlaying && (this._isPlaying = !1, vrender_1.global.getCancelAnimationFrame()(this._rafId),
64
+ this._isPlaying && (this._isPlaying = !1, vrender_1.vglobal.getCancelAnimationFrame()(this._rafId),
65
65
  this._controller.togglePlay(), this.dispatchCustomEvent(type_1.PlayerEventEnum.OnPause));
66
66
  }, this.backward = () => {
67
67
  const index = Math.max(this._dataIndex - 1, this._minIndex);
@@ -1 +1 @@
1
- {"version":3,"sources":["player/discrete-player.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAEhD,+CAA2C;AAC3C,+CAA2C;AAE3C,iCAAwD;AACxD,mCAAgE;AAChE,oDAA4D;AAQ5D,MAAa,cAAe,SAAQ,wBAAoC;IAetE,YAAY,UAAoC;QAC9C,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;QAZvB,iBAAY,GAAG,CAAC,CAAC,CAAC;QASlB,gBAAW,GAAG,KAAK,CAAC;QAkB5B,oBAAe,GAAG,GAAG,EAAE;;YACrB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,SAAS,mCAAI,KAAK,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,mCAAI,IAAI,CAAC;YACjD,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,SAAS,mCAAI,oBAAa,CAAC,OAAO,CAAC;YAEpE,IAAI,CAAC,UAAU,GAAG,IAAA,cAAK,EAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;gBAC/C,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS;oBAC7B,CAAC,CAAC,IAAI,CAAC,SAAS;oBAChB,CAAC,CAAC,IAAI,CAAC,SAAS;gBAClB,CAAC,CAAC,MAAA,IAAI,CAAC,SAAS,CAAC,SAAS,mCAAI,CAAC,CAAC;YAElC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,CAAC,CAAC;QAKM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,WAAW,CAA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,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,mBAAmB,CAAC,sBAAe,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC,CAAC;QAKF,YAAO,GAAG,GAAG,EAAE;YACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5D,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAE7B,IAAI,CAAC,mBAAmB,CAAC,sBAAe,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,mBAAmB,CAAC,sBAAe,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC,CAAC;QAhNA,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,MAA2C,EAAE,cAAwB;QACjF,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAE5C,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAoDD,mBAAmB,CAAC,KAAsB;QACxC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CAmJF;AAnOD,wCAmOC","file":"discrete-player.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent } from '@visactor/vrender';\nimport { global } from '@visactor/vrender';\nimport { BasePlayer } from './base-player';\nimport type { DirectionType, DiscretePlayerAttributes, PlayerAttributes } from './type';\nimport { DirectionEnum, PlayerEventEnum } from './type';\nimport { forwardStep, isReachEnd, isReachStart } from './utils';\nimport { ControllerEventEnum } from './controller/constant';\n\nexport interface IDiscretePlayer {\n play: () => void;\n pause: () => void;\n backward: () => void;\n forward: () => void;\n}\nexport class DiscretePlayer extends BasePlayer<DiscretePlayerAttributes> implements IDiscretePlayer {\n declare attribute: DiscretePlayerAttributes;\n\n private _dataIndex: number;\n private _activeIndex = -1;\n\n protected _alternate: boolean;\n protected _interval: number;\n\n private _isPlaying: boolean;\n private _direction: DirectionType;\n private _tickTime: number;\n private _rafId: number;\n private _isReachEnd = false;\n\n constructor(attributes: DiscretePlayerAttributes) {\n super(merge({}, attributes));\n\n this._initAttributes();\n this._initEvents();\n }\n\n setAttributes(params: Partial<Required<PlayerAttributes>>, forceUpdateTag?: boolean): void {\n super.setAttributes(params, forceUpdateTag);\n\n this._initAttributes();\n }\n\n /**\n * 初始化属性\n */\n _initAttributes = () => {\n super._initAttributes();\n this._alternate = this.attribute.alternate ?? false;\n this._interval = this.attribute.interval ?? 1000;\n this._direction = this.attribute.direction ?? DirectionEnum.Default;\n\n this._dataIndex = isNil(this.attribute.dataIndex)\n ? this._direction === 'default'\n ? this._minIndex\n : this._maxIndex\n : this.attribute.dataIndex ?? 0;\n\n this._slider.setAttribute('value', this._dataIndex);\n };\n\n /**\n * 初始化事件\n */\n private _initEvents = () => {\n this._controller.addEventListener(ControllerEventEnum.OnPlay, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.play();\n });\n this._controller.addEventListener(ControllerEventEnum.OnPause, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.pause();\n });\n this._controller.addEventListener(ControllerEventEnum.OnForward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n this._controller.addEventListener(ControllerEventEnum.OnBackward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._slider.addEventListener('change', (e: FederatedPointerEvent & { detail: { value: number } }) => {\n const middle = Math.floor(e.detail.value) + 0.5;\n this._dataIndex = e.detail.value >= middle ? Math.ceil(e.detail.value) : Math.floor(e.detail.value);\n this._slider.setValue(this._dataIndex);\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n });\n };\n\n /**\n * 派遣事件\n */\n dispatchCustomEvent(event: PlayerEventEnum) {\n super.dispatchCustomEvent(event, this._dataIndex);\n }\n\n /**\n * 播放接口\n */\n play = () => {\n if (this._isPlaying) {\n return;\n }\n // 一条数据无需播放\n if (this._data.length === 1) {\n return;\n }\n // 图标切换\n this._controller.togglePause();\n // 播放状态更新\n this._isPlaying = true;\n // 若到达末尾, 则计算下一次播放的状态下标\n if (\n isReachEnd({\n dataIndex: this._dataIndex,\n maxIndex: this._maxIndex,\n minIndex: this._minIndex,\n direction: this._direction\n }) ||\n isReachStart({\n dataIndex: this._dataIndex,\n maxIndex: this._maxIndex,\n minIndex: this._minIndex,\n direction: this._direction\n })\n ) {\n // 根据方向恢复dataIndex\n if (this._direction === DirectionEnum.Default) {\n this._updateDataIndex(this._minIndex);\n } else {\n this._updateDataIndex(this._maxIndex);\n }\n }\n\n // 事件触发\n this.dispatchCustomEvent(PlayerEventEnum.OnPlay);\n // 重置结束状态\n this._isReachEnd = false;\n // 重置tick时间, 暂停后重新播放也会重新计时\n this._tickTime = Date.now();\n // 开启动画\n this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, true));\n };\n\n /**\n * 播放过程\n */\n private _play = (isFirstPlay: boolean) => {\n const now = Date.now();\n\n // 抵达终点, 延迟一个interval触发end\n if (this._isReachEnd && now - this._tickTime >= this._interval) {\n this._isReachEnd = false;\n this._playEnd();\n return;\n }\n // 未达终点\n\n // 第一个播放帧, 立即执行\n if (isFirstPlay && this._activeIndex !== this._dataIndex) {\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this._activeIndex = this._dataIndex;\n }\n // 中间播放帧, 每一个interval执行一次\n else if (now - this._tickTime >= this._interval) {\n this._tickTime = now;\n this._updateDataIndex(forwardStep(this._direction, this._dataIndex, this._minIndex, this._maxIndex));\n this._activeIndex = this._dataIndex;\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n }\n\n // 终止条件\n if (\n (this._direction === 'default' && this._dataIndex >= this._maxIndex) ||\n (this._direction === 'reverse' && this._dataIndex <= this._minIndex)\n ) {\n this._isReachEnd = true;\n }\n\n this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, false));\n };\n\n /**\n * 更新数据\n */\n private _updateDataIndex = (dataIndex: number) => {\n this._dataIndex = dataIndex;\n this._slider.setValue(this._dataIndex);\n };\n\n /**\n * 播放结束\n */\n private _playEnd = () => {\n // 播放状态更新\n this._isPlaying = false;\n // 图标切换\n this._controller.togglePlay();\n // 取消播放动画\n global.getCancelAnimationFrame()(this._rafId);\n // 重置ActiveIndex\n this._activeIndex = -1;\n // 播放结束时并且到达终点\n this.dispatchCustomEvent(PlayerEventEnum.OnEnd);\n };\n\n /**\n * 暂停接口\n */\n pause = () => {\n if (!this._isPlaying) {\n return;\n }\n this._isPlaying = false;\n global.getCancelAnimationFrame()(this._rafId);\n this._controller.togglePlay();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnPause);\n };\n\n /**\n * 后退接口\n */\n backward = () => {\n const index = Math.max(this._dataIndex - 1, this._minIndex);\n this._updateDataIndex(index);\n\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this.dispatchCustomEvent(PlayerEventEnum.OnBackward);\n };\n\n /**\n * 前进接口\n */\n forward = () => {\n const index = Math.min(this._dataIndex + 1, this._maxIndex);\n this._updateDataIndex(index);\n\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this.dispatchCustomEvent(PlayerEventEnum.OnForward);\n };\n}\n"]}
1
+ {"version":3,"sources":["player/discrete-player.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAEhD,+CAA4C;AAC5C,+CAA2C;AAE3C,iCAAwD;AACxD,mCAAgE;AAChE,oDAA4D;AAQ5D,MAAa,cAAe,SAAQ,wBAAoC;IAetE,YAAY,UAAoC;QAC9C,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;QAZvB,iBAAY,GAAG,CAAC,CAAC,CAAC;QASlB,gBAAW,GAAG,KAAK,CAAC;QAkB5B,oBAAe,GAAG,GAAG,EAAE;;YACrB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB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ACrB,CAAC;IAED,aAAa,CAAC,MAA2C,EAAE,cAAwB;QACjF,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAE5C,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAoDD,mBAAmB,CAAC,KAAsB;QACxC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CAmJF;AAnOD,wCAmOC","file":"discrete-player.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent } from '@visactor/vrender';\nimport { vglobal } from '@visactor/vrender';\nimport { BasePlayer } from './base-player';\nimport type { DirectionType, DiscretePlayerAttributes, PlayerAttributes } from './type';\nimport { DirectionEnum, PlayerEventEnum } from './type';\nimport { forwardStep, isReachEnd, isReachStart } from './utils';\nimport { ControllerEventEnum } from './controller/constant';\n\nexport interface IDiscretePlayer {\n play: () => void;\n pause: () => void;\n backward: () => void;\n forward: () => void;\n}\nexport class DiscretePlayer extends BasePlayer<DiscretePlayerAttributes> implements IDiscretePlayer {\n declare attribute: DiscretePlayerAttributes;\n\n private _dataIndex: number;\n private _activeIndex = -1;\n\n protected _alternate: boolean;\n protected _interval: number;\n\n private _isPlaying: boolean;\n private _direction: DirectionType;\n private _tickTime: number;\n private _rafId: number;\n private _isReachEnd = false;\n\n constructor(attributes: DiscretePlayerAttributes) {\n super(merge({}, attributes));\n\n this._initAttributes();\n this._initEvents();\n }\n\n setAttributes(params: Partial<Required<PlayerAttributes>>, forceUpdateTag?: boolean): void {\n super.setAttributes(params, forceUpdateTag);\n\n this._initAttributes();\n }\n\n /**\n * 初始化属性\n */\n _initAttributes = () => {\n super._initAttributes();\n this._alternate = this.attribute.alternate ?? false;\n this._interval = this.attribute.interval ?? 1000;\n this._direction = this.attribute.direction ?? DirectionEnum.Default;\n\n this._dataIndex = isNil(this.attribute.dataIndex)\n ? this._direction === 'default'\n ? this._minIndex\n : this._maxIndex\n : this.attribute.dataIndex ?? 0;\n\n this._slider.setAttribute('value', this._dataIndex);\n };\n\n /**\n * 初始化事件\n */\n private _initEvents = () => {\n this._controller.addEventListener(ControllerEventEnum.OnPlay, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.play();\n });\n this._controller.addEventListener(ControllerEventEnum.OnPause, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.pause();\n });\n this._controller.addEventListener(ControllerEventEnum.OnForward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n this._controller.addEventListener(ControllerEventEnum.OnBackward, (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._slider.addEventListener('change', (e: FederatedPointerEvent & { detail: { value: number } }) => {\n const middle = Math.floor(e.detail.value) + 0.5;\n this._dataIndex = e.detail.value >= middle ? Math.ceil(e.detail.value) : Math.floor(e.detail.value);\n this._slider.setValue(this._dataIndex);\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n });\n };\n\n /**\n * 派遣事件\n */\n dispatchCustomEvent(event: PlayerEventEnum) {\n super.dispatchCustomEvent(event, this._dataIndex);\n }\n\n /**\n * 播放接口\n */\n play = () => {\n if (this._isPlaying) {\n return;\n }\n // 一条数据无需播放\n if (this._data.length === 1) {\n return;\n }\n // 图标切换\n this._controller.togglePause();\n // 播放状态更新\n this._isPlaying = true;\n // 若到达末尾, 则计算下一次播放的状态下标\n if (\n isReachEnd({\n dataIndex: this._dataIndex,\n maxIndex: this._maxIndex,\n minIndex: this._minIndex,\n direction: this._direction\n }) ||\n isReachStart({\n dataIndex: this._dataIndex,\n maxIndex: this._maxIndex,\n minIndex: this._minIndex,\n direction: this._direction\n })\n ) {\n // 根据方向恢复dataIndex\n if (this._direction === DirectionEnum.Default) {\n this._updateDataIndex(this._minIndex);\n } else {\n this._updateDataIndex(this._maxIndex);\n }\n }\n\n // 事件触发\n this.dispatchCustomEvent(PlayerEventEnum.OnPlay);\n // 重置结束状态\n this._isReachEnd = false;\n // 重置tick时间, 暂停后重新播放也会重新计时\n this._tickTime = Date.now();\n // 开启动画\n this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, true));\n };\n\n /**\n * 播放过程\n */\n private _play = (isFirstPlay: boolean) => {\n const now = Date.now();\n\n // 抵达终点, 延迟一个interval触发end\n if (this._isReachEnd && now - this._tickTime >= this._interval) {\n this._isReachEnd = false;\n this._playEnd();\n return;\n }\n // 未达终点\n\n // 第一个播放帧, 立即执行\n if (isFirstPlay && this._activeIndex !== this._dataIndex) {\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this._activeIndex = this._dataIndex;\n }\n // 中间播放帧, 每一个interval执行一次\n else if (now - this._tickTime >= this._interval) {\n this._tickTime = now;\n this._updateDataIndex(forwardStep(this._direction, this._dataIndex, this._minIndex, this._maxIndex));\n this._activeIndex = this._dataIndex;\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n }\n\n // 终止条件\n if (\n (this._direction === 'default' && this._dataIndex >= this._maxIndex) ||\n (this._direction === 'reverse' && this._dataIndex <= this._minIndex)\n ) {\n this._isReachEnd = true;\n }\n\n this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, false));\n };\n\n /**\n * 更新数据\n */\n private _updateDataIndex = (dataIndex: number) => {\n this._dataIndex = dataIndex;\n this._slider.setValue(this._dataIndex);\n };\n\n /**\n * 播放结束\n */\n private _playEnd = () => {\n // 播放状态更新\n this._isPlaying = false;\n // 图标切换\n this._controller.togglePlay();\n // 取消播放动画\n vglobal.getCancelAnimationFrame()(this._rafId);\n // 重置ActiveIndex\n this._activeIndex = -1;\n // 播放结束时并且到达终点\n this.dispatchCustomEvent(PlayerEventEnum.OnEnd);\n };\n\n /**\n * 暂停接口\n */\n pause = () => {\n if (!this._isPlaying) {\n return;\n }\n this._isPlaying = false;\n vglobal.getCancelAnimationFrame()(this._rafId);\n this._controller.togglePlay();\n\n this.dispatchCustomEvent(PlayerEventEnum.OnPause);\n };\n\n /**\n * 后退接口\n */\n backward = () => {\n const index = Math.max(this._dataIndex - 1, this._minIndex);\n this._updateDataIndex(index);\n\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this.dispatchCustomEvent(PlayerEventEnum.OnBackward);\n };\n\n /**\n * 前进接口\n */\n forward = () => {\n const index = Math.min(this._dataIndex + 1, this._maxIndex);\n this._updateDataIndex(index);\n\n this.dispatchCustomEvent(PlayerEventEnum.OnChange);\n this.dispatchCustomEvent(PlayerEventEnum.OnForward);\n };\n}\n"]}
@@ -25,8 +25,8 @@ class ScrollBar extends base_1.AbstractComponent {
25
25
  }, this._onSliderPointerDown = e => {
26
26
  e.stopPropagation();
27
27
  const {direction: direction} = this.attribute;
28
- this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" === vrender_1.global.env ? (vrender_1.global.addEventListener("pointermove", this._onSliderPointerMove),
29
- vrender_1.global.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove),
28
+ this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" === vrender_1.vglobal.env ? (vrender_1.vglobal.addEventListener("pointermove", this._onSliderPointerMove),
29
+ vrender_1.vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove),
30
30
  this._slider.addEventListener("pointerup", this._onSliderPointerUp), this._slider.addEventListener("pointerupoutside", this._onSliderPointerUp));
31
31
  }, this._onSliderPointerMove = e => {
32
32
  e.stopPropagation();
@@ -38,8 +38,8 @@ class ScrollBar extends base_1.AbstractComponent {
38
38
  currentScrollValue = delta / width), this.setScrollRange([ preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue ], !0),
39
39
  this._prePos = currentPos;
40
40
  }, this._onSliderPointerUp = e => {
41
- e.preventDefault(), "browser" === vrender_1.global.env ? (vrender_1.global.removeEventListener("pointermove", this._onSliderPointerMove),
42
- vrender_1.global.removeEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.removeEventListener("pointermove", this._onSliderPointerMove),
41
+ e.preventDefault(), "browser" === vrender_1.vglobal.env ? (vrender_1.vglobal.removeEventListener("pointermove", this._onSliderPointerMove),
42
+ vrender_1.vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.removeEventListener("pointermove", this._onSliderPointerMove),
43
43
  this._slider.removeEventListener("pointerup", this._onSliderPointerUp), this._slider.removeEventListener("pointerupoutside", this._onSliderPointerUp));
44
44
  };
45
45
  }