File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,10 @@ const Slide = React.createClass({
3838 const zoom = ( content . offsetWidth / config . width ) ;
3939 const contentScaleY = ( content . parentNode . offsetHeight / config . height ) ;
4040 const contentScaleX = ( content . parentNode . offsetWidth / config . width ) ;
41+ const contentScale = Math . min ( contentScaleY , contentScaleX ) ;
4142 this . setState ( {
4243 zoom : zoom > 0.6 ? zoom : 0.6 ,
43- contentScaleY : contentScaleY < 1 ? contentScaleY : 1 ,
44- contentScaleX : contentScaleX < 1 ? contentScaleX : 1
44+ contentScale : contentScale < 1 ? contentScale : 1
4545 } ) ;
4646 } ,
4747 componentDidMount ( ) {
@@ -78,12 +78,10 @@ const Slide = React.createClass({
7878 position : "absolute" ,
7979 top : "50%" ,
8080 left : "50%" ,
81- width : "100%" ,
8281 maxHeight : config . height ,
83- maxWidth : config . width ,
82+ width : config . width ,
8483 fontSize : 16 * this . state . zoom ,
85- transform : " translate(-50%,-50%) scale(" + this . state . contentScaleX + "," +
86- this . state . contentScaleY + ")" ,
84+ transform : " translate(-50%,-50%) scale(" + this . state . contentScale + ")" ,
8785 padding : this . state . zoom > 0.6 ? config . margin : 10
8886 }
8987 } ;
You can’t perform that action at this time.
0 commit comments