Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2246 Dragging Bottom Panel beyond its Max Height with Top Panel open hides Right Flyout Buttons #2247

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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