edit store
This commit is contained in:
@@ -772,7 +772,10 @@ export const useEditorStore = create<EditorStoreType>((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<EditorStoreType>((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);
|
||||
|
||||
Reference in New Issue
Block a user