@@ -1637,7 +1637,7 @@ window.CodeMirror = (function() {
1637
1637
// is that it gives us a chance to update the display before the
1638
1638
// actual scrolling happens, reducing flickering.
1639
1639
1640
- var wheelSamples = 0 , wheelDX , wheelDY , wheelStartX , wheelStartY , wheelPixelsPerUnit = null ;
1640
+ var wheelSamples = 0 , wheelPixelsPerUnit = null ;
1641
1641
// Fill in a browser-detected starting value on browsers where we
1642
1642
// know one. These don't have to be accurate -- the result of them
1643
1643
// being wrong would just be a slight flicker on the first wheel
@@ -1678,7 +1678,7 @@ window.CodeMirror = (function() {
1678
1678
setScrollTop ( cm , Math . max ( 0 , Math . min ( scroll . scrollTop + dy * wheelPixelsPerUnit , scroll . scrollHeight - scroll . clientHeight ) ) ) ;
1679
1679
setScrollLeft ( cm , Math . max ( 0 , Math . min ( scroll . scrollLeft + dx * wheelPixelsPerUnit , scroll . scrollWidth - scroll . clientWidth ) ) ) ;
1680
1680
e_preventDefault ( e ) ;
1681
- wheelStartX = null ; // Abort measurement, if in progress
1681
+ cm . wheelStartX = null ; // Abort measurement, if in progress
1682
1682
return ;
1683
1683
}
1684
1684
@@ -1691,22 +1691,22 @@ window.CodeMirror = (function() {
1691
1691
}
1692
1692
1693
1693
if ( wheelSamples < 20 ) {
1694
- if ( wheelStartX == null ) {
1695
- wheelStartX = scroll . scrollLeft ; wheelStartY = scroll . scrollTop ;
1696
- wheelDX = dx ; wheelDY = dy ;
1694
+ if ( cm . wheelStartX == null ) {
1695
+ cm . wheelStartX = scroll . scrollLeft ; cm . wheelStartY = scroll . scrollTop ;
1696
+ cm . wheelDX = dx ; cm . wheelDY = dy ;
1697
1697
setTimeout ( function ( ) {
1698
- if ( wheelStartX == null ) return ;
1699
- var movedX = scroll . scrollLeft - wheelStartX ;
1700
- var movedY = scroll . scrollTop - wheelStartY ;
1701
- var sample = ( movedY && wheelDY && movedY / wheelDY ) ||
1702
- ( movedX && wheelDX && movedX / wheelDX ) ;
1703
- wheelStartX = wheelStartY = null ;
1698
+ if ( cm . wheelStartX == null ) return ;
1699
+ var movedX = scroll . scrollLeft - cm . wheelStartX ;
1700
+ var movedY = scroll . scrollTop - cm . wheelStartY ;
1701
+ var sample = ( movedY && cm . wheelDY && movedY / cm . wheelDY ) ||
1702
+ ( movedX && cm . wheelDX && movedX / cm . wheelDX ) ;
1703
+ cm . wheelStartX = cm . wheelStartY = null ;
1704
1704
if ( ! sample ) return ;
1705
1705
wheelPixelsPerUnit = ( wheelPixelsPerUnit * wheelSamples + sample ) / ( wheelSamples + 1 ) ;
1706
1706
++ wheelSamples ;
1707
1707
} , 200 ) ;
1708
1708
} else {
1709
- wheelDX += dx ; wheelDY += dy ;
1709
+ cm . wheelDX += dx ; cm . wheelDY += dy ;
1710
1710
}
1711
1711
}
1712
1712
}
0 commit comments