Add keybindings for resizing frames#754
Add keybindings for resizing frames#754djbarnwal wants to merge 2 commits intoiodide-project:iframe-2from
Conversation
bcolloran
left a comment
There was a problem hiding this comment.
looks good overall, a few small changes in the comments.
(and of course merge master in)
| }} | ||
| > | ||
| <div id="cells"> | ||
| <div style={this.props.cellsClass} id="cells"> |
There was a problem hiding this comment.
cellsClass shoulc be cellsStyle
| handleClasses={{ right: 'resizer' }} | ||
| bounds="window" | ||
| minWidth={300} | ||
| minWidth={0} |
There was a problem hiding this comment.
allowing minWidth=0 allows some weird behavior when manually pulling the divider to the extreme right. this is not a big deal, but maybe we should pass in minWidth with props so that we can set it to 300 when we're not in the zero width condition, and we can set it to zero in the zero width condition.
| // for editorWidth calc. We're using this | ||
| // because re-resizable doesn't intelligently deal w/ calc(100% - 20px) or whatever. | ||
| const DEFAULT_EDITOR_WIDTH = Math.round(document.documentElement.clientWidth / 2) | ||
| const SCREEN_WIDTH = document.documentElement.clientWidth |
There was a problem hiding this comment.
SCREEN_WIDTH needs to update with window resize
| // ) | ||
|
|
||
| export const paneSizes = [0, 0.33, 0.5, 0.66, 1].map(x => Math.round(x * SCREEN_WIDTH)) | ||
|
|
There was a problem hiding this comment.
export the const with [0, 0.33, 0.5, 0.66, 1], and compute the actual pixel widths in the reducer (since SCREEN_WIDTH will need to update on resize)
| if (width < paneSizes[1]) width = paneSizes[1] | ||
| else if (width < paneSizes[2]) width = paneSizes[2] | ||
| else if (width < paneSizes[3]) width = paneSizes[3] | ||
| else width = paneSizes[4] |
There was a problem hiding this comment.
calculate pixel vals of paneSizes here
|
|
||
| case 'DECREASE_EDITOR_WIDTH': { | ||
| let width = state.editorWidth | ||
| if (width > paneSizes[3]) width = paneSizes[3] |
There was a problem hiding this comment.
calculate pixel vals of paneSizes here
|
@djbarnwal let me know when you are ready for another review on this one. i see you still need to merge master, so i'm not sure if you have other things planned as well. |
|
@djbarnwal oops, can you push this branch again @djbarnwal |
This implements
Ctrl+leftandCtrl+rightkeybindings which help you resize the two frames in steps of 0%, 33%, 50%, 66% and 100% .Closes Issue #726