Skip to content

Commit 90b7cd0

Browse files
siddharthkpSaraVieira
authored andcommitted
add max limit for height (codesandbox#2409)
1 parent 2e20a8f commit 90b7cd0

File tree

1 file changed

+9
-2
lines changed
  • packages/app/src/app/components/Preview/DevTools

1 file changed

+9
-2
lines changed

packages/app/src/app/components/Preview/DevTools/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,15 @@ export class DevTools extends React.PureComponent<Props, State> {
326326
event: MouseEvent & { clientX: number; clientY: number }
327327
) => {
328328
if (this.state.mouseDown) {
329-
const newHeight =
330-
this.state.startHeight - (event.clientY - this.state.startY);
329+
let maxHeight = 0;
330+
if (this.node) {
331+
maxHeight = this.node.parentElement.getBoundingClientRect().height;
332+
}
333+
334+
const newHeight = Math.min(
335+
maxHeight,
336+
this.state.startHeight - (event.clientY - this.state.startY)
337+
);
331338

332339
this.setState({
333340
height: Math.max(this.closedHeight() - 2, newHeight),

0 commit comments

Comments
 (0)