From 12d3db2dbc80438df60139c67e9bcf0a610532d6 Mon Sep 17 00:00:00 2001 From: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com> Date: Tue, 4 Feb 2025 08:31:40 -0500 Subject: [PATCH] fix(context-menu): Fixing regression introduced by PR #4727 (#4760) --- platform/ui/src/components/ContextMenu/ContextMenu.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/ui/src/components/ContextMenu/ContextMenu.tsx b/platform/ui/src/components/ContextMenu/ContextMenu.tsx index c2bd83889..dcacb92d5 100644 --- a/platform/ui/src/components/ContextMenu/ContextMenu.tsx +++ b/platform/ui/src/components/ContextMenu/ContextMenu.tsx @@ -6,17 +6,17 @@ import { Icons } from '@ohif/ui-next'; const ContextMenu = ({ items, ...props }) => { const contextMenuRef = useRef(null); useEffect(() => { - if(!contextMenuRef?.current) { + if (!contextMenuRef?.current) { return; } const contextMenu = contextMenuRef.current; const boundingClientRect = contextMenu.getBoundingClientRect(); - if (boundingClientRect.bottom + boundingClientRect.height > window.innerHeight) { + if (boundingClientRect.bottom > window.innerHeight) { props.defaultPosition.y = props.defaultPosition.y - boundingClientRect.height; } - if (boundingClientRect.right + boundingClientRect.width > window.innerWidth) { + if (boundingClientRect.right > window.innerWidth) { props.defaultPosition.x = props.defaultPosition.x - boundingClientRect.width; } }, [props.defaultPosition]);