mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 13:16:44 +00:00
ignore scroll events with zero scroll movement
This commit is contained in:
parent
21d91d3d10
commit
f6fd889712
2 changed files with 9 additions and 7 deletions
|
@ -49,13 +49,15 @@ public class FeeRangeSlider extends Slider {
|
||||||
});
|
});
|
||||||
|
|
||||||
setOnScroll(event -> {
|
setOnScroll(event -> {
|
||||||
double newFeeRate = getFeeRate() + (event.getDeltaY() > 0 ? FEE_RATE_SCROLL_INCREMENT : -FEE_RATE_SCROLL_INCREMENT);
|
if(event.getDeltaY() != 0) {
|
||||||
if(newFeeRate < LONG_FEE_RATES_RANGE.get(0)) {
|
double newFeeRate = getFeeRate() + (event.getDeltaY() > 0 ? FEE_RATE_SCROLL_INCREMENT : -FEE_RATE_SCROLL_INCREMENT);
|
||||||
newFeeRate = LONG_FEE_RATES_RANGE.get(0);
|
if(newFeeRate < LONG_FEE_RATES_RANGE.get(0)) {
|
||||||
} else if(newFeeRate > LONG_FEE_RATES_RANGE.get(LONG_FEE_RATES_RANGE.size() - 1)) {
|
newFeeRate = LONG_FEE_RATES_RANGE.get(0);
|
||||||
newFeeRate = LONG_FEE_RATES_RANGE.get(LONG_FEE_RATES_RANGE.size() - 1);
|
} else if(newFeeRate > LONG_FEE_RATES_RANGE.get(LONG_FEE_RATES_RANGE.size() - 1)) {
|
||||||
|
newFeeRate = LONG_FEE_RATES_RANGE.get(LONG_FEE_RATES_RANGE.size() - 1);
|
||||||
|
}
|
||||||
|
setFeeRate(newFeeRate);
|
||||||
}
|
}
|
||||||
setFeeRate(newFeeRate);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class QRDisplayDialog extends Dialog<ButtonType> {
|
||||||
stackPane.getChildren().add(qrImageView);
|
stackPane.getChildren().add(qrImageView);
|
||||||
|
|
||||||
qrImageView.setOnScroll(scrollEvent -> {
|
qrImageView.setOnScroll(scrollEvent -> {
|
||||||
if(animateQRService != null && animateQRService.isRunning()) {
|
if(animateQRService != null && animateQRService.isRunning() && scrollEvent.getDeltaY() != 0) {
|
||||||
Duration duration = animateQRService.getPeriod();
|
Duration duration = animateQRService.getPeriod();
|
||||||
Duration newDuration = scrollEvent.getDeltaY() > 0 ? duration.multiply(1.1) : duration.multiply(0.9);
|
Duration newDuration = scrollEvent.getDeltaY() > 0 ? duration.multiply(1.1) : duration.multiply(0.9);
|
||||||
if(newDuration.lessThan(Duration.millis(ANIMATION_PERIOD_MILLIS*10)) && newDuration.greaterThan(Duration.millis(ANIMATION_PERIOD_MILLIS/2))) {
|
if(newDuration.lessThan(Duration.millis(ANIMATION_PERIOD_MILLIS*10)) && newDuration.greaterThan(Duration.millis(ANIMATION_PERIOD_MILLIS/2))) {
|
||||||
|
|
Loading…
Reference in a new issue