diff --git a/common/changes/@visactor/vrender-components/fix-3d-arc-label_2024-12-25-09-02.json b/common/changes/@visactor/vrender-components/fix-3d-arc-label_2024-12-25-09-02.json new file mode 100644 index 000000000..c198bcc2a --- /dev/null +++ b/common/changes/@visactor/vrender-components/fix-3d-arc-label_2024-12-25-09-02.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "fix: handle the additional logic of 3d arc label layout", + "type": "none" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index f935fd928..3d0879474 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -29,6 +29,7 @@ import { isFunction } from '@visactor/vutils'; export class ArcInfo { key!: string; refDatum!: any; + refArc!: IArc; /** * 绘图区圆弧中点 */ @@ -239,6 +240,14 @@ export class ArcLabel extends LabelBase { basedArc.labelLimit ?? (labels[i].attribute as ITextAttribute).maxLineWidth; } + if (basedArc.refArc && basedArc.refArc.type === 'arc3d') { + (labelAttribute as any).anchor3d = [ + basedArc.circleCenter.x - labelAttribute.x, + basedArc.circleCenter.y - labelAttribute.y + ]; + (labelAttribute as any).beta = basedArc.refArc.attribute.beta; + } + labels[i].setAttributes(labelAttribute); } } @@ -290,7 +299,7 @@ export class ArcLabel extends LabelBase { graphicAttribute.outerRadius, center ); - + arc.refArc = currentMark as IArc; arc.pointA = polarToCartesian( center as IPoint, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), @@ -1006,6 +1015,14 @@ export class ArcLabel extends LabelBase { curveType: 'basis' }); } + + if (baseMark.type === 'arc3d' && baseMark) { + const { beta, x, y } = baseMark.attribute; + lineGraphic.setAttributes({ + beta, + anchor3d: [x, y] + }); + } } return lineGraphic;