@@ -1637,7 +1637,7 @@ window.CodeMirror = (function() {
16371637 // is that it gives us a chance to update the display before the
16381638 // actual scrolling happens, reducing flickering.
16391639
1640- var wheelSamples = 0 , wheelDX , wheelDY , wheelStartX , wheelStartY , wheelPixelsPerUnit = null ;
1640+ var wheelSamples = 0 , wheelPixelsPerUnit = null ;
16411641 // Fill in a browser-detected starting value on browsers where we
16421642 // know one. These don't have to be accurate -- the result of them
16431643 // being wrong would just be a slight flicker on the first wheel
@@ -1678,7 +1678,7 @@ window.CodeMirror = (function() {
16781678 setScrollTop ( cm , Math . max ( 0 , Math . min ( scroll . scrollTop + dy * wheelPixelsPerUnit , scroll . scrollHeight - scroll . clientHeight ) ) ) ;
16791679 setScrollLeft ( cm , Math . max ( 0 , Math . min ( scroll . scrollLeft + dx * wheelPixelsPerUnit , scroll . scrollWidth - scroll . clientWidth ) ) ) ;
16801680 e_preventDefault ( e ) ;
1681- wheelStartX = null ; // Abort measurement, if in progress
1681+ cm . wheelStartX = null ; // Abort measurement, if in progress
16821682 return ;
16831683 }
16841684
@@ -1691,22 +1691,22 @@ window.CodeMirror = (function() {
16911691 }
16921692
16931693 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 ;
16971697 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 ;
17041704 if ( ! sample ) return ;
17051705 wheelPixelsPerUnit = ( wheelPixelsPerUnit * wheelSamples + sample ) / ( wheelSamples + 1 ) ;
17061706 ++ wheelSamples ;
17071707 } , 200 ) ;
17081708 } else {
1709- wheelDX += dx ; wheelDY += dy ;
1709+ cm . wheelDX += dx ; cm . wheelDY += dy ;
17101710 }
17111711 }
17121712 }
0 commit comments