From d9397fc457009af5ca6257558ac5dee761c71ab8 Mon Sep 17 00:00:00 2001 From: zsviczian Date: Tue, 21 Oct 2025 19:34:27 +0200 Subject: [PATCH] Calculate collisionPadding dynamically based on container --- .../excalidraw/components/PropertiesPopover.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/excalidraw/components/PropertiesPopover.tsx b/packages/excalidraw/components/PropertiesPopover.tsx index caa0650d63..68601ef475 100644 --- a/packages/excalidraw/components/PropertiesPopover.tsx +++ b/packages/excalidraw/components/PropertiesPopover.tsx @@ -41,6 +41,19 @@ export const PropertiesPopover = React.forwardRef< ) => { const device = useDevice(); + const collisionPadding = React.useMemo(() => { + if (!container) { + return 8; + } + const rect = container.getBoundingClientRect(); + return { + top: Math.max(8, rect.top), + right: Math.max(8, window.innerWidth - rect.right), + bottom: Math.max(8, window.innerHeight - rect.bottom), + left: Math.max(8, rect.left), + }; + }, [container]); + return (