0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-07 22:52:39 +00:00

Editor and renderer redraw when you resize the browser

This commit is contained in:
Scott Tolksdorf
2016-08-20 13:26:48 -04:00
parent ef8784ccf2
commit 888d3faa4c
4 changed files with 22 additions and 11 deletions

View File

@@ -23,11 +23,20 @@ var BrewRenderer = React.createClass({
height : 0,
componentDidMount: function() {
this.updateSize();
window.addEventListener("resize", this.updateSize);
},
componentWillUnmount: function() {
window.removeEventListener("resize", this.updateSize);
},
updateSize : function() {
this.setState({
height : this.refs.main.parentNode.clientHeight,
isMounted : true
});
},
handleScroll : function(e){
this.setState({
viewablePageNumber : Math.floor(e.target.scrollTop / PAGE_HEIGHT)