From 9dc3b22919b7666c2a2dde3f3bb710f87412b322 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Mon, 13 May 2024 14:27:21 +0700 Subject: [PATCH] BUGFIX: Tail window position does not update when being dragged (#1275) --- src/ui/React/LogBoxManager.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/React/LogBoxManager.tsx b/src/ui/React/LogBoxManager.tsx index ca5773f41..5c5d0e648 100644 --- a/src/ui/React/LogBoxManager.tsx +++ b/src/ui/React/LogBoxManager.tsx @@ -307,8 +307,15 @@ function LogWindow({ hidden, script, onClose }: LogWindowProps): React.ReactElem if ( e instanceof MouseEvent && (e.clientX < 0 || e.clientY < 0 || e.clientX > innerWidth || e.clientY > innerHeight) - ) + ) { return false; + } + if (rootRef.current) { + // We can set x,y directly. Calling setPosition will make unnecessary calls of updateDOM and rerender. + const currentState = rootRef.current.state as { x: number; y: number }; + propsRef.current.x = currentState.x; + propsRef.current.y = currentState.y; + } }; // Max [width, height]