diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 0e88d590..3f52f0ca 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -807,7 +807,9 @@ export const useTrestle = () => { heightArr.forEach((h) => { topLeftPoint = { x: x - width / 2, y: y - h } if (result) return - result = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < maxX && Math.abs(centerPoint.y - topLeftPoint.y)) + result = centerPoints.find( + (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < maxX && Math.abs(centerPoint.y - topLeftPoint.y) < maxY, + ) }) break @@ -818,7 +820,9 @@ export const useTrestle = () => { heightArr.forEach((h) => { topLeftPoint = { x: x + width / 2, y: y + h } if (result) return - result = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < maxX && Math.abs(centerPoint.y - topLeftPoint.y)) + result = centerPoints.find( + (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < maxX && Math.abs(centerPoint.y - topLeftPoint.y) < maxY, + ) }) break } @@ -864,7 +868,9 @@ export const useTrestle = () => { heightArr.forEach((h) => { topRightPoint = { x: x + width / 2, y: y - h } if (result) return - result = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < maxX && Math.abs(centerPoint.y - topRightPoint.y)) + result = centerPoints.find( + (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < maxX && Math.abs(centerPoint.y - topRightPoint.y) < maxY, + ) }) break @@ -873,7 +879,9 @@ export const useTrestle = () => { heightArr.forEach((h) => { topRightPoint = { x: x - width / 2, y: y + h } if (result) return - result = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < maxX && Math.abs(centerPoint.y - topRightPoint.y)) + result = centerPoints.find( + (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < maxX && Math.abs(centerPoint.y - topRightPoint.y) < maxY, + ) }) break }