Skip to content

Commit

Permalink
resolves #35. Remove GPU usage, add another positioning div to solve …
Browse files Browse the repository at this point in the history
…double scroll bug in Chrome retina
  • Loading branch information
rommguy committed Mar 12, 2018
1 parent c0cc189 commit 3ee8220
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dist/customScroll.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
min-height: 0;
min-width: 0; }
.custom-scroll .outer-container {
overflow: hidden;
position: relative;
transform: translateZ(0); }
overflow: hidden; }
.custom-scroll .outer-container .positioning {
position: relative; }
.custom-scroll .outer-container:hover .custom-scrollbar {
opacity: 1;
transition-duration: 0.2s; }
Expand Down
2 changes: 1 addition & 1 deletion dist/reactCustomScroll.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/example.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/example.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions example/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ th {
min-height: 0;
min-width: 0; }
.custom-scroll .outer-container {
overflow: hidden;
position: relative;
transform: translateZ(0); }
overflow: hidden; }
.custom-scroll .outer-container .positioning {
position: relative; }
.custom-scroll .outer-container:hover .custom-scrollbar {
opacity: 1;
transition-duration: 0.2s; }
Expand Down
8 changes: 5 additions & 3 deletions src/main/cs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

.outer-container {
overflow: hidden;
position: relative;
transform: translateZ(0);

.positioning {
position: relative;
}

&:hover .custom-scrollbar {
opacity: 1;
Expand All @@ -19,7 +21,7 @@
overflow-x: hidden;
overflow-y: scroll;

&:after {
&:after{
content: '';
position: absolute;
top: 0;
Expand Down
6 changes: 3 additions & 3 deletions src/main/customScroll.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
min-height: 0;
min-width: 0; }
.custom-scroll .outer-container {
overflow: hidden;
position: relative;
transform: translateZ(0); }
overflow: hidden; }
.custom-scroll .outer-container .positioning {
position: relative; }
.custom-scroll .outer-container:hover .custom-scrollbar {
opacity: 1;
transition-duration: 0.2s; }
Expand Down
6 changes: 4 additions & 2 deletions src/main/customScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ class CustomScroll extends React.Component {
style={this.getOuterContainerStyle()}
onMouseDown={this.onMouseDown}
onClick={this.onClick}>
{this.hasScroll && (
{this.hasScroll ? (
<div className="positioning">
<div ref={this.setCustomScrollbarRef}
className={`custom-scrollbar${ this.props.rtl ? ' custom-scrollbar-rtl' : ''}`}
key="scrollbar">
Expand All @@ -355,7 +356,8 @@ class CustomScroll extends React.Component {
style={scrollHandleStyle}>
<div className={this.props.handleClass}></div>
</div>
</div>)}
</div>
</div>) : null}
<div ref={this.setRefElement('innerContainer')}
className={this.getInnerContainerClasses()}
style={scrollStyles.innerContainer}
Expand Down

0 comments on commit 3ee8220

Please sign in to comment.