Skip to content

Commit

Permalink
kie-issues#1679 : If the bottom of the overlay panel is close to edit…
Browse files Browse the repository at this point in the history
…or bottom, it adds a vertical overflow after toggling an option (apache#2845)

Co-authored-by: chinnamatli kusumalatha <[email protected]>
  • Loading branch information
Kusuma04-dev and chinnamatli kusumalatha authored Jan 28, 2025
1 parent bbf18e9 commit 3acc428
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ export function OverlaysPanel({ availableHeight }: OverlaysPanelProps) {
const overlayPanelContainer = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
if (overlayPanelContainer.current && availableHeight) {
const bounds = overlayPanelContainer.current.getBoundingClientRect();
const currentHeight = bounds.height;
const yPos = bounds.y;
if (currentHeight + yPos >= availableHeight) {
if (overlayPanelContainer.current.scrollHeight <= availableHeight) {
overlayPanelContainer.current.style.overflowY = "hidden";
overlayPanelContainer.current.style.height = "auto";
} else if (
overlayPanelContainer.current.style.height !== availableHeight - BOTTOM_MARGIN + "px" &&
overlayPanelContainer.current.style.height !== "auto"
) {
overlayPanelContainer.current.style.height = availableHeight - BOTTOM_MARGIN + "px";
overlayPanelContainer.current.style.overflowY = "scroll";
} else {
overlayPanelContainer.current.style.overflowY = "visible";
overlayPanelContainer.current.style.overflowY = "auto";
}
}
});
}, [availableHeight]);

return (
<div ref={overlayPanelContainer}>
Expand Down

0 comments on commit 3acc428

Please sign in to comment.