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,