mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-26 18:16:54 +00:00
Editor and renderer redraw when you resize the browser
This commit is contained in:
1 parent
ef8784ccf2
commit
888d3faa4c
4 files changed
+22
-11
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user