mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[escher] Scroll speed increase for long repetition in scrollable views.
Change-Id: Ie7671ced53da1a144068756f6b584dbb287f9e0e
This commit is contained in:
committed by
Émilie Feral
parent
b60c67ff88
commit
c9964e69c2
@@ -12,28 +12,29 @@ ScrollableView::ScrollableView(Responder * parentResponder, View * view, ScrollV
|
||||
|
||||
bool ScrollableView::handleEvent(Ion::Events::Event event) {
|
||||
KDPoint translation = KDPointZero;
|
||||
KDCoordinate scrollStep = Ion::Events::longRepetitionScrollSpeed() * Metric::ScrollStep;
|
||||
if (event == Ion::Events::Left) {
|
||||
KDCoordinate movementToEdge = contentOffset().x();
|
||||
if (movementToEdge > 0) {
|
||||
translation = KDPoint(-std::min(Metric::ScrollStep, movementToEdge), 0);
|
||||
translation = KDPoint(-std::min(scrollStep, movementToEdge), 0);
|
||||
}
|
||||
}
|
||||
if (event == Ion::Events::Right) {
|
||||
KDCoordinate movementToEdge = minimalSizeForOptimalDisplay().width() - bounds().width() - contentOffset().x();
|
||||
if (movementToEdge > 0) {
|
||||
translation = KDPoint(std::min(Metric::ScrollStep, movementToEdge), 0);
|
||||
translation = KDPoint(std::min(scrollStep, movementToEdge), 0);
|
||||
}
|
||||
}
|
||||
if (event == Ion::Events::Up) {
|
||||
KDCoordinate movementToEdge = contentOffset().y();
|
||||
if (movementToEdge > 0) {
|
||||
translation = KDPoint(0, -std::min(Metric::ScrollStep, movementToEdge));
|
||||
translation = KDPoint(0, -std::min(scrollStep, movementToEdge));
|
||||
}
|
||||
}
|
||||
if (event == Ion::Events::Down) {
|
||||
KDCoordinate movementToEdge = minimalSizeForOptimalDisplay().height() - bounds().height() - contentOffset().y();
|
||||
if (movementToEdge > 0) {
|
||||
translation = KDPoint(0, std::min(Metric::ScrollStep, movementToEdge));
|
||||
translation = KDPoint(0, std::min(scrollStep, movementToEdge));
|
||||
}
|
||||
}
|
||||
if (translation != KDPointZero) {
|
||||
|
||||
Reference in New Issue
Block a user