Slide improved (keep the energy for multipages scroll)
This commit is contained in:
+12
-6
@@ -64,14 +64,20 @@ void MainWindow::checkEvents()
|
||||
}
|
||||
}
|
||||
else if (touchState.event == TE_SLIDE_END && slidingWindow) {
|
||||
if (abs(touchState.lastDeltaX) >= 5 || abs(touchState.lastDeltaY) >= 5) {
|
||||
onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, touchState.lastDeltaX, touchState.lastDeltaY);
|
||||
touchState.lastDeltaX = (touchState.lastDeltaX * 3) >> 2;
|
||||
touchState.lastDeltaY = (touchState.lastDeltaY * 3) >> 2;
|
||||
}
|
||||
else {
|
||||
if (touchState.lastDeltaX > SLIDE_SPEED_REDUCTION)
|
||||
touchState.lastDeltaX -= SLIDE_SPEED_REDUCTION;
|
||||
else if (touchState.lastDeltaX < -SLIDE_SPEED_REDUCTION)
|
||||
touchState.lastDeltaX += SLIDE_SPEED_REDUCTION;
|
||||
else
|
||||
touchState.lastDeltaX = 0;
|
||||
if (touchState.lastDeltaY > SLIDE_SPEED_REDUCTION)
|
||||
touchState.lastDeltaY -= SLIDE_SPEED_REDUCTION;
|
||||
else if (touchState.lastDeltaY < -SLIDE_SPEED_REDUCTION)
|
||||
touchState.lastDeltaY += SLIDE_SPEED_REDUCTION;
|
||||
else
|
||||
touchState.lastDeltaY = 0;
|
||||
if (touchState.lastDeltaX || touchState.lastDeltaY) {
|
||||
onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, touchState.lastDeltaX, touchState.lastDeltaY);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -346,7 +346,7 @@ void Window::checkEvents()
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
if (touchState.event != TE_SLIDE) {
|
||||
if (touchState.event != TE_SLIDE && touchState.lastDeltaX == 0 && touchState.lastDeltaY == 0) {
|
||||
if (pageWidth) {
|
||||
coord_t relativeScrollPosition = scrollPositionX % pageWidth;
|
||||
if (relativeScrollPosition) {
|
||||
|
||||
Reference in New Issue
Block a user