From ffa4ac145adc7a49a7e34c3450a27b49693b4899 Mon Sep 17 00:00:00 2001 From: bendman Date: Sat, 8 Sep 2018 11:50:39 -0700 Subject: [PATCH] Fixes #680 by adjusting canvas and iframe layout - Set the preview canvas to `display:block` to remove vertical spacing caused by the default value, which was making a full-height canvas cause vertical scrolling, and the vertical scrollbar caused horizontal scrolling - Wrap the preview content in a container with `position:relative` and no other visible content, so that the full-height iframe excludes the height of the preview frame header, preventing it from going beyond the height of the page --- client/modules/IDE/pages/IDEView.jsx | 70 ++++++++++---------- client/modules/IDE/reducers/files.js | 3 + client/styles/components/_preview-frame.scss | 10 +++ server/examples.js | 3 + 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/client/modules/IDE/pages/IDEView.jsx b/client/modules/IDE/pages/IDEView.jsx index 46d4558b..d829a3f0 100644 --- a/client/modules/IDE/pages/IDEView.jsx +++ b/client/modules/IDE/pages/IDEView.jsx @@ -370,41 +370,43 @@ class IDEView extends React.Component {

Preview

-
{ this.overlay = element; }}> +
+
{ this.overlay = element; }}> +
+
+ {( + ( + (this.props.preferences.textOutput || + this.props.preferences.gridOutput || + this.props.preferences.soundOutput + ) && + this.props.ide.isPlaying + ) || + this.props.ide.isAccessibleOutputPlaying + ) + } +
+
-
- {( - ( - (this.props.preferences.textOutput || - this.props.preferences.gridOutput || - this.props.preferences.soundOutput - ) && - this.props.ide.isPlaying - ) || - this.props.ide.isAccessibleOutputPlaying - ) - } -
-
diff --git a/client/modules/IDE/reducers/files.js b/client/modules/IDE/reducers/files.js index 19c1aa81..3f3ebac0 100644 --- a/client/modules/IDE/reducers/files.js +++ b/client/modules/IDE/reducers/files.js @@ -31,6 +31,9 @@ const defaultCSS = margin: 0; padding: 0; } +canvas { + display: block; +} `; const initialState = () => { diff --git a/client/styles/components/_preview-frame.scss b/client/styles/components/_preview-frame.scss index 8c356972..0b7e6610 100644 --- a/client/styles/components/_preview-frame.scss +++ b/client/styles/components/_preview-frame.scss @@ -5,6 +5,11 @@ border-width: 0; } +.preview-frame-holder { + display: flex; + flex-direction: column; + height: 100%; +} .preview-frame-overlay { height: 100%; @@ -37,3 +42,8 @@ font-size: #{12 / $base-font-size}rem; font-weight: normal; } + +.preview-frame__content { + position: relative; + flex: 1 1 0; +} \ No newline at end of file diff --git a/server/examples.js b/server/examples.js index bdf54c1d..fb167436 100644 --- a/server/examples.js +++ b/server/examples.js @@ -28,6 +28,9 @@ const defaultCSS = margin: 0; padding: 0; } +canvas { + display: block; +} `; const clientId = process.env.GITHUB_ID;