@visactor/vrender-components 0.16.0 → 0.16.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/base.ts"],"names":[],"mappings":";;;AAIA,yDAAwF;AAExF,6CAAwH;AACxH,uCAAiD;AAEjD,iEAAgH;AAChH,kCAAiF;AACjF,0CAAyC;AAEzC,uCAAiF;AAEjF,+CAAkF;AAElF,MAAa,SAAoC,SAAQ,wBAAoB;IAqB3E,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAGD,aAAa,CAAC,OAAsC;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAaD,YAAY,UAA0B;QACpC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAzC5D,SAAI,GAAG,OAAO,CAAC;QAwIP,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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AAE,EAAE;QAIZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, ILine } from '@visactor/vrender-core';\nimport { createText, IncreaseCount, AttributeUpdateType } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty, isValid, isString, merge, isRectIntersect, isNil } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\n\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, { text: IText; labelLine?: ILine }>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs) {\n super(merge({}, LabelBase.defaultAttributes, attributes));\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _labelLine(text: IText): ILine | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected render() {\n this._prepare();\n\n if (isNil(this._idToGraphic)) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n let labels: IText[];\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(data, (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(data);\n }\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 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 protected _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 currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._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\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 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\n if (textLocation) {\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n text.setAttributes(textLocation);\n }\n\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _overlapping(labels: IText[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = this.attribute.overlap as OverlapAttrs;\n\n const result: IText[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n\n const text = labels[i] as IText;\n const baseMark = this._idToGraphic.get((text.attribute as LabelItem).id);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this.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(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n },\n undefined,\n overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: IText[]) {\n const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;\n\n if (disableAnimation) {\n this._renderWithOutAnimation(labels);\n } else {\n this._renderWithAnimation(labels);\n }\n }\n\n protected _renderWithAnimation(labels: IText[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach((text, index) => {\n const labelLine: ILine = this._labelLine(text);\n const relatedGraphic = this._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 (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n labelLine && this.add(labelLine);\n\n relatedGraphic.once('animate-bind', () => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevLabel);\n const prevText = prevLabel.text;\n prevText.animate().to(text.attribute, duration, easing);\n if (prevLabel.labelLine) {\n prevLabel.labelLine.animate().to(\n merge({}, prevLabel.labelLine.attribute, {\n visible:\n ((text.attribute as ArcLabelAttrs)?.line?.visible && text.attribute?.visible) ??\n text.attribute?.visible ??\n true,\n points: (text.attribute as ArcLabelAttrs)?.points\n }),\n duration,\n easing\n );\n }\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n }\n });\n prevTextMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _renderWithOutAnimation(labels: IText[]) {\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach(text => {\n const labelLine = this._labelLine(text);\n const relatedGraphic = this._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 this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevLabel);\n prevLabel.text.setAttributes(text.attribute);\n if (prevLabel?.labelLine) {\n prevLabel.labelLine.setAttributes({ points: (text.attribute as ArcLabelAttrs)?.points });\n }\n }\n });\n\n prevTextMap.forEach(label => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _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 const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this._idToGraphic.get((label.attribute as LabelItem).id);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * series(baseMark色),\n * invertSeries(执行智能反色),\n * similarSeries(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n const baseColor = backgroundColor;\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n\n if (outsideEnable) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n if (isInside) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n )\n });\n continue;\n }\n\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this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C,EAAE,CAAC,CAAC;KAC9B;IACD,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, ILine } from '@visactor/vrender-core';\nimport { createText, IncreaseCount, AttributeUpdateType } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty, isValid, isString, merge, isRectIntersect, isNil } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\n\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, { text: IText; labelLine?: ILine }>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs) {\n super(merge({}, LabelBase.defaultAttributes, attributes));\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _labelLine(text: IText): ILine | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected render() {\n this._prepare();\n\n if (isNil(this._idToGraphic)) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n let labels: IText[];\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(data, (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(data);\n }\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 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 _setStatesOfText(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _setStatesOfLabelLine(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.labelLineState;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStatesOfText(text);\n return text;\n }\n\n private _prepare() {\n const currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._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\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 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\n if (textLocation) {\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n text.setAttributes(textLocation);\n }\n\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _overlapping(labels: IText[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = this.attribute.overlap as OverlapAttrs;\n\n const result: IText[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n\n const text = labels[i] as IText;\n const baseMark = this._idToGraphic.get((text.attribute as LabelItem).id);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this.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(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n },\n undefined,\n overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: IText[]) {\n const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;\n\n if (disableAnimation) {\n this._renderWithOutAnimation(labels);\n } else {\n this._renderWithAnimation(labels);\n }\n }\n\n protected _renderWithAnimation(labels: IText[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach((text, index) => {\n const labelLine: ILine = this._labelLine(text);\n const relatedGraphic = this._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 (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n\n if (labelLine) {\n this._setStatesOfLabelLine(labelLine);\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n relatedGraphic.once('animate-bind', () => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevLabel);\n const prevText = prevLabel.text;\n prevText.animate().to(text.attribute, duration, easing);\n if (prevLabel.labelLine) {\n prevLabel.labelLine.animate().to(\n merge({}, prevLabel.labelLine.attribute, {\n visible:\n ((text.attribute as ArcLabelAttrs)?.line?.visible && text.attribute?.visible) ??\n text.attribute?.visible ??\n true,\n points: (text.attribute as ArcLabelAttrs)?.points\n }),\n duration,\n easing\n );\n }\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n }\n });\n prevTextMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _renderWithOutAnimation(labels: IText[]) {\n const currentTextMap: Map<any, { text: IText; labelLine?: ILine }> = new Map();\n const prevTextMap: Map<any, { text: IText; labelLine?: ILine }> = this._graphicToText || new Map();\n const texts = [] as IText[];\n\n labels.forEach(text => {\n const labelLine = this._labelLine(text);\n const relatedGraphic = this._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 this.add(text);\n if (labelLine) {\n this.add(labelLine);\n }\n\n this._syncStateWithRelatedGraphic(relatedGraphic);\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevLabel);\n prevLabel.text.setAttributes(text.attribute);\n if (prevLabel?.labelLine) {\n prevLabel.labelLine.setAttributes({ points: (text.attribute as ArcLabelAttrs)?.points });\n }\n }\n });\n\n prevTextMap.forEach(label => {\n this.removeChild(label.text);\n if (label?.labelLine) {\n this.removeChild(label.labelLine);\n }\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _handleRelatedGraphicSetState = (e: any) => {\n if (e.detail?.type === AttributeUpdateType.STATE) {\n const currentStates = e.target?.currentStates ?? [];\n const label = this._graphicToText.get(e.target);\n\n if (label) {\n if (label.text) {\n label.text.useStates(currentStates);\n }\n\n if (label.labelLine) {\n label.labelLine.useStates(currentStates);\n }\n }\n }\n };\n\n protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic) {\n if (this.attribute.syncState) {\n relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);\n }\n }\n\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText,\n texts: IText[],\n index: number,\n relatedGraphic: IGraphic,\n { mode, duration, easing, to, delay }: ILabelAnimation & { to: any }\n ) {\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n\n const isValidAnimateState =\n detail &&\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n detail.animationState &&\n detail.animationState.step?.type !== 'wait';\n\n if (!isValidAnimateState) {\n return {};\n }\n\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n return;\n }\n\n const onEnd = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onEnd }).wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n // 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 const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this._idToGraphic.get((label.attribute as LabelItem).id);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * series(baseMark色),\n * invertSeries(执行智能反色),\n * similarSeries(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n const baseColor = backgroundColor;\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n\n if (outsideEnable) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n if (isInside) {\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else {\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0) {\n continue;\n }\n\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n )\n });\n continue;\n }\n\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
@@ -4,6 +4,7 @@ export type LabelItemStateStyle<T> = {
4
4
  hover_reverse?: T;
5
5
  selected?: T;
6
6
  selected_reverse?: T;
7
+ [key: string]: T;
7
8
  };
8
9
  export type LabelItem = {
9
10
  id?: string;
@@ -19,6 +20,8 @@ export interface BaseLabelAttrs extends IGroupGraphicAttribute {
19
20
  data: LabelItem[];
20
21
  textStyle?: Partial<ITextGraphicAttribute>;
21
22
  state?: LabelItemStateStyle<ITextGraphicAttribute>;
23
+ labelLineState?: LabelItemStateStyle<ILineGraphicAttribute>;
24
+ syncState?: boolean;
22
25
  position?: Functional<string>;
23
26
  offset?: number;
24
27
  overlap?: OverlapAttrs | false;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/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 ILineGraphicAttribute\n} from '@visactor/vrender-core';\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 * @hack not recommend to use\n * @returns\n */\n getBaseMarks?: () => IGraphic[];\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 后,默认布局逻辑将不再生效。(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 /**\n * 文字在防重叠计算中预留的边距。\n * @default 0\n */\n overlapPadding?: number;\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 * fillStrategy四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持fill设置的颜色)\n * @default 'invertBase'\n */\n fillStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * strokeStrategy的四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持stroke设置的颜色)\n * @default 'base'\n */\n strokeStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * 前景色与亮色具有对比度时,similarSeries使用该色\n * @default '#ffffff'\n */\n brightColor?: string;\n /**\n * 前景色与暗色具有对比度时,similarSeries使用该色\n * @default '#000000'\n */\n darkColor?: string;\n /**\n * label超出mark范围,也以mark作为背景色进行反色\n */\n outsideEnable?: boolean;\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 * @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 * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface PolygonLabelAttrs extends BaseLabelAttrs {\n type: 'polygon';\n /**\n * 标签位置\n * @default 'center'\n */\n position?: Functional<'center'>;\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' | 'inside-inner' | 'inside-outer'>;\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 offsetAngle?: number;\n /**\n * 标签相对于 `outerRadius` 的径向偏移,目前仅作用于 inside 标签\n */\n offsetRadius?: 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 /** 标签引导线点集 */\n points?: IPoint[];\n /** 饼图扇区中心偏移 */\n centerOffset?: number;\n}\n\nexport interface IArcLabelLineSpec {\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 * 引导线是否光滑\n * @default false\n */\n smooth?: boolean;\n /**\n * 引导线样式\n */\n style?: Partial<ILineGraphicAttribute>;\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":["../src/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 ILineGraphicAttribute\n} from '@visactor/vrender-core';\n\nexport type LabelItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n [key: string]: 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 * @hack not recommend to use\n * @returns\n */\n getBaseMarks?: () => IGraphic[];\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 labelLineState?: LabelItemStateStyle<ILineGraphicAttribute>;\n\n syncState?: boolean;\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 后,默认布局逻辑将不再生效。(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 /**\n * 文字在防重叠计算中预留的边距。\n * @default 0\n */\n overlapPadding?: number;\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 * fillStrategy四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持fill设置的颜色)\n * @default 'invertBase'\n */\n fillStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * strokeStrategy的四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持stroke设置的颜色)\n * @default 'base'\n */\n strokeStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * 前景色与亮色具有对比度时,similarSeries使用该色\n * @default '#ffffff'\n */\n brightColor?: string;\n /**\n * 前景色与暗色具有对比度时,similarSeries使用该色\n * @default '#000000'\n */\n darkColor?: string;\n /**\n * label超出mark范围,也以mark作为背景色进行反色\n */\n outsideEnable?: boolean;\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 * @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 * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface PolygonLabelAttrs extends BaseLabelAttrs {\n type: 'polygon';\n /**\n * 标签位置\n * @default 'center'\n */\n position?: Functional<'center'>;\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' | 'inside-inner' | 'inside-outer'>;\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 offsetAngle?: number;\n /**\n * 标签相对于 `outerRadius` 的径向偏移,目前仅作用于 inside 标签\n */\n offsetRadius?: 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 /** 标签引导线点集 */\n points?: IPoint[];\n /** 饼图扇区中心偏移 */\n centerOffset?: number;\n}\n\nexport interface IArcLabelLineSpec {\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 * 引导线是否光滑\n * @default false\n */\n smooth?: boolean;\n /**\n * 引导线样式\n */\n style?: Partial<ILineGraphicAttribute>;\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"]}
@@ -25,9 +25,11 @@ 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_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onSliderPointerMove),
29
- vrender_core_1.vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove),
30
- this._slider.addEventListener("pointerup", this._onSliderPointerUp), this._slider.addEventListener("pointerupoutside", this._onSliderPointerUp));
28
+ this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" === vrender_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onSliderPointerMove, {
29
+ capture: !0
30
+ }), vrender_core_1.vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove, {
31
+ capture: !0
32
+ }), this._slider.addEventListener("pointerup", this._onSliderPointerUp), this._slider.addEventListener("pointerupoutside", this._onSliderPointerUp));
31
33
  }, this._onSliderPointerMove = e => {
32
34
  e.stopPropagation();
33
35
  const {direction: direction} = this.attribute;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scrollbar/scrollbar.ts"],"names":[],"mappings":";;;AAIA,yDAA8D;AAC9D,6CAA8E;AAC9E,uCAAiD;AAajD,MAAa,SAAU,SAAQ,wBAAgD;IAgC7E,YAAY,UAA+B;QACzC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhC5D,SAAI,GAAG,WAAW,CAAC;QAsNX,uBAAkB,GAAG,CAAC,CAAwB,EAAE,EAAE;;YAGxD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAC3B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;YAClF,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1C,IAAI,kBAAkB,CAAC;YACvB,IAAI,SAAS,KAAK,UAAU,EAAE;gBAC5B,MAAM,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC/C,MAAM,WAAW,GAAG,IAAA,cAAK,EAAC,SAAS,GAAG,UAAU,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;gBAChE,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC;gBACxC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE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F,CAAC;IAgFO,SAAS,CAAC,MAAW;;QAC3B,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAGtD,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,CAAC,OAAO,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;;AAhTH,8BAiTC;AA9SQ,2BAAiB,GAAG;IACzB,SAAS,EAAE,YAAY;IACvB,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,EAAE;IACd,WAAW,EAAE;QACX,IAAI,EAAE,mBAAmB;KAC1B;IACD,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;IACD,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACpB,CAAC","file":"scrollbar.js","sourcesContent":["/**\n * @description 滚动条组件\n */\nimport type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender-core';\nimport { CustomEvent, vglobal } from '@visactor/vrender-core';\nimport { merge, normalizePadding, clamp, clampRange } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\n\nimport type { ScrollBarAttributes } from './type';\n\ntype ComponentBounds = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n width: number;\n height: number;\n};\n\nexport class ScrollBar extends AbstractComponent<Required<ScrollBarAttributes>> {\n name = 'scrollbar';\n\n static defaultAttributes = {\n direction: 'horizontal',\n round: true,\n sliderSize: 20,\n sliderStyle: {\n fill: 'rgba(0, 0, 0, .5)'\n },\n railStyle: {\n fill: 'rgba(0, 0, 0, .0)'\n },\n padding: 2,\n scrollRange: [0, 1]\n };\n\n private _container!: IGroup;\n // 滚动条滑块\n private _slider!: IRect;\n // 滚动条滑轨\n private _rail!: IRect;\n // 滑块可渲染的区域包围盒\n private _sliderRenderBounds!: ComponentBounds | null;\n // 滑块滑动的范围\n private _sliderLimitRange!: [number, number] | null;\n // 保留滑块上一次的位置\n private _prePos!: number;\n // TODO: 临时方案\n private _viewPosition!: { x: number; y: number };\n private _sliderSize!: number;\n\n constructor(attributes: ScrollBarAttributes) {\n super(merge({}, ScrollBar.defaultAttributes, attributes));\n }\n\n setScrollRange(range: [number, number], render = true) {\n const { direction = 'horizontal', limitRange = [0, 1], range: preRange } = this.attribute as ScrollBarAttributes;\n\n const currScrollRange = clampRange(range, limitRange[0], limitRange[1]);\n if (render) {\n // 更新图形\n const sliderPos = this._getSliderPos(currScrollRange);\n if (this._slider) {\n if (direction === 'horizontal') {\n this._slider.setAttribute('x', sliderPos[0], true);\n } else {\n this._slider.setAttribute('y', sliderPos[0], true);\n }\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n }\n }\n (this.attribute as ScrollBarAttributes).range = currScrollRange;\n // 发射 change 事件\n this._onChange({\n pre: preRange,\n value: currScrollRange\n });\n }\n\n getScrollRange(): [number, number] {\n return (this.attribute as ScrollBarAttributes).range;\n }\n\n // public setLocation(point: PointLocationCfg) {\n // this.translateTo(point.x, point.y);\n // }\n\n // 绑定事件\n protected bindEvents(): void {\n // TODO: wheel 事件支持\n if (this._rail) {\n this._rail.addEventListener('pointerdown', this._onRailPointerDown as EventListener);\n }\n if (this._slider) {\n this._slider.addEventListener('pointerdown', this._onSliderPointerDown as EventListener);\n }\n }\n\n protected render() {\n this._reset();\n const {\n direction = 'horizontal',\n width,\n height,\n range,\n limitRange = [0, 1],\n // sliderSize = 20,\n // scrollValue = 0,\n // scrollRange = [0, 1],\n railStyle,\n sliderStyle,\n padding = 2\n } = this.attribute as ScrollBarAttributes;\n\n const group = this.createOrUpdateChild('scrollbar-container', {}, 'group') as IGroup;\n // 绘制轨道\n\n const rail = group.createOrUpdateChild(\n 'scrollbar-rail',\n {\n x: 0,\n y: 0,\n width,\n height,\n ...railStyle\n },\n 'rect'\n ) as IRect;\n this._rail = rail;\n\n // 滑块\n const sliderRenderBounds = this._getSliderRenderBounds();\n const sliderPos = this._getSliderPos(clampRange(range, limitRange[0], limitRange[1]));\n const sliderSize = sliderPos[1] - sliderPos[0];\n this._sliderSize = sliderSize;\n // const sliderRangePos = this._getScrollRange();\n\n let sliderAttribute: IRectGraphicAttribute;\n if (direction === 'horizontal') {\n sliderAttribute = {\n x: sliderPos[0],\n y: sliderRenderBounds.y1,\n width: sliderSize,\n height: sliderRenderBounds.height\n };\n } else {\n sliderAttribute = {\n x: sliderRenderBounds.x1,\n y: sliderPos[0],\n width: sliderRenderBounds.width,\n height: sliderSize\n };\n }\n\n const slider = group.createOrUpdateChild(\n 'slider',\n {\n ...sliderAttribute,\n cornerRadius: this._getDefaultSliderCornerRadius(),\n ...sliderStyle,\n boundsPadding: normalizePadding(padding),\n pickMode: 'imprecise'\n },\n 'rect'\n ) as IRect;\n this._slider = slider;\n this._container = group;\n\n const containerAABBBounds = this._container.AABBBounds;\n this._viewPosition = {\n x: containerAABBBounds.x1,\n y: containerAABBBounds.y1\n };\n }\n\n // 获取滑块渲染的包围盒区域\n private _getSliderRenderBounds() {\n if (this._sliderRenderBounds) {\n return this._sliderRenderBounds;\n }\n const { width, height, padding = 2 } = this.attribute as ScrollBarAttributes;\n const [top, right, bottom, left] = normalizePadding(padding);\n const renderBounds = {\n x1: left,\n y1: top,\n x2: width - right,\n y2: height - bottom,\n width: width - (left + right),\n height: height - (top + bottom)\n };\n this._sliderRenderBounds = renderBounds;\n return renderBounds;\n }\n\n // 获取默认的滑块圆角\n private _getDefaultSliderCornerRadius() {\n const { direction, round } = this.attribute as ScrollBarAttributes;\n\n if (round) {\n const { width, height } = this._getSliderRenderBounds();\n return direction === 'horizontal' ? height : width;\n }\n\n return 0;\n }\n\n // 计算滑块在轨道的位置\n private _getSliderPos(range: [number, number]) {\n const { direction } = this.attribute as ScrollBarAttributes;\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n\n if (direction === 'horizontal') {\n return [width * range[0] + x1, width * range[1] + x1];\n }\n return [height * range[0] + y1, height * range[1] + y1];\n }\n\n private _getScrollRange() {\n if (this._sliderLimitRange) {\n return this._sliderLimitRange;\n }\n const { limitRange = [0, 1], direction } = this.attribute as ScrollBarAttributes;\n const [min, max] = clampRange(limitRange, 0, 1);\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n const sliderSize = this._sliderSize;\n\n return direction === 'horizontal'\n ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)\n : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);\n }\n\n private _onRailPointerDown = (e: FederatedPointerEvent) => {\n // 将事件坐标转换为实际的滑块位置\n // TODO: 这里有问题,应该拿 viewX viewY,同时 graphic 要提供接口获取它的 相对 view 的坐标\n const { viewX, viewY } = e;\n const { direction, width, height, range } = this.attribute as ScrollBarAttributes;\n const sliderSize = this._sliderSize;\n const [min, max] = this._getScrollRange();\n let currentScrollValue;\n if (direction === 'vertical') {\n const relativeY = viewY - this._viewPosition.y;\n const currentYPos = clamp(relativeY - sliderSize / 2, min, max);\n currentScrollValue = relativeY / height;\n this._slider.setAttribute('y', currentYPos, true);\n } else {\n const relativeX = viewX - this._viewPosition.x;\n const currentXPos = clamp(relativeX - sliderSize / 2, min, max);\n currentScrollValue = relativeX / width;\n this._slider.setAttribute('x', currentXPos, true);\n }\n\n this.setScrollRange(\n [currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2],\n false\n );\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n };\n\n private _onSliderPointerDown = (e: FederatedPointerEvent) => {\n e.stopPropagation();\n const { direction } = this.attribute as ScrollBarAttributes;\n this._prePos = direction === 'horizontal' ? e.clientX : e.clientY;\n if (vglobal.env === 'browser') {\n vglobal.addEventListener('pointermove', this._onSliderPointerMove);\n vglobal.addEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.addEventListener('pointermove', this._onSliderPointerMove);\n this._slider.addEventListener('pointerup', this._onSliderPointerUp);\n this._slider.addEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onSliderPointerMove = (e: any) => {\n e.stopPropagation();\n\n const { direction } = this.attribute as ScrollBarAttributes;\n let currentScrollValue;\n let currentPos;\n let delta = 0;\n const preScrollRange = this.getScrollRange();\n const { width, height } = this._getSliderRenderBounds();\n if (direction === 'vertical') {\n currentPos = e.clientY;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / height;\n } else {\n currentPos = e.clientX;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / width;\n }\n this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], true);\n this._prePos = currentPos;\n };\n\n private _onSliderPointerUp = (e: any) => {\n e.preventDefault();\n if (vglobal.env === 'browser') {\n vglobal.removeEventListener('pointermove', this._onSliderPointerMove);\n vglobal.removeEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.removeEventListener('pointermove', this._onSliderPointerMove);\n this._slider.removeEventListener('pointerup', this._onSliderPointerUp);\n this._slider.removeEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onChange(detail: any) {\n const changeEvent = new CustomEvent('scroll', detail);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n this.dispatchEvent(changeEvent);\n }\n\n private _reset() {\n this._sliderRenderBounds = null;\n this._sliderLimitRange = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scrollbar/scrollbar.ts"],"names":[],"mappings":";;;AAIA,yDAA8D;AAC9D,6CAA8E;AAC9E,uCAAiD;AAajD,MAAa,SAAU,SAAQ,wBAAgD;IAgC7E,YAAY,UAA+B;QACzC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CA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,YAAY;IACvB,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,EAAE;IACd,WAAW,EAAE;QACX,IAAI,EAAE,mBAAmB;KAC1B;IACD,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;IACD,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACpB,CAAC","file":"scrollbar.js","sourcesContent":["/**\n * @description 滚动条组件\n */\nimport type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender-core';\nimport { CustomEvent, vglobal } from '@visactor/vrender-core';\nimport { merge, normalizePadding, clamp, clampRange } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\n\nimport type { ScrollBarAttributes } from './type';\n\ntype ComponentBounds = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n width: number;\n height: number;\n};\n\nexport class ScrollBar extends AbstractComponent<Required<ScrollBarAttributes>> {\n name = 'scrollbar';\n\n static defaultAttributes = {\n direction: 'horizontal',\n round: true,\n sliderSize: 20,\n sliderStyle: {\n fill: 'rgba(0, 0, 0, .5)'\n },\n railStyle: {\n fill: 'rgba(0, 0, 0, .0)'\n },\n padding: 2,\n scrollRange: [0, 1]\n };\n\n private _container!: IGroup;\n // 滚动条滑块\n private _slider!: IRect;\n // 滚动条滑轨\n private _rail!: IRect;\n // 滑块可渲染的区域包围盒\n private _sliderRenderBounds!: ComponentBounds | null;\n // 滑块滑动的范围\n private _sliderLimitRange!: [number, number] | null;\n // 保留滑块上一次的位置\n private _prePos!: number;\n // TODO: 临时方案\n private _viewPosition!: { x: number; y: number };\n private _sliderSize!: number;\n\n constructor(attributes: ScrollBarAttributes) {\n super(merge({}, ScrollBar.defaultAttributes, attributes));\n }\n\n setScrollRange(range: [number, number], render = true) {\n const { direction = 'horizontal', limitRange = [0, 1], range: preRange } = this.attribute as ScrollBarAttributes;\n\n const currScrollRange = clampRange(range, limitRange[0], limitRange[1]);\n if (render) {\n // 更新图形\n const sliderPos = this._getSliderPos(currScrollRange);\n if (this._slider) {\n if (direction === 'horizontal') {\n this._slider.setAttribute('x', sliderPos[0], true);\n } else {\n this._slider.setAttribute('y', sliderPos[0], true);\n }\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n }\n }\n (this.attribute as ScrollBarAttributes).range = currScrollRange;\n // 发射 change 事件\n this._onChange({\n pre: preRange,\n value: currScrollRange\n });\n }\n\n getScrollRange(): [number, number] {\n return (this.attribute as ScrollBarAttributes).range;\n }\n\n // public setLocation(point: PointLocationCfg) {\n // this.translateTo(point.x, point.y);\n // }\n\n // 绑定事件\n protected bindEvents(): void {\n // TODO: wheel 事件支持\n if (this._rail) {\n this._rail.addEventListener('pointerdown', this._onRailPointerDown as EventListener);\n }\n if (this._slider) {\n this._slider.addEventListener('pointerdown', this._onSliderPointerDown as EventListener);\n }\n }\n\n protected render() {\n this._reset();\n const {\n direction = 'horizontal',\n width,\n height,\n range,\n limitRange = [0, 1],\n // sliderSize = 20,\n // scrollValue = 0,\n // scrollRange = [0, 1],\n railStyle,\n sliderStyle,\n padding = 2\n } = this.attribute as ScrollBarAttributes;\n\n const group = this.createOrUpdateChild('scrollbar-container', {}, 'group') as IGroup;\n // 绘制轨道\n\n const rail = group.createOrUpdateChild(\n 'scrollbar-rail',\n {\n x: 0,\n y: 0,\n width,\n height,\n ...railStyle\n },\n 'rect'\n ) as IRect;\n this._rail = rail;\n\n // 滑块\n const sliderRenderBounds = this._getSliderRenderBounds();\n const sliderPos = this._getSliderPos(clampRange(range, limitRange[0], limitRange[1]));\n const sliderSize = sliderPos[1] - sliderPos[0];\n this._sliderSize = sliderSize;\n // const sliderRangePos = this._getScrollRange();\n\n let sliderAttribute: IRectGraphicAttribute;\n if (direction === 'horizontal') {\n sliderAttribute = {\n x: sliderPos[0],\n y: sliderRenderBounds.y1,\n width: sliderSize,\n height: sliderRenderBounds.height\n };\n } else {\n sliderAttribute = {\n x: sliderRenderBounds.x1,\n y: sliderPos[0],\n width: sliderRenderBounds.width,\n height: sliderSize\n };\n }\n\n const slider = group.createOrUpdateChild(\n 'slider',\n {\n ...sliderAttribute,\n cornerRadius: this._getDefaultSliderCornerRadius(),\n ...sliderStyle,\n boundsPadding: normalizePadding(padding),\n pickMode: 'imprecise'\n },\n 'rect'\n ) as IRect;\n this._slider = slider;\n this._container = group;\n\n const containerAABBBounds = this._container.AABBBounds;\n this._viewPosition = {\n x: containerAABBBounds.x1,\n y: containerAABBBounds.y1\n };\n }\n\n // 获取滑块渲染的包围盒区域\n private _getSliderRenderBounds() {\n if (this._sliderRenderBounds) {\n return this._sliderRenderBounds;\n }\n const { width, height, padding = 2 } = this.attribute as ScrollBarAttributes;\n const [top, right, bottom, left] = normalizePadding(padding);\n const renderBounds = {\n x1: left,\n y1: top,\n x2: width - right,\n y2: height - bottom,\n width: width - (left + right),\n height: height - (top + bottom)\n };\n this._sliderRenderBounds = renderBounds;\n return renderBounds;\n }\n\n // 获取默认的滑块圆角\n private _getDefaultSliderCornerRadius() {\n const { direction, round } = this.attribute as ScrollBarAttributes;\n\n if (round) {\n const { width, height } = this._getSliderRenderBounds();\n return direction === 'horizontal' ? height : width;\n }\n\n return 0;\n }\n\n // 计算滑块在轨道的位置\n private _getSliderPos(range: [number, number]) {\n const { direction } = this.attribute as ScrollBarAttributes;\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n\n if (direction === 'horizontal') {\n return [width * range[0] + x1, width * range[1] + x1];\n }\n return [height * range[0] + y1, height * range[1] + y1];\n }\n\n private _getScrollRange() {\n if (this._sliderLimitRange) {\n return this._sliderLimitRange;\n }\n const { limitRange = [0, 1], direction } = this.attribute as ScrollBarAttributes;\n const [min, max] = clampRange(limitRange, 0, 1);\n const { width, height, x1, y1 } = this._getSliderRenderBounds();\n const sliderSize = this._sliderSize;\n\n return direction === 'horizontal'\n ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)\n : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);\n }\n\n private _onRailPointerDown = (e: FederatedPointerEvent) => {\n // 将事件坐标转换为实际的滑块位置\n // TODO: 这里有问题,应该拿 viewX viewY,同时 graphic 要提供接口获取它的 相对 view 的坐标\n const { viewX, viewY } = e;\n const { direction, width, height, range } = this.attribute as ScrollBarAttributes;\n const sliderSize = this._sliderSize;\n const [min, max] = this._getScrollRange();\n let currentScrollValue;\n if (direction === 'vertical') {\n const relativeY = viewY - this._viewPosition.y;\n const currentYPos = clamp(relativeY - sliderSize / 2, min, max);\n currentScrollValue = relativeY / height;\n this._slider.setAttribute('y', currentYPos, true);\n } else {\n const relativeX = viewX - this._viewPosition.x;\n const currentXPos = clamp(relativeX - sliderSize / 2, min, max);\n currentScrollValue = relativeX / width;\n this._slider.setAttribute('x', currentXPos, true);\n }\n\n this.setScrollRange(\n [currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2],\n false\n );\n\n if (!this.stage?.autoRender) {\n this.stage?.renderNextFrame();\n }\n };\n\n private _onSliderPointerDown = (e: FederatedPointerEvent) => {\n e.stopPropagation();\n const { direction } = this.attribute as ScrollBarAttributes;\n this._prePos = direction === 'horizontal' ? e.clientX : e.clientY;\n if (vglobal.env === 'browser') {\n vglobal.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n vglobal.addEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });\n this._slider.addEventListener('pointerup', this._onSliderPointerUp);\n this._slider.addEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onSliderPointerMove = (e: any) => {\n e.stopPropagation();\n\n const { direction } = this.attribute as ScrollBarAttributes;\n let currentScrollValue;\n let currentPos;\n let delta = 0;\n const preScrollRange = this.getScrollRange();\n const { width, height } = this._getSliderRenderBounds();\n if (direction === 'vertical') {\n currentPos = e.clientY;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / height;\n } else {\n currentPos = e.clientX;\n delta = currentPos - this._prePos;\n currentScrollValue = delta / width;\n }\n this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], true);\n this._prePos = currentPos;\n };\n\n private _onSliderPointerUp = (e: any) => {\n e.preventDefault();\n if (vglobal.env === 'browser') {\n vglobal.removeEventListener('pointermove', this._onSliderPointerMove);\n vglobal.removeEventListener('pointerup', this._onSliderPointerUp);\n } else {\n this._slider.removeEventListener('pointermove', this._onSliderPointerMove);\n this._slider.removeEventListener('pointerup', this._onSliderPointerUp);\n this._slider.removeEventListener('pointerupoutside', this._onSliderPointerUp);\n }\n };\n\n private _onChange(detail: any) {\n const changeEvent = new CustomEvent('scroll', detail);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n this.dispatchEvent(changeEvent);\n }\n\n private _reset() {\n this._sliderRenderBounds = null;\n this._sliderLimitRange = null;\n }\n}\n"]}
@@ -33,9 +33,12 @@ class Slider extends base_1.AbstractComponent {
33
33
  this._endHandlerText = null, this._currentHandler = null, this._currentValue = {},
34
34
  this._onHandlerPointerdown = e => {
35
35
  e.stopPropagation(), this._currentHandler = e.target, this._prePos = this._isHorizontal ? e.clientX : e.clientY,
36
- "browser" === vrender_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onHandlerPointerMove),
37
- vrender_core_1.vglobal.addEventListener("pointerup", this._onHandlerPointerUp)) : (this._currentHandler.addEventListener("pointermove", this._onHandlerPointerMove),
38
- this._currentHandler.addEventListener("pointerup", this._onHandlerPointerUp), this._currentHandler.addEventListener("pointerupoutside", this._onHandlerPointerUp));
36
+ "browser" === vrender_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
37
+ capture: !0
38
+ }), vrender_core_1.vglobal.addEventListener("pointerup", this._onHandlerPointerUp)) : (this._currentHandler.addEventListener("pointermove", this._onHandlerPointerMove, {
39
+ capture: !0
40
+ }), this._currentHandler.addEventListener("pointerup", this._onHandlerPointerUp),
41
+ this._currentHandler.addEventListener("pointerupoutside", this._onHandlerPointerUp));
39
42
  }, this._onHandlerPointerMove = e => {
40
43
  var _a, _b;
41
44
  e.stopPropagation();
@@ -51,17 +54,21 @@ class Slider extends base_1.AbstractComponent {
51
54
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue),
52
55
  this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
53
56
  }, this._onHandlerPointerUp = e => {
54
- if (e.preventDefault(), this._currentHandler = null, "browser" === vrender_core_1.vglobal.env) vrender_core_1.vglobal.removeEventListener("pointermove", this._onHandlerPointerMove),
55
- vrender_core_1.vglobal.removeEventListener("pointerup", this._onHandlerPointerUp); else {
57
+ if (e.preventDefault(), this._currentHandler = null, "browser" === vrender_core_1.vglobal.env) vrender_core_1.vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
58
+ capture: !0
59
+ }), vrender_core_1.vglobal.removeEventListener("pointerup", this._onHandlerPointerUp); else {
56
60
  const currentTarget = e.target;
57
- currentTarget.removeEventListener("pointermove", this._onHandlerPointerMove), currentTarget.removeEventListener("pointerup", this._onHandlerPointerUp),
58
- currentTarget.removeEventListener("pointerupoutside", this._onHandlerPointerUp);
61
+ currentTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
62
+ capture: !0
63
+ }), currentTarget.removeEventListener("pointerup", this._onHandlerPointerUp), currentTarget.removeEventListener("pointerupoutside", this._onHandlerPointerUp);
59
64
  }
60
65
  }, this._onTrackPointerdown = e => {
61
66
  e.stopPropagation(), this._prePos = this._isHorizontal ? e.clientX : e.clientY,
62
- "browser" === vrender_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onTrackPointerMove),
63
- vrender_core_1.vglobal.addEventListener("pointerup", this._onTrackPointerUp)) : (this._track.addEventListener("pointermove", this._onTrackPointerMove),
64
- this._track.addEventListener("pointerup", this._onTrackPointerUp), this._track.addEventListener("pointerupoutside", this._onTrackPointerUp));
67
+ "browser" === vrender_core_1.vglobal.env ? (vrender_core_1.vglobal.addEventListener("pointermove", this._onTrackPointerMove, {
68
+ capture: !0
69
+ }), vrender_core_1.vglobal.addEventListener("pointerup", this._onTrackPointerUp)) : (this._track.addEventListener("pointermove", this._onTrackPointerMove, {
70
+ capture: !0
71
+ }), this._track.addEventListener("pointerup", this._onTrackPointerUp), this._track.addEventListener("pointerupoutside", this._onTrackPointerUp));
65
72
  }, this._onTrackPointerMove = e => {
66
73
  e.stopPropagation();
67
74
  const {railWidth: railWidth, railHeight: railHeight, min: min, max: max} = this.attribute;