File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 7070 "webpack" : " ^1.13.2"
7171 },
7272 "peerDependencies" : {
73- "react" : " 15.x" ,
74- "react-dom" : " 15.x" ,
73+ "react" : " 0.14.x || 15.x" ,
74+ "react-dom" : " 0.14.x || 15.x" ,
7575 "prop-types" : " ^15.x"
7676 },
7777 "dependencies" : {}
Original file line number Diff line number Diff line change @@ -68,8 +68,17 @@ export default class ScrollSync extends Component {
6868 }
6969
7070 syncScrollPositions = ( scrolledPane ) => {
71- const { scrollTop, scrollHeight, clientHeight,
72- scrollLeft, scrollWidth, clientWidth } = scrolledPane
71+ const {
72+ scrollTop,
73+ scrollHeight,
74+ clientHeight,
75+ scrollLeft,
76+ scrollWidth,
77+ clientWidth
78+ } = scrolledPane
79+
80+ const scrollTopOffset = scrollHeight - clientHeight
81+ const scrollLeftOffset = scrollWidth - clientWidth
7382
7483 const { proportional, vertical, horizontal } = this . props
7584
@@ -82,11 +91,11 @@ export default class ScrollSync extends Component {
8291 const paneHeight = pane . scrollHeight - clientHeight
8392 const paneWidth = pane . scrollWidth - clientWidth
8493 /* Adjust the scrollTop position of it accordingly */
85- if ( vertical ) {
86- pane . scrollTop = proportional ? ( paneHeight * scrollTop ) / ( scrollHeight - clientHeight ) : scrollTop // eslint-disable-line
94+ if ( vertical && scrollTopOffset > 0 ) {
95+ pane . scrollTop = proportional ? ( paneHeight * scrollTop ) / scrollTopOffset : scrollTop // eslint-disable-line
8796 }
88- if ( horizontal ) {
89- pane . scrollLeft = proportional ? ( paneWidth * scrollLeft ) / ( scrollWidth - clientWidth ) : scrollLeft // eslint-disable-line
97+ if ( horizontal && scrollLeftOffset > 0 ) {
98+ pane . scrollLeft = proportional ? ( paneWidth * scrollLeft ) / scrollLeftOffset : scrollLeft // eslint-disable-line
9099 }
91100 /* Re-attach event listeners after we're done scrolling */
92101 window . requestAnimationFrame ( ( ) => {
You can’t perform that action at this time.
0 commit comments