diff --git a/src/shared/ui/floating-window.tsx b/src/shared/ui/floating-window.tsx index 5b1fc16..73b764b 100644 --- a/src/shared/ui/floating-window.tsx +++ b/src/shared/ui/floating-window.tsx @@ -4,6 +4,7 @@ import { Rnd } from "react-rnd"; import { Maximize2, Minimize2, X } from "lucide-react"; import { Button } from "./button"; import { floatingWindowHost, floatingWindowOrder, raiseFloatingWindow, removeFloatingWindow, subscribeFloatingWindows } from "./floating-window-layer"; +import { useFloatingWindowDrag } from "./use-floating-window-drag"; type Bounds = { x: number; y: number; width: number; height: number }; @@ -84,6 +85,9 @@ export function FloatingWindow({ title, triggerLabel, fillContent = false, openR const current = maximized ? { x: 8, y: 8, width: viewport.width - 16, height: viewport.height - 16 } : bounds; + const startDrag = useFloatingWindowDrag({ enabled: open && !maximized, position: current, + width: current.width, height: current.height, + onCommit: (position) => setBounds((previous) => fitWindow({ ...previous, ...position })) }); return <>