Skip to content

Commit

Permalink
#2246 Dragging Bottom Panel beyond its Max Height with Top Panel open…
Browse files Browse the repository at this point in the history
… hides Right Flyout Buttons (#2247)

Signed-off-by: srikant <[email protected]>
  • Loading branch information
srikant-ch5 authored Dec 2, 2024
1 parent 4fb8bd0 commit 91c8dad
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Logger from "../logging/canvas-logger.js";
// plus the minimum allowed height for the canvas which is 150px.
const MARGIN_TOP = 200;
const MIN_HEIGHT = 75;
const TOP_PANEL_CLASSNAME = "top-panel";

class CanvasBottomPanel extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -64,12 +65,20 @@ class CanvasBottomPanel extends React.Component {
// a minimum and maximum height.
limitHeight(ht) {
const containingDiv = document.getElementById(this.props.containingDivId);
const topPanelDiv = document.getElementsByClassName(TOP_PANEL_CLASSNAME);
let height = ht;
let topPanelHeight = 0;

// Consider top panel height while calculating maxHeight to disable scroll
// in right flyout.
if (topPanelDiv.length > 0) {
topPanelHeight = topPanelDiv[0].getBoundingClientRect().height;
}

// containingDiv may not be available in some test situations
if (containingDiv) {
const containingDivHt = containingDiv.getBoundingClientRect().height;
const maxHeight = containingDivHt - MARGIN_TOP;
const maxHeight = containingDivHt - MARGIN_TOP - topPanelHeight;
height = Math.min(Math.max(height, MIN_HEIGHT), maxHeight);
}
return height;
Expand Down

0 comments on commit 91c8dad

Please sign in to comment.