Skip to content

Commit

Permalink
Fix: Scroller was not operating correctly in the non-linear scrolling…
Browse files Browse the repository at this point in the history
… region, although only really noticable at the exterimities

- DD-969
  • Loading branch information
AllanJard committed Aug 1, 2019
1 parent 958f897 commit c99f0fe
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions js/dataTables.scroller.js
Expand Up @@ -419,7 +419,7 @@ $.extend( Scroller.prototype, {
}
}

if ( typeof animate == 'undefined' || animate )
if ( animate === undefined || animate )
{
this.s.ani = ani;
$(this.dom.scroller).animate( {
Expand All @@ -429,7 +429,7 @@ $.extend( Scroller.prototype, {
// the final scroll event fired
setTimeout( function () {
that.s.ani = false;
}, 25 );
}, 250 );
} );
}
else
Expand Down Expand Up @@ -786,11 +786,11 @@ $.extend( Scroller.prototype, {
if ( val < magic ) {
return val;
}
else if ( dir === 'virtualToPhysical' && val > heights.virtual - magic ) {
else if ( dir === 'virtualToPhysical' && val >= heights.virtual - magic ) {
diff = heights.virtual - val;
return heights.scroll - diff;
}
else if ( dir === 'physicalToVirtual' && val > heights.scroll - magic ) {
else if ( dir === 'physicalToVirtual' && val >= heights.scroll - magic ) {
diff = heights.scroll - val;
return heights.virtual - diff;
}
Expand All @@ -803,17 +803,12 @@ $.extend( Scroller.prototype, {
// causing a kink in the scrolling ratio. It does mean the scrollbar is
// non-linear, but with such massive data sets, the scrollbar is going
// to be a best guess anyway
var xMax = dir === 'virtualToPhysical' ?
heights.virtual :
heights.scroll;
var yMax = dir === 'virtualToPhysical' ?
heights.scroll :
heights.virtual;

var m = (yMax - magic) / (xMax - magic);
var m = (heights.virtual - magic - magic) / (heights.scroll - magic - magic);
var c = magic - (m*magic);

return (m*val) + c;
return dir === 'virtualToPhysical' ?
(val-c) / m :
(m*val) + c;
},

/**
Expand Down

0 comments on commit c99f0fe

Please sign in to comment.