fix: deselect text before timeline selection

This commit is contained in:
Maze Winther
2025-08-27 17:55:54 +02:00
parent 06e3d0ca2a
commit d4e08bb7e3
+16
View File
@@ -190,6 +190,22 @@ export function useSelectionBox({
}; };
}, [selectionBox, selectElementsInBox]); }, [selectionBox, selectElementsInBox]);
useEffect(() => {
if (!selectionBox?.isActive) return;
const previousBodyUserSelect = document.body.style.userSelect;
const container = containerRef.current;
const previousContainerUserSelect = container?.style.userSelect ?? "";
document.body.style.userSelect = "none";
if (container) container.style.userSelect = "none";
return () => {
document.body.style.userSelect = previousBodyUserSelect;
if (container) container.style.userSelect = previousContainerUserSelect;
};
}, [selectionBox?.isActive, containerRef]);
return { return {
selectionBox, selectionBox,
handleMouseDown, handleMouseDown,