diff --git a/index.html b/index.html index 1a91abad7..ffe71e406 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + Spectacle diff --git a/one-page.html b/one-page.html index b80cb6655..be9d4d489 100644 --- a/one-page.html +++ b/one-page.html @@ -2,7 +2,7 @@ - + Spectacle diff --git a/src/components/__snapshots__/slide.test.js.snap b/src/components/__snapshots__/slide.test.js.snap index d58c7643f..c75263394 100644 --- a/src/components/__snapshots__/slide.test.js.snap +++ b/src/components/__snapshots__/slide.test.js.snap @@ -42,7 +42,6 @@ exports[` should render correctly with transitions. 1`] = ` innerRef={[Function]} margin={undefined} overviewMode={undefined} - scale={1} style={Object {}} styles={ Object { @@ -50,12 +49,10 @@ exports[` should render correctly with transitions. 1`] = ` } } width={undefined} - zoom={0.6} >
@@ -107,7 +104,6 @@ exports[` should render correctly without transitions. 1`] = ` innerRef={[Function]} margin={undefined} overviewMode={undefined} - scale={1} style={Object {}} styles={ Object { @@ -115,12 +111,10 @@ exports[` should render correctly without transitions. 1`] = ` } } width={undefined} - zoom={0.6} >
diff --git a/src/components/slide-components.js b/src/components/slide-components.js index 02045e4f3..e35a42400 100644 --- a/src/components/slide-components.js +++ b/src/components/slide-components.js @@ -38,27 +38,13 @@ export const SlideContentWrapper = styled.div(({ align, overviewMode }) => { }); export const SlideContent = styled.div(props => { - const { overviewMode, scale, zoom, margin, width, height, styles } = props; - - const getMargin = () => { - // ensure a "falsy" value of 0 still gets applied - if (margin === 0) { - return 0; - } - - if (!margin) { - return 40; - } - - return margin; - }; + const { overviewMode, width, height, styles } = props; const contentStyles = { flex: 1, maxHeight: height || 700, maxWidth: width || 1000, - transform: `scale(${scale})`, - padding: zoom > 0.6 ? getMargin() : 10 + padding: 10 }; const overviewStyles = { width: '100%' diff --git a/src/components/slide.js b/src/components/slide.js index eb2b147d7..ba28657d3 100644 --- a/src/components/slide.js +++ b/src/components/slide.js @@ -16,16 +16,12 @@ class Slide extends React.PureComponent { constructor() { super(...arguments); this.stepCounter = stepCounter(); - - this.setZoom = this.setZoom.bind(this); } state = { - contentScale: 1, reverse: false, transitioning: true, - z: 1, - zoom: 1 + z: 1 }; getChildContext() { @@ -38,7 +34,6 @@ class Slide extends React.PureComponent { } componentDidMount() { - this.setZoom(); const slide = this.slideRef; const frags = slide.querySelectorAll('.fragment'); let currentOrder = 0; @@ -66,8 +61,6 @@ class Slide extends React.PureComponent { currentOrder += 1; }); } - window.addEventListener('load', this.setZoom); - window.addEventListener('resize', this.setZoom); if (isFunction(this.props.onActive)) { this.props.onActive(this.props.slideIndex); @@ -82,11 +75,6 @@ class Slide extends React.PureComponent { } } - componentWillUnmount() { - window.removeEventListener('load', this.setZoom); - window.removeEventListener('resize', this.setZoom); - } - componentDidUpdate() { const { steps, slideIndex } = this.stepCounter.getSteps(); const stepFunc = this.props.getAnimStep || this.props.getAppearStep; @@ -97,32 +85,6 @@ class Slide extends React.PureComponent { } } - setZoom() { - const mobile = window.matchMedia('(max-width: 628px)').matches; - const content = this.contentRef; - if (content) { - const zoom = this.props.viewerScaleMode - ? 1 - : content.offsetWidth / this.context.contentWidth; - - const contentScaleY = - content.parentNode.offsetHeight / this.context.contentHeight; - const contentScaleX = this.props.viewerScaleMode - ? content.parentNode.offsetWidth / this.context.contentWidth - : content.parentNode.offsetWidth / this.context.contentHeight; - const minScale = Math.min(contentScaleY, contentScaleX); - - let contentScale = minScale < 1 ? minScale : 1; - if (mobile && this.props.viewerScaleMode !== true) { - contentScale = 1; - } - this.setState({ - zoom: zoom > 0.6 ? zoom : 0.6, - contentScale - }); - } - } - render() { const { presenterStyle, children } = this.props; @@ -156,8 +118,6 @@ class Slide extends React.PureComponent { overviewMode={this.context.overview} width={this.context.contentWidth} height={this.context.contentHeight} - scale={this.state.contentScale} - zoom={this.state.zoom} margin={this.props.margin} style={{ ...(this.props.contentStyles || {}) }} styles={{ context: this.context.styles.components.content }} @@ -181,6 +141,7 @@ Slide.propTypes = { align: PropTypes.string, children: PropTypes.node, className: PropTypes.string, + contentStyles: PropTypes.object, dispatch: PropTypes.func, export: PropTypes.bool, getAnimStep: PropTypes.func,