Skip to content

Commit

Permalink
Update comment in bottom panel and update variable names in right fly…
Browse files Browse the repository at this point in the history
…out and bottom panel

Signed-off-by: srikant <[email protected]>
  • Loading branch information
srikant-ch5 committed Nov 27, 2024
1 parent 517a273 commit ad96811
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import PropTypes from "prop-types";
import { connect } from "react-redux";
import Logger from "../logging/canvas-logger.js";

// Increase top margin by 100px to disable scroll in other components.
// Margin must be equal to or greater than the toolbar height
// plus the minimum allowed height for the canvas which is 150px.
const MARGIN_TOP = 200;
const MIN_HEIGHT = 75;

Expand Down Expand Up @@ -62,13 +63,13 @@ class CanvasBottomPanel extends React.Component {
// Returns a new height for the bottom panel limited by the need to enforce
// a minimum and maximum height.
limitHeight(ht) {
const canvasContainer = document.getElementById(this.props.containingDivId);
const containingDiv = document.getElementById(this.props.containingDivId);
let height = ht;

// canvasContainer may not be available in some test situations
if (canvasContainer) {
const canvasHeight = canvasContainer.getBoundingClientRect().height;
const maxHeight = canvasHeight - MARGIN_TOP;
// containingDiv may not be available in some test situations
if (containingDiv) {
const containingDivHt = containingDiv.getBoundingClientRect().height;
const maxHeight = containingDivHt - MARGIN_TOP;
height = Math.min(Math.max(height, MIN_HEIGHT), maxHeight);
}
return height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ class CommonCanvasRightFlyout extends React.Component {
// Returns a new width for right panel limited by the need to enforce
// a minimum and maximum width
limitWidth(wd) {
const canvasContainer = document.getElementById(this.props.containingDivId);
const containingDiv = document.getElementById(this.props.containingDivId);
let width = wd;

if (canvasContainer) {
if (containingDiv) {
// Max Width should be 70% of the total available width (canvas + rightflyout)
const canvasWidth = canvasContainer.getBoundingClientRect().width;
const maxWidth = (canvasWidth + this.props.panelWidth) * MAX_WIDTH_EXTEND_PERCENT;
const containingDivWth = containingDiv.getBoundingClientRect().width;
const maxWidth = (containingDivWth + this.props.panelWidth) * MAX_WIDTH_EXTEND_PERCENT;
width = Math.min(Math.max(width, this.initialWidth), maxWidth);
}

Expand Down

0 comments on commit ad96811

Please sign in to comment.