BUGFIX: Tail window position does not update when being dragged (#1275)

This commit is contained in:
catloversg 2024-05-13 14:27:21 +07:00 committed by GitHub
parent 25afecc0ec
commit 9dc3b22919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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]