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) {
|
else if (touchState.event == TE_SLIDE_END && slidingWindow) {
|
||||||
if (abs(touchState.lastDeltaX) >= 5 || abs(touchState.lastDeltaY) >= 5) {
|
if (touchState.lastDeltaX > SLIDE_SPEED_REDUCTION)
|
||||||
onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, touchState.lastDeltaX, touchState.lastDeltaY);
|
touchState.lastDeltaX -= SLIDE_SPEED_REDUCTION;
|
||||||
touchState.lastDeltaX = (touchState.lastDeltaX * 3) >> 2;
|
else if (touchState.lastDeltaX < -SLIDE_SPEED_REDUCTION)
|
||||||
touchState.lastDeltaY = (touchState.lastDeltaY * 3) >> 2;
|
touchState.lastDeltaX += SLIDE_SPEED_REDUCTION;
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
touchState.lastDeltaX = 0;
|
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;
|
touchState.lastDeltaY = 0;
|
||||||
|
if (touchState.lastDeltaX || touchState.lastDeltaY) {
|
||||||
|
onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, touchState.lastDeltaX, touchState.lastDeltaY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -346,7 +346,7 @@ void Window::checkEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
if (touchState.event != TE_SLIDE) {
|
if (touchState.event != TE_SLIDE && touchState.lastDeltaX == 0 && touchState.lastDeltaY == 0) {
|
||||||
if (pageWidth) {
|
if (pageWidth) {
|
||||||
coord_t relativeScrollPosition = scrollPositionX % pageWidth;
|
coord_t relativeScrollPosition = scrollPositionX % pageWidth;
|
||||||
if (relativeScrollPosition) {
|
if (relativeScrollPosition) {
|
||||||
|
|||||||
Reference in New Issue
Block a user