diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-08-28 22:39:19 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-08-28 22:39:19 +0200 |
| commit | 2d834a49d7d222d7f70ee6b4cf7ab2827b88bb0e (patch) | |
| tree | db8a33eb12c6294cc0000caf05c600fe3c33069e /apps/web/src/hooks/use-selection-box.ts | |
| parent | 792fb6cdc06ebcd578d9e27821eb25a7dba9dbd2 (diff) | |
| parent | a7d90f7eac90966920c750134d7de9b611b2c38f (diff) | |
| download | opencut-2d834a49d7d222d7f70ee6b4cf7ab2827b88bb0e.tar.gz | |
Merge branch 'staging'
Diffstat (limited to 'apps/web/src/hooks/use-selection-box.ts')
| -rw-r--r-- | apps/web/src/hooks/use-selection-box.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/web/src/hooks/use-selection-box.ts b/apps/web/src/hooks/use-selection-box.ts index 46e77fa9..87026500 100644 --- a/apps/web/src/hooks/use-selection-box.ts +++ b/apps/web/src/hooks/use-selection-box.ts @@ -190,6 +190,22 @@ export function useSelectionBox({ }; }, [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 { selectionBox, handleMouseDown, |
