From 1cafbb2bfa11836181cbff4c9d76c23f58bb51b8 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Thu, 19 Feb 2026 11:41:42 +0330 Subject: [PATCH] edit store --- src/pages/editor/store/editorStore.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages/editor/store/editorStore.ts b/src/pages/editor/store/editorStore.ts index d958ad1..1b0a86c 100644 --- a/src/pages/editor/store/editorStore.ts +++ b/src/pages/editor/store/editorStore.ts @@ -772,7 +772,10 @@ export const useEditorStore = create((set, get) => { } // برای مثلث و abstract، x و y در store گوشه بالا-چپ است اما در render مرکز استفاده می‌شود - if (obj.type === "rectangle" && (obj.shapeType === "triangle" || obj.shapeType === "abstract")) { + if ( + obj.type === "rectangle" && + (obj.shapeType === "triangle" || obj.shapeType === "abstract") + ) { // محاسبه مرکز از گوشه بالا-چپ const cx = (obj.x || 0) + w / 2; const cy = (obj.y || 0) + h / 2; @@ -798,8 +801,10 @@ export const useEditorStore = create((set, get) => { ]; corners.forEach((corner) => { - const rotatedX = corner.x * Math.cos(rot) - corner.y * Math.sin(rot); - const rotatedY = corner.x * Math.sin(rot) + corner.y * Math.cos(rot); + const rotatedX = + corner.x * Math.cos(rot) - corner.y * Math.sin(rot); + const rotatedY = + corner.x * Math.sin(rot) + corner.y * Math.cos(rot); const finalX = cx + rotatedX; const finalY = cy + rotatedY; minX = Math.min(minX, finalX); @@ -816,7 +821,7 @@ export const useEditorStore = create((set, get) => { const startY = obj.y || 0; const endX = obj.width || 0; const endY = obj.height || 0; - + // برای arrow و line، bounding box از نقطه شروع تا نقطه پایان است minX = Math.min(minX, startX, endX); minY = Math.min(minY, startY, endY);