Touch support reworked

This commit is contained in:
Bertrand Songis
2020-02-24 17:25:37 +01:00
parent a92db98b9f
commit d965541267
+9 -8
View File
@@ -42,20 +42,21 @@ void MainWindow::emptyTrash()
void MainWindow::checkEvents() void MainWindow::checkEvents()
{ {
#if defined(HARDWARE_TOUCH) #if defined(HARDWARE_TOUCH)
if (touchPanelEventOccured()) {
touchPanelRead();
}
if (touchState.event == TE_DOWN) { if (touchState.event == TE_DOWN) {
onTouchStart(touchState.x + scrollPositionX, touchState.y + scrollPositionY); onTouchStart(touchState.x + scrollPositionX, touchState.y + scrollPositionY);
// touchState.Event = TE_NONE;
} }
else if (touchState.event == TE_UP) { else if (touchState.event == TE_UP) {
touchState.event = TE_NONE;
onTouchEnd(touchState.startX + scrollPositionX, touchState.startY + scrollPositionY); onTouchEnd(touchState.startX + scrollPositionX, touchState.startY + scrollPositionY);
touchState.event = TE_NONE;
} }
else if (touchState.event == TE_SLIDE) { else if (touchState.event == TE_SLIDE && (touchState.deltaX || touchState.deltaY)) {
coord_t x = touchState.x - touchState.lastX; onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, touchState.deltaX, touchState.deltaY);
coord_t y = touchState.y - touchState.lastY; touchState.deltaX = 0;
onTouchSlide(touchState.x, touchState.y, touchState.startX, touchState.startY, x, y); touchState.deltaY = 0;
touchState.lastX = touchState.x;
touchState.lastY = touchState.y;
} }
#endif #endif