From d9fb243d14e21e9d8b62dfee8601a08c020358f0 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 12 Feb 2025 11:24:43 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=B2=B4=ED=81=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useTrestle.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 86e744fa..61198ad4 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -2443,25 +2443,25 @@ export const useTrestle = () => { (centerPoint) => Math.abs(centerPoint.x - halfTopRightPoint.x) < maxX && Math.abs(centerPoint.y - halfTopRightPoint.y) < maxY, ) } - if (leftModule) { + if (!leftModule) { leftPoint = { x: x - width, y: y } leftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - leftPoint.x) < maxX && Math.abs(centerPoint.y - leftPoint.y) < maxY, ) } - if (rightModule) { + if (!rightModule) { rightPoint = { x: x + width, y: y } rightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - rightPoint.x) < maxX && Math.abs(centerPoint.y - rightPoint.y) < maxY, ) } - if (bottomLeftModule) { + if (!bottomLeftModule) { bottomLeftPoint = { x: x - width, y: y + h } bottomLeftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - bottomLeftPoint.y) < maxY, ) } - if (bottomRightModule) { + if (!bottomRightModule) { bottomRightPoint = { x: x + width, y: y + h } bottomRightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < maxX && Math.abs(centerPoint.y - bottomRightPoint.y) < maxY, @@ -2504,25 +2504,25 @@ export const useTrestle = () => { (centerPoint) => Math.abs(centerPoint.x - halfTopRightPoint.x) < maxX && Math.abs(centerPoint.y - halfTopRightPoint.y) < maxY, ) } - if (leftModule) { + if (!leftModule) { leftPoint = { x: x + width, y: y } leftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - leftPoint.x) < maxX && Math.abs(centerPoint.y - leftPoint.y) < maxY, ) } - if (rightModule) { + if (!rightModule) { rightPoint = { x: x - width, y: y } rightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - rightPoint.x) < maxX && Math.abs(centerPoint.y - rightPoint.y) < maxY, ) } - if (bottomLeftModule) { + if (!bottomLeftModule) { bottomLeftPoint = { x: x + width, y: y - h } bottomLeftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - bottomLeftPoint.y) < maxY, ) } - if (bottomRightModule) { + if (!bottomRightModule) { bottomRightPoint = { x: x - width, y: y - h } bottomRightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < maxX && Math.abs(centerPoint.y - bottomRightPoint.y) < maxY,