From 2b7466c0eda5fdea4dacb238dc6f90a660b0b33a Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 16 Jan 2024 15:05:28 +0800 Subject: [PATCH] fix: fix issue with html attribute --- .../vrender-core/develop_2024-01-16-07-05.json | 10 ++++++++++ .../plugins/builtin-plugin/html-attribute-plugin.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 common/changes/@visactor/vrender-core/develop_2024-01-16-07-05.json diff --git a/common/changes/@visactor/vrender-core/develop_2024-01-16-07-05.json b/common/changes/@visactor/vrender-core/develop_2024-01-16-07-05.json new file mode 100644 index 000000000..fffa65a59 --- /dev/null +++ b/common/changes/@visactor/vrender-core/develop_2024-01-16-07-05.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-core", + "comment": "fix: fix issue with 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 6168614dc..138caf775 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 @@ -127,12 +127,12 @@ export class HtmlAttributePlugin implements IPlugin { } let left: number = 0; let top: number = 0; - if (anchorType === 'position') { + const b = graphic.globalAABBBounds; + if (anchorType === 'position' || b.empty()) { const matrix = graphic.globalTransMatrix; left = matrix.e; top = matrix.f; } else { - const b = graphic.globalAABBBounds; left = b.x1; top = b.y1; }