From 4d03951800f77a3bd21715b376257a06104cf04b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 25 Apr 2024 11:54:43 +0800 Subject: [PATCH] fix: adjust button tool matrix --- packages/x6/src/registry/tool/button.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/x6/src/registry/tool/button.ts b/packages/x6/src/registry/tool/button.ts index 17f1ed29497..f76d54cfef4 100644 --- a/packages/x6/src/registry/tool/button.ts +++ b/packages/x6/src/registry/tool/button.ts @@ -55,10 +55,9 @@ export class Button extends ToolsView.ToolItem< x = NumberExt.normalizePercentage(x, bbox.width) y = NumberExt.normalizePercentage(y, bbox.height) - let matrix = Dom.createSVGMatrix().translate( - bbox.x + bbox.width / 2, - bbox.y + bbox.height / 2, - ) + const origin = this.parent.options.local ? [bbox.width / 2, bbox.height / 2] : [bbox.x + bbox.width / 2, bbox.y + bbox.height / 2]; + + let matrix = Dom.createSVGMatrix().translate(origin[0], origin[1]) if (rotate) { matrix = matrix.rotate(angle)