diff --git a/common/changes/@visactor/vrender-core/fix-html-position_2024-01-05-03-52.json b/common/changes/@visactor/vrender-core/fix-html-position_2024-01-05-03-52.json new file mode 100644 index 000000000..83ef4e768 --- /dev/null +++ b/common/changes/@visactor/vrender-core/fix-html-position_2024-01-05-03-52.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-core", + "comment": "fix: fix issue with position in html attribute", + "type": "none" + } + ], + "packageName": "@visactor/vrender-core" +} \ No newline at end of file diff --git a/packages/vrender-core/src/plugins/builtin-plugin/html-attribute-plugin.ts b/packages/vrender-core/src/plugins/builtin-plugin/html-attribute-plugin.ts index 56adb1ed6..6168614dc 100644 --- a/packages/vrender-core/src/plugins/builtin-plugin/html-attribute-plugin.ts +++ b/packages/vrender-core/src/plugins/builtin-plugin/html-attribute-plugin.ts @@ -128,11 +128,11 @@ export class HtmlAttributePlugin implements IPlugin { let left: number = 0; let top: number = 0; if (anchorType === 'position') { - const matrix = graphic.transMatrix; + const matrix = graphic.globalTransMatrix; left = matrix.e; top = matrix.f; } else { - const b = graphic.AABBBounds; + const b = graphic.globalAABBBounds; left = b.x1; top = b.y1; } diff --git a/packages/vrender/__tests__/browser/src/pages/html.ts b/packages/vrender/__tests__/browser/src/pages/html.ts index d31bad93f..a7d167473 100644 --- a/packages/vrender/__tests__/browser/src/pages/html.ts +++ b/packages/vrender/__tests__/browser/src/pages/html.ts @@ -35,7 +35,7 @@ export const page = () => { y: (Math.floor((i * 100) / 500) + 1) * 100, size: 60, html: { - dom: '