Skip to content

Commit eab2d02

Browse files
committed
feat: use small stage in an iframe
1 parent 4408b4f commit eab2d02

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/scratch-gui/src/playground/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body,
77
margin: 0;
88

99
/* Setting min height/width makes the UI scroll below those sizes */
10-
min-width: 1024px;
10+
min-width: 960px;
1111
min-height: 640px; /* Min height to fit sprite/backdrop button */
1212
}
1313

packages/scratch-gui/src/reducers/stage-size.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import {STAGE_DISPLAY_SIZES} from '../lib/layout-constants.js';
22

33
const SET_STAGE_SIZE = 'scratch-gui/StageSize/SET_STAGE_SIZE';
44

5+
const isInIframe = typeof window !== 'undefined' && window.self !== window.top;
6+
57
const initialState = {
6-
stageSize: STAGE_DISPLAY_SIZES.large
8+
stageSize: isInIframe ? STAGE_DISPLAY_SIZES.small : STAGE_DISPLAY_SIZES.large
79
};
810

911
const reducer = function (state, action) {

0 commit comments

Comments
 (0)