Skip to content
Snippets Groups Projects
Unverified Commit 8802c9c5 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #1196 from josiahneuberger/resize-stage-header-to-stage-size

center/size stage-header controls in the same way as stage in fullscreen
parents 3ebbcb99 481db33d
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
.stage-menu-wrapper { .stage-menu-wrapper {
display: flex; display: flex;
margin: auto;
justify-content: space-between; justify-content: space-between;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
......
...@@ -8,6 +8,7 @@ import Box from '../box/box.jsx'; ...@@ -8,6 +8,7 @@ import Box from '../box/box.jsx';
import Button from '../button/button.jsx'; import Button from '../button/button.jsx';
import {ComingSoonTooltip} from '../coming-soon/coming-soon.jsx'; import {ComingSoonTooltip} from '../coming-soon/coming-soon.jsx';
import Controls from '../../containers/controls.jsx'; import Controls from '../../containers/controls.jsx';
import {getStageSize} from '../../lib/screen-utils.js';
import fullScreenIcon from './icon--fullscreen.svg'; import fullScreenIcon from './icon--fullscreen.svg';
import largeStageIcon from './icon--large-stage.svg'; import largeStageIcon from './icon--large-stage.svg';
...@@ -49,11 +50,15 @@ const StageHeaderComponent = function (props) { ...@@ -49,11 +50,15 @@ const StageHeaderComponent = function (props) {
} = props; } = props;
let header = null; let header = null;
const stageSize = getStageSize(isFullScreen);
if (isFullScreen) { if (isFullScreen) {
header = ( header = (
<Box className={styles.stageHeaderWrapperOverlay}> <Box className={styles.stageHeaderWrapperOverlay}>
<Box className={styles.stageMenuWrapper}> <Box
className={styles.stageMenuWrapper}
style={{width: stageSize.width}}
>
<Controls vm={vm} /> <Controls vm={vm} />
<Button <Button
className={styles.stageButton} className={styles.stageButton}
......
...@@ -6,6 +6,7 @@ import Box from '../box/box.jsx'; ...@@ -6,6 +6,7 @@ import Box from '../box/box.jsx';
import Loupe from '../loupe/loupe.jsx'; import Loupe from '../loupe/loupe.jsx';
import MonitorList from '../../containers/monitor-list.jsx'; import MonitorList from '../../containers/monitor-list.jsx';
import Question from '../../containers/question.jsx'; import Question from '../../containers/question.jsx';
import {getStageSize} from '../../lib/screen-utils.js';
import styles from './stage.css'; import styles from './stage.css';
const StageComponent = props => { const StageComponent = props => {
...@@ -22,18 +23,8 @@ const StageComponent = props => { ...@@ -22,18 +23,8 @@ const StageComponent = props => {
...boxProps ...boxProps
} = props; } = props;
let heightCorrectedAspect = height; const stageSize = getStageSize(isFullScreen, height, width);
let widthCorrectedAspect = width;
const spacingBorderAdjustment = 9;
const stageMenuHeightAdjustment = 40;
if (isFullScreen) {
heightCorrectedAspect = window.innerHeight - stageMenuHeightAdjustment - spacingBorderAdjustment;
widthCorrectedAspect = heightCorrectedAspect + (heightCorrectedAspect / 3);
if (widthCorrectedAspect > window.innerWidth) {
widthCorrectedAspect = window.innerWidth;
heightCorrectedAspect = widthCorrectedAspect * .75;
}
}
return ( return (
<div> <div>
<Box <Box
...@@ -50,8 +41,8 @@ const StageComponent = props => { ...@@ -50,8 +41,8 @@ const StageComponent = props => {
)} )}
componentRef={canvasRef} componentRef={canvasRef}
element="canvas" element="canvas"
height={heightCorrectedAspect} height={stageSize.height}
width={widthCorrectedAspect} width={stageSize.width}
{...boxProps} {...boxProps}
/> />
<Box className={styles.monitorWrapper}> <Box className={styles.monitorWrapper}>
...@@ -71,7 +62,7 @@ const StageComponent = props => { ...@@ -71,7 +62,7 @@ const StageComponent = props => {
> >
<div <div
className={styles.questionWrapper} className={styles.questionWrapper}
style={{width: widthCorrectedAspect}} style={{width: stageSize.width}}
> >
<Question <Question
question={question} question={question}
......
const STAGE_SIZE_DEFAULTS = {
heightSmall: 360,
widthSmall: 480,
spacingBorderAdjustment: 9,
menuHeightAdjustment: 40
};
const getStageSize = (
isFullScreen = false,
height = STAGE_SIZE_DEFAULTS.heightSmall,
width = STAGE_SIZE_DEFAULTS.widthSmall) => {
const stageSize = {
heightDefault: height,
widthDefault: width,
height: height,
width: width
};
if (isFullScreen) {
stageSize.height = window.innerHeight -
STAGE_SIZE_DEFAULTS.menuHeightAdjustment -
STAGE_SIZE_DEFAULTS.spacingBorderAdjustment;
stageSize.width = stageSize.height + (stageSize.height / 3);
if (stageSize.width > window.innerWidth) {
stageSize.width = window.innerWidth;
stageSize.height = stageSize.width * .75;
}
}
return stageSize;
};
export {
getStageSize,
STAGE_SIZE_DEFAULTS
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment