ScrollBar: fixed jittery scrolling when in repeating mode (hold down mouse button) and smooth scrolling enabled

This commit is contained in:
Karl Tauber
2020-08-11 10:13:55 +02:00
parent 1ae31588c4
commit 305e9e602e
2 changed files with 12 additions and 3 deletions

View File

@@ -558,11 +558,20 @@ public class FlatSmoothScrollingTest
}
}
/**
* One or two values between two equal values are considered "temporary",
* which means that they are the target value for the following scroll animation.
*/
private boolean isTemporaryValue( List<Data> chartData, int i ) {
if( i == 0 || i == chartData.size() - 1 )
return false;
return chartData.get( i - 1 ).value == chartData.get( i + 1 ).value;
double valueBefore = chartData.get( i - 1 ).value;
double valueAfter = chartData.get( i + 1 ).value;
return valueBefore == valueAfter ||
(i < chartData.size() - 2 && valueBefore == chartData.get( i + 2 ).value) ||
(i > 1 && chartData.get( i - 2 ).value == valueAfter);
}
private int chartWidth() {