mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 05:42:40 +00:00
Move will-change to stylesheet
This makes `will-change: transform` permanent in the brewRenderer stylesheet rather than trying to load and unload it programatically.
This commit is contained in:
@@ -25,7 +25,6 @@ const BrewRenderer = createClass({
|
|||||||
return {
|
return {
|
||||||
viewablePageNumber : 0,
|
viewablePageNumber : 0,
|
||||||
height : 0,
|
height : 0,
|
||||||
willChange : 'auto',
|
|
||||||
isMounted : false,
|
isMounted : false,
|
||||||
|
|
||||||
usePPR : true,
|
usePPR : true,
|
||||||
@@ -127,20 +126,6 @@ const BrewRenderer = createClass({
|
|||||||
return this.lastRender;
|
return this.lastRender;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Optimize for smooth scrolling when mouse enters the rendering panel
|
|
||||||
**/
|
|
||||||
prepareScroll : function(){
|
|
||||||
this.setState({ willChange: 'transform' });
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unload smooth scrolling optimizations when mouse leaves rendering panel
|
|
||||||
**/
|
|
||||||
unprepareScroll : function(){
|
|
||||||
this.setState({ willChange: 'auto' });
|
|
||||||
},
|
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -149,8 +134,7 @@ const BrewRenderer = createClass({
|
|||||||
onMouseOver={this.prepareScroll}
|
onMouseOver={this.prepareScroll}
|
||||||
onMouseOut={this.unprepareScroll}
|
onMouseOut={this.unprepareScroll}
|
||||||
ref='main'
|
ref='main'
|
||||||
style={{ height : this.state.height,
|
style={{ height : this.state.height }}>
|
||||||
willChange : this.state.willChange }}>
|
|
||||||
|
|
||||||
<ErrorBar errors={this.props.errors} />
|
<ErrorBar errors={this.props.errors} />
|
||||||
<RenderWarnings />
|
<RenderWarnings />
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
position : relative;
|
position : relative;
|
||||||
}
|
}
|
||||||
.brewRenderer{
|
.brewRenderer{
|
||||||
overflow-y : scroll;
|
will-change : transform;
|
||||||
|
overflow-y : scroll;
|
||||||
.pages{
|
.pages{
|
||||||
margin : 30px 0px;
|
margin : 30px 0px;
|
||||||
&>.phb{
|
&>.phb{
|
||||||
|
|||||||
Reference in New Issue
Block a user