Skip to content

Commit 96818d8

Browse files
samrith-sCompuIves
authored andcommitted
Set max size on drag resize handlers (#1691)
* Fix issue #1654 * Ensure terminal takes precedence over preview while dragging * Flex does not try to shrink terminal anymore * Conditionally set flexShrink to console based on devToolIndex
1 parent 91c75bc commit 96818d8

File tree

1 file changed

+11
-7
lines changed
  • packages/app/src/app/components/Preview/DevTools

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ export default class DevTools extends React.PureComponent<Props, State> {
219219
});
220220
};
221221

222-
getCurrentPane = () => {
223-
return this.props.viewConfig.views[this.state.currentPaneIndex];
224-
};
222+
getCurrentPane = () =>
223+
this.props.viewConfig.views[this.state.currentPaneIndex];
225224

226225
updateStatus = (id: string) => (
227226
status: 'success' | 'warning' | 'error' | 'info' | 'clear',
@@ -397,9 +396,7 @@ export default class DevTools extends React.PureComponent<Props, State> {
397396
});
398397
};
399398

400-
getViews = (): IViews => {
401-
return this.allViews;
402-
};
399+
getViews = (): IViews => this.allViews;
403400

404401
node: HTMLElement;
405402
allViews: IViews;
@@ -425,9 +422,16 @@ export default class DevTools extends React.PureComponent<Props, State> {
425422
}}
426423
style={{
427424
height: primary ? '100%' : height,
428-
minHeight: height,
429425
position: 'relative',
430426
display: 'flex',
427+
maxHeight: '100%',
428+
/**
429+
* Necessary to ensure it drags naturally. Otherwise there's an issue
430+
* where flex tries to allocate equal space to the preview and the terminal,
431+
* resulting in a very jaggy experience. We set flex-shrink to 0 only
432+
* for the console, and not for the preview
433+
*/
434+
flexShrink: devToolIndex === 1 ? 0 : 1,
431435
}}
432436
>
433437
{!hideTabs && (

0 commit comments

Comments
 (0)