@visactor/vrender-components 0.20.16 → 0.20.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.d.ts +1 -0
- package/cjs/label/base.js +26 -19
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/overlap/place.d.ts +1 -1
- package/cjs/label/overlap/place.js +7 -6
- package/cjs/label/overlap/place.js.map +1 -1
- package/cjs/label/overlap/shiftY.js +3 -3
- package/cjs/label/overlap/shiftY.js.map +1 -1
- package/cjs/label/type.d.ts +2 -0
- package/cjs/label/type.js.map +1 -1
- package/cjs/marker/config.js +32 -0
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.js +9 -4
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +9 -1
- package/cjs/marker/type.js +6 -2
- package/cjs/marker/type.js.map +1 -1
- package/dist/index.es.js +107 -35
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.d.ts +1 -0
- package/es/label/base.js +26 -19
- package/es/label/base.js.map +1 -1
- package/es/label/overlap/place.d.ts +1 -1
- package/es/label/overlap/place.js +6 -5
- package/es/label/overlap/place.js.map +1 -1
- package/es/label/overlap/shiftY.js +3 -3
- package/es/label/overlap/shiftY.js.map +1 -1
- package/es/label/type.d.ts +2 -0
- package/es/label/type.js.map +1 -1
- package/es/marker/config.js +32 -0
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.js +7 -3
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +9 -1
- package/es/marker/type.js +6 -2
- package/es/marker/type.js.map +1 -1
- package/package.json +8 -8
package/cjs/marker/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAmBA,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IAEvC,2CAAiB,CAAA;IACjB,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAlBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAkBjC;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,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAQtC;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 EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\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 IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\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<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是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 type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n type: 'fadeOut';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n line?: State<LineAttr>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n area?: State<Partial<AreaAttr>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof 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 * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\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 * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\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 type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n style?: ISymbol;\n };\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAmBA,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IAEvC,2CAAiB,CAAA;IACjB,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAlBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAkBjC;AAED,IAAY,sBAoBX;AApBD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,6CAAmB,CAAA;IACnB,+CAAqB,CAAA;IACrB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAE3B,2CAAiB,CAAA;IAEjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;AACzC,CAAC,EApBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAoBjC;AAED,IAAY,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAQtC;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 EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n topLeft = 'topLeft',\n topRight = 'topRight',\n bottomLeft = 'bottomLeft',\n bottomRight = 'bottomRight',\n\n middle = 'middle',\n\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideTopLeft = 'insideTopLeft',\n insideTopRight = 'insideTopRight',\n insideBottomLeft = 'insideBottomLeft',\n insideBottomRight = 'insideBottomRight'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\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<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是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 type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n type: 'fadeOut';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n line?: State<LineAttr>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n area?: State<Partial<AreaAttr>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof 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 * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\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 * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\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 type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n style?: ISymbol;\n };\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -7681,7 +7681,7 @@ function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offse
|
|
|
7681
7681
|
originP2: originP2
|
|
7682
7682
|
} = curve;
|
|
7683
7683
|
let validP;
|
|
7684
|
-
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
7684
|
+
if (originP1 && !1 !== originP1.defined && !lastCurve ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
7685
7685
|
newDefined0 = !defined0;
|
|
7686
7686
|
const x = validP ? validP.x : curve.p0.x,
|
|
7687
7687
|
y = validP ? validP.y : curve.p0.y;
|
|
@@ -11473,7 +11473,7 @@ class Wrapper {
|
|
|
11473
11473
|
}
|
|
11474
11474
|
}
|
|
11475
11475
|
|
|
11476
|
-
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11476
|
+
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11477
11477
|
class RichText extends Graphic {
|
|
11478
11478
|
constructor(params) {
|
|
11479
11479
|
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
@@ -15956,14 +15956,19 @@ function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
|
|
|
15956
15956
|
}
|
|
15957
15957
|
return !bitmap.getRange(range);
|
|
15958
15958
|
}
|
|
15959
|
-
function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
|
|
15959
|
+
function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0, changePosition = false) {
|
|
15960
15960
|
const validCandidates = candidates.filter(candidate => isValid(candidate));
|
|
15961
15961
|
for (let i = 0; i < validCandidates.length; i++) {
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15962
|
+
let measureText;
|
|
15963
|
+
if (changePosition) {
|
|
15964
|
+
measureText = text;
|
|
15965
|
+
}
|
|
15966
|
+
else {
|
|
15967
|
+
measureText = text.clone();
|
|
15968
|
+
}
|
|
15969
|
+
measureText.setAttributes(validCandidates[i]);
|
|
15970
|
+
if (canPlace($, bitmap, measureText.AABBBounds, clampForce, pad)) {
|
|
15971
|
+
bitmap.setRange(boundToRange($, measureText.AABBBounds, true));
|
|
15967
15972
|
return validCandidates[i];
|
|
15968
15973
|
}
|
|
15969
15974
|
}
|
|
@@ -15978,7 +15983,8 @@ function place($, bitmap, s, attrs, text, bounds, labeling) {
|
|
|
15978
15983
|
const userPosition = isFunction(s.position) ? s.position(text.attribute) : s.position;
|
|
15979
15984
|
const positions = (userPosition || defaultLabelPosition(attrs.type));
|
|
15980
15985
|
const candidates = positions.map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
|
|
15981
|
-
|
|
15986
|
+
const shouldClone = s.restorePosition === false;
|
|
15987
|
+
return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding, shouldClone);
|
|
15982
15988
|
}
|
|
15983
15989
|
return false;
|
|
15984
15990
|
}
|
|
@@ -16375,14 +16381,12 @@ function shiftY(texts, option) {
|
|
|
16375
16381
|
textInformation.get(text).attempts = attempts;
|
|
16376
16382
|
};
|
|
16377
16383
|
function adjustPositionInOneGroup(texts) {
|
|
16378
|
-
|
|
16379
|
-
return;
|
|
16380
|
-
}
|
|
16381
|
-
for (let i = texts.length - 1; i > 0; i--) {
|
|
16384
|
+
for (let i = texts.length - 1; i >= 0; i--) {
|
|
16382
16385
|
const curText = texts[i];
|
|
16383
16386
|
const upperText = texts[i - 1];
|
|
16384
16387
|
const lowerText = texts[i + 1];
|
|
16385
|
-
if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText)))
|
|
16388
|
+
if ((upperText && isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) ||
|
|
16389
|
+
(getY1(curText) === 0 && curText._isClamped)) {
|
|
16386
16390
|
const { y } = labelling(curText);
|
|
16387
16391
|
if (!lowerText || !isIntersect(y + getHeight(curText) / 2, getY1(lowerText))) {
|
|
16388
16392
|
if (y + getHeight(curText) / 2 <= maxY) {
|
|
@@ -16873,10 +16877,16 @@ class LabelBase extends AbstractComponent {
|
|
|
16873
16877
|
const text = result[i];
|
|
16874
16878
|
const bounds = text.AABBBounds;
|
|
16875
16879
|
const range = boundToRange(bmpTool, bounds, true);
|
|
16876
|
-
if (canPlace(bmpTool, bitmap, bounds, clampForce,
|
|
16880
|
+
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
|
|
16877
16881
|
bitmap.setRange(range);
|
|
16878
16882
|
}
|
|
16879
16883
|
else {
|
|
16884
|
+
if (clampForce) {
|
|
16885
|
+
const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
|
|
16886
|
+
if (placedAfterClampForce) {
|
|
16887
|
+
continue;
|
|
16888
|
+
}
|
|
16889
|
+
}
|
|
16880
16890
|
if (hideOnHit) {
|
|
16881
16891
|
text.setAttributes({ visible: false });
|
|
16882
16892
|
}
|
|
@@ -16887,6 +16897,26 @@ class LabelBase extends AbstractComponent {
|
|
|
16887
16897
|
}
|
|
16888
16898
|
return result;
|
|
16889
16899
|
}
|
|
16900
|
+
_processClampForce(text, bmpTool, bitmap) {
|
|
16901
|
+
const { dy = 0, dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
16902
|
+
if (dx === 0 && dy === 0) {
|
|
16903
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
16904
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
16905
|
+
return true;
|
|
16906
|
+
}
|
|
16907
|
+
}
|
|
16908
|
+
else if (canPlace(bmpTool, bitmap, {
|
|
16909
|
+
x1: text.AABBBounds.x1 + dx,
|
|
16910
|
+
x2: text.AABBBounds.x2 + dx,
|
|
16911
|
+
y1: text.AABBBounds.y1 + dy,
|
|
16912
|
+
y2: text.AABBBounds.y2 + dy
|
|
16913
|
+
})) {
|
|
16914
|
+
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
16915
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
16916
|
+
return true;
|
|
16917
|
+
}
|
|
16918
|
+
return false;
|
|
16919
|
+
}
|
|
16890
16920
|
_overlapByStrategy(labels, option, bmpTool, bitmap) {
|
|
16891
16921
|
var _a;
|
|
16892
16922
|
const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
|
|
@@ -16946,22 +16976,8 @@ class LabelBase extends AbstractComponent {
|
|
|
16946
16976
|
}
|
|
16947
16977
|
}
|
|
16948
16978
|
if (!hasPlace && clampForce) {
|
|
16949
|
-
const
|
|
16950
|
-
if (
|
|
16951
|
-
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
16952
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
16953
|
-
result.push(text);
|
|
16954
|
-
continue;
|
|
16955
|
-
}
|
|
16956
|
-
}
|
|
16957
|
-
else if (canPlace(bmpTool, bitmap, {
|
|
16958
|
-
x1: text.AABBBounds.x1 + dx,
|
|
16959
|
-
x2: text.AABBBounds.x2 + dx,
|
|
16960
|
-
y1: text.AABBBounds.y1 + dy,
|
|
16961
|
-
y2: text.AABBBounds.y2 + dy
|
|
16962
|
-
})) {
|
|
16963
|
-
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
16964
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
16979
|
+
const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
|
|
16980
|
+
if (placedAfterClampForce) {
|
|
16965
16981
|
result.push(text);
|
|
16966
16982
|
continue;
|
|
16967
16983
|
}
|
|
@@ -22507,11 +22523,19 @@ var IMarkAreaLabelPosition;
|
|
|
22507
22523
|
IMarkAreaLabelPosition["right"] = "right";
|
|
22508
22524
|
IMarkAreaLabelPosition["top"] = "top";
|
|
22509
22525
|
IMarkAreaLabelPosition["bottom"] = "bottom";
|
|
22526
|
+
IMarkAreaLabelPosition["topLeft"] = "topLeft";
|
|
22527
|
+
IMarkAreaLabelPosition["topRight"] = "topRight";
|
|
22528
|
+
IMarkAreaLabelPosition["bottomLeft"] = "bottomLeft";
|
|
22529
|
+
IMarkAreaLabelPosition["bottomRight"] = "bottomRight";
|
|
22510
22530
|
IMarkAreaLabelPosition["middle"] = "middle";
|
|
22511
22531
|
IMarkAreaLabelPosition["insideLeft"] = "insideLeft";
|
|
22512
22532
|
IMarkAreaLabelPosition["insideRight"] = "insideRight";
|
|
22513
22533
|
IMarkAreaLabelPosition["insideTop"] = "insideTop";
|
|
22514
22534
|
IMarkAreaLabelPosition["insideBottom"] = "insideBottom";
|
|
22535
|
+
IMarkAreaLabelPosition["insideTopLeft"] = "insideTopLeft";
|
|
22536
|
+
IMarkAreaLabelPosition["insideTopRight"] = "insideTopRight";
|
|
22537
|
+
IMarkAreaLabelPosition["insideBottomLeft"] = "insideBottomLeft";
|
|
22538
|
+
IMarkAreaLabelPosition["insideBottomRight"] = "insideBottomRight";
|
|
22515
22539
|
})(IMarkAreaLabelPosition || (IMarkAreaLabelPosition = {}));
|
|
22516
22540
|
var IMarkCommonArcLabelPosition;
|
|
22517
22541
|
(function (IMarkCommonArcLabelPosition) {
|
|
@@ -23341,6 +23365,38 @@ const DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP = {
|
|
|
23341
23365
|
middle: {
|
|
23342
23366
|
textAlign: 'center',
|
|
23343
23367
|
textBaseline: 'middle'
|
|
23368
|
+
},
|
|
23369
|
+
topLeft: {
|
|
23370
|
+
textAlign: 'right',
|
|
23371
|
+
textBaseline: 'top'
|
|
23372
|
+
},
|
|
23373
|
+
insideTopLeft: {
|
|
23374
|
+
textAlign: 'left',
|
|
23375
|
+
textBaseline: 'top'
|
|
23376
|
+
},
|
|
23377
|
+
topRight: {
|
|
23378
|
+
textAlign: 'left',
|
|
23379
|
+
textBaseline: 'top'
|
|
23380
|
+
},
|
|
23381
|
+
insideTopRight: {
|
|
23382
|
+
textAlign: 'right',
|
|
23383
|
+
textBaseline: 'top'
|
|
23384
|
+
},
|
|
23385
|
+
bottomLeft: {
|
|
23386
|
+
textAlign: 'right',
|
|
23387
|
+
textBaseline: 'bottom'
|
|
23388
|
+
},
|
|
23389
|
+
insideBottomLeft: {
|
|
23390
|
+
textAlign: 'left',
|
|
23391
|
+
textBaseline: 'bottom'
|
|
23392
|
+
},
|
|
23393
|
+
bottomRight: {
|
|
23394
|
+
textAlign: 'left',
|
|
23395
|
+
textBaseline: 'bottom'
|
|
23396
|
+
},
|
|
23397
|
+
insideBottomRight: {
|
|
23398
|
+
textAlign: 'right',
|
|
23399
|
+
textBaseline: 'bottom'
|
|
23344
23400
|
}
|
|
23345
23401
|
};
|
|
23346
23402
|
const DEFAULT_MARK_POINT_THEME = {
|
|
@@ -24072,7 +24128,7 @@ class MarkPoint extends Marker {
|
|
|
24072
24128
|
this._isStraightLine =
|
|
24073
24129
|
fuzzyEqualNumber(itemOffsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(itemOffsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24074
24130
|
if (this._isArcLine) {
|
|
24075
|
-
const { x: x1, y: y1 } =
|
|
24131
|
+
const { x: x1, y: y1 } = this.attribute.position;
|
|
24076
24132
|
const { x: x2, y: y2 } = newItemPosition;
|
|
24077
24133
|
const x0 = (x1 + x2) / 2;
|
|
24078
24134
|
const y0 = (y1 + y2) / 2;
|
|
@@ -24085,6 +24141,10 @@ class MarkPoint extends Marker {
|
|
|
24085
24141
|
startAngle = deltaXYToAngle(y1 - centerY, x1 - centerX);
|
|
24086
24142
|
endAngle = deltaXYToAngle(y2 - centerY, x2 - centerX);
|
|
24087
24143
|
center = { x: centerX, y: centerY };
|
|
24144
|
+
const R = Math.sqrt((centerX - x1) * (centerX - x1) + (centerY - y1) * (centerY - y1));
|
|
24145
|
+
const r = this.attribute.targetSymbol.style.size / 2;
|
|
24146
|
+
const deltaAngle = Math.acos(Math.sqrt(1 - (r * r) / (4 * R * R))) * 2;
|
|
24147
|
+
startAngle = startAngle + deltaAngle;
|
|
24088
24148
|
if (arcRatio > 0) {
|
|
24089
24149
|
if (endAngle < startAngle) {
|
|
24090
24150
|
endAngle += Math.PI * 2;
|
|
@@ -24235,11 +24295,23 @@ class MarkPoint extends Marker {
|
|
|
24235
24295
|
}
|
|
24236
24296
|
computeNewPositionAfterTargetItem(position) {
|
|
24237
24297
|
var _a, _b;
|
|
24238
|
-
const { itemContent = {}, targetSymbol } = this.attribute;
|
|
24298
|
+
const { itemContent = {}, targetSymbol, itemLine } = this.attribute;
|
|
24239
24299
|
const { offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0 } = itemContent;
|
|
24240
24300
|
const { offset: targetSymbolOffset = 0, style: targetSymbolStyle, visible: targetItemvisible = false, size: targetSymbolSize } = targetSymbol;
|
|
24241
24301
|
const targetSize = targetItemvisible ? (_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20 : 0;
|
|
24242
|
-
|
|
24302
|
+
let targetOffsetAngle;
|
|
24303
|
+
if (itemLine.type === 'type-do') {
|
|
24304
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX / 2);
|
|
24305
|
+
}
|
|
24306
|
+
else if (itemLine.type === 'type-po') {
|
|
24307
|
+
targetOffsetAngle = deltaXYToAngle(0, itemContentOffsetX);
|
|
24308
|
+
}
|
|
24309
|
+
else if (itemLine.type === 'type-op') {
|
|
24310
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, 0);
|
|
24311
|
+
}
|
|
24312
|
+
else {
|
|
24313
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX);
|
|
24314
|
+
}
|
|
24243
24315
|
const newPosition = {
|
|
24244
24316
|
x: position.x + (targetSize / 2 + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
24245
24317
|
y: position.y + (targetSize / 2 + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
@@ -29696,6 +29768,6 @@ EmptyTip.defaultAttributes = {
|
|
|
29696
29768
|
}
|
|
29697
29769
|
};
|
|
29698
29770
|
|
|
29699
|
-
const version = "0.20.
|
|
29771
|
+
const version = "0.20.18";
|
|
29700
29772
|
|
|
29701
29773
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.18\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
|
package/es/label/base.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare class LabelBase<T extends BaseLabelAttrs> extends AbstractCompone
|
|
|
50
50
|
protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[];
|
|
51
51
|
protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
|
|
52
52
|
protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
|
|
53
|
+
protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap): boolean;
|
|
53
54
|
protected _overlapByStrategy(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
|
|
54
55
|
protected getBaseMarkGroup(): IGroup;
|
|
55
56
|
protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
|
package/es/label/base.js
CHANGED
|
@@ -236,12 +236,33 @@ export class LabelBase extends AbstractComponent {
|
|
|
236
236
|
}));
|
|
237
237
|
for (let i = 0; i < result.length; i++) {
|
|
238
238
|
const text = result[i], bounds = text.AABBBounds, range = boundToRange(bmpTool, bounds, !0);
|
|
239
|
-
canPlace(bmpTool, bitmap, bounds, clampForce,
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range); else {
|
|
240
|
+
if (clampForce) {
|
|
241
|
+
if (this._processClampForce(text, bmpTool, bitmap)) continue;
|
|
242
|
+
}
|
|
243
|
+
hideOnHit ? text.setAttributes({
|
|
244
|
+
visible: !1
|
|
245
|
+
}) : bitmap.setRange(range);
|
|
246
|
+
}
|
|
242
247
|
}
|
|
243
248
|
return result;
|
|
244
249
|
}
|
|
250
|
+
_processClampForce(text, bmpTool, bitmap) {
|
|
251
|
+
const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
252
|
+
if (0 === dx && 0 === dy) {
|
|
253
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)),
|
|
254
|
+
!0;
|
|
255
|
+
} else if (canPlace(bmpTool, bitmap, {
|
|
256
|
+
x1: text.AABBBounds.x1 + dx,
|
|
257
|
+
x2: text.AABBBounds.x2 + dx,
|
|
258
|
+
y1: text.AABBBounds.y1 + dy,
|
|
259
|
+
y2: text.AABBBounds.y2 + dy
|
|
260
|
+
})) return text.setAttributes({
|
|
261
|
+
x: text.attribute.x + dx,
|
|
262
|
+
y: text.attribute.y + dy
|
|
263
|
+
}), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), !0;
|
|
264
|
+
return !1;
|
|
265
|
+
}
|
|
245
266
|
_overlapByStrategy(labels, option, bmpTool, bitmap) {
|
|
246
267
|
var _a;
|
|
247
268
|
const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
|
|
@@ -281,22 +302,8 @@ export class LabelBase extends AbstractComponent {
|
|
|
281
302
|
break;
|
|
282
303
|
}
|
|
283
304
|
if (!hasPlace && clampForce) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
287
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
} else if (canPlace(bmpTool, bitmap, {
|
|
291
|
-
x1: text.AABBBounds.x1 + dx,
|
|
292
|
-
x2: text.AABBBounds.x2 + dx,
|
|
293
|
-
y1: text.AABBBounds.y1 + dy,
|
|
294
|
-
y2: text.AABBBounds.y2 + dy
|
|
295
|
-
})) {
|
|
296
|
-
text.setAttributes({
|
|
297
|
-
x: text.attribute.x + dx,
|
|
298
|
-
y: text.attribute.y + dy
|
|
299
|
-
}), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
305
|
+
if (this._processClampForce(text, bmpTool, bitmap)) {
|
|
306
|
+
result.push(text);
|
|
300
307
|
continue;
|
|
301
308
|
}
|
|
302
309
|
}
|