From 468d75fe0068e87030f727c838ba7f9e649e31f9 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Fri, 5 Jan 2024 11:56:04 +0800 Subject: [PATCH] fix: fix issue with position in html attribute --- .../fix-html-position_2024-01-05-03-52.json | 10 ++++++++++ .../plugins/builtin-plugin/html-attribute-plugin.ts | 4 ++-- packages/vrender/__tests__/browser/src/pages/html.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 common/changes/@visactor/vrender-core/fix-html-position_2024-01-05-03-52.json 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: '
这是abcdefg
', + dom: '
这是abcdefg
', width: 60, height: 60 },