From 9ef112e04d85a59bcbc9cb4ea47672e93e7858ab Mon Sep 17 00:00:00 2001 From: nalpari Date: Fri, 5 Jul 2024 09:16:12 +0900 Subject: [PATCH] fix: Refactor useMode hook to fix line positioning bug --- src/hooks/useMode.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index ebe02701..88d50d4a 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -457,10 +457,10 @@ export function useMode() { if (historyLines.current[i].direction === 'top') { if (prev.direction !== 'right') { newOuterlines.push({ - x1: historyLines.current[i].x1 + 50, - y1: historyLines.current[i].y1 - 50, - x2: historyLines.current[i].x2 + 50, - y2: historyLines.current[i].y2 + 50, + x1: historyLines.current[i].x1 - 50, + y1: historyLines.current[i].y1 + 50, + x2: historyLines.current[i].x2 - 50, + y2: historyLines.current[i].y2 - 50, }) } else { newOuterlines.push({ @@ -499,10 +499,10 @@ export function useMode() { }) } else { newOuterlines.push({ - x1: historyLines.current[i].x1 + 50, - y1: historyLines.current[i].y1 - 50, - x2: historyLines.current[i].x2 + 50, - y2: historyLines.current[i].y2 - 50, + x1: historyLines.current[i].x1 - 50, + y1: historyLines.current[i].y1 + 50, + x2: historyLines.current[i].x2 - 50, + y2: historyLines.current[i].y2 + 50, }) } } else { @@ -545,16 +545,16 @@ export function useMode() { if (prev?.direction !== 'top') { newOuterlines.push({ x1: historyLines.current[i].x1 + 50, - y1: historyLines.current[i].y1 - 50, + y1: historyLines.current[i].y1 + 50, x2: historyLines.current[i].x2 - 50, - y2: historyLines.current[i].y2 - 50, + y2: historyLines.current[i].y2 + 50, }) } else { newOuterlines.push({ - x1: historyLines.current[i].x1 + 50, - y1: historyLines.current[i].y1 - 50, - x2: historyLines.current[i].x2 + 50, - y2: historyLines.current[i].y2 - 50, + x1: historyLines.current[i].x1 - 50, + y1: historyLines.current[i].y1 + 50, + x2: historyLines.current[i].x2 - 50, + y2: historyLines.current[i].y2 + 50, }) } }