Skip to content

Commit

Permalink
Updated the canvas sizing method
Browse files Browse the repository at this point in the history
  • Loading branch information
Eimi Okuno authored and Eimi Okuno committed Oct 18, 2019
1 parent 24a70e5 commit 3ca6863
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const VideoContextPreview = (props) => {
<canvas
ref={ props.canvasRef }
width={ props.width }
height={ props.height }
height={ (9 / 16) * props.width }
/>
</Row>
<Row
Expand All @@ -75,16 +75,13 @@ const VideoContextPreview = (props) => {

VideoContextPreview.propTypes = {
canvasRef: PropTypes.any,
height: PropTypes.number,
playlist: PropTypes.array,
videoContext: PropTypes.any,
width: PropTypes.number
width: PropTypes.any
};

VideoContextPreview.defaultProps = {
playlist: [],
width : 640,
height : 360,
playlist: []
};

export default VideoContextPreview;
2 changes: 0 additions & 2 deletions packages/components/PreviewCanvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ const PreviewCanvas = (props) => {
return (
<VideoContextPreview
width={ props.width }
height={ props.height }
canvasRef={ canvasRef }
playlist={ props.playlist }
/>
);
};

PreviewCanvas.propTypes = {
height: PropTypes.any,
playlist: PropTypes.array,
width: PropTypes.any
};
Expand Down
95 changes: 43 additions & 52 deletions packages/components/ProgrammeScriptEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,56 @@ import PreviewCanvas from '../PreviewCanvas';
class ProgramScript extends Component {
constructor(props) {
super(props);
this.state = {
resetPreview: false,
playlist: props.playlist
};
}

// information around progressbar in the playlist object
render() {
Heading = () => {
return (
<>
<Container>
<Row>
<h2
title={ `Programme Script Title: ${ this.props.title }` }>
</h2>);
}

<Col>
</Col>
<Col>
<h2
className={ [ 'text-truncate', 'text-muted' ].join(' ') }
title={ `Programme Script Title: ${ this.state.programmeScript ? this.state.programmeScript.title : '' }` }>
{this.state.programmeScript ? this.state.programmeScript.title : ''}
</h2>
<Card>
<Card.Header>
{ !this.state.resetPreview ?
<PreviewCanvas width="100%" height="100%" playlist={ this.state.playlist } />
: null }
</Card.Header>
ProgrammeCard = () => {
return (
<Card>
<Card.Header>
<PreviewCanvas width={ 300 } playlist={ this.props.playlist } />
</Card.Header>

<Card.Header>
<Row noGutters>
<Col sm={ 12 } md={ 3 } >
<Button variant="outline-secondary"
onClick={ this.handleUpdatePreview }
title="update preview"
>
<FontAwesomeIcon icon={ faSync } /> Preview
</Button>
</Col>
</Row>
</Card.Header>
<Card.Body>
<article
style={ { height: '60vh', overflow: 'scroll' } }
>
<ProgrammeScriptContainer
items={ this.props.items }
handleReorder={ this.props.handleReorder }
handleDelete={ this.props.handleDelete }
handleEdit={ this.props.handleEdit }
/>

<Card.Body>
<article
style={ { height: '60vh', overflow: 'scroll' } }
>
<ProgrammeScriptContainer
items={ this.props.items }
handleReorder={ this.props.handleReorder }
handleDelete={ this.props.handleDelete }
handleEdit={ this.props.handleEdit }
/>
</article>
</Card.Body>
</Card>);
}

</article>
</Card.Body>
</Card>
</Col>
</Row>
</Container>
</>
// information around progressbar in the playlist object
render() {
const heading = this.Heading();
const card = this.ProgrammeCard();

return (
<Container>
<Row>
<Col>
{heading}
{card}
</Col>
<Col>
{heading}
{card}
</Col>
</Row>
</Container>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const playlist = [
storiesOf('ProgrammeScriptEditor (not published)', module)
.add('Default', () =>
<ProgrammeScriptEditor
title={ 'title' }
playlist={ playlist }
items={ items }
handleDelete={ handleDeleteActions }
Expand Down

0 comments on commit 3ca6863

Please sign in to comment.