feat(map): add reference layers and stabilize workspace controls

This commit is contained in:
Codex
2026-07-25 13:12:24 +03:00
parent c859ae4db0
commit eaecce9f56
29 changed files with 1593 additions and 247 deletions
+4 -2
View File
@@ -63,10 +63,12 @@ export function Window({
const titleId = useId();
const descriptionId = useId();
const dialogRef = useRef<HTMLDivElement>(null);
const onCloseRef = useRef(onClose);
const dragRef = useRef<{ pointerId: number; offsetX: number; offsetY: number } | null>(null);
const [dragPosition, setDragPosition] = useState<{ left: number; top: number } | null>(null);
const shouldLockBodyScroll = lockBodyScroll ?? placement === "center";
const shouldTrapFocus = trapFocus ?? placement === "center";
onCloseRef.current = onClose;
useEffect(() => {
if (!open || typeof document === "undefined") return;
@@ -82,7 +84,7 @@ export function Window({
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === "Escape" && closeOnEscape) {
event.preventDefault();
onClose();
onCloseRef.current();
return;
}
if (event.key !== "Tab" || !shouldTrapFocus || !dialogRef.current) return;
@@ -110,7 +112,7 @@ export function Window({
if (shouldLockBodyScroll) document.body.style.overflow = previousOverflow;
previousActiveElement?.focus();
};
}, [closeOnEscape, onClose, open, shouldLockBodyScroll, shouldTrapFocus]);
}, [closeOnEscape, open, shouldLockBodyScroll, shouldTrapFocus]);
useEffect(() => {
if (!open) setDragPosition(null);