Add TouchModes : in Gestures mode, only 1 event is processed for each touchevent. This allows to recognize gesture and handle them in Screens or in DisplayApp.

In Polling mode, X/Y positions are sent continuously to lvgl, allowing to scroll inside a dropdown menu for example.
This commit is contained in:
JF
2020-08-20 21:09:45 +02:00
parent e6a1aff6ce
commit 7d3af600bd
5 changed files with 113 additions and 1 deletions
+12 -1
View File
@@ -171,6 +171,12 @@ void DisplayApp::Refresh() {
break;
}
}
if(touchMode == TouchModes::Polling) {
auto info = touchPanel.GetTouchInfo();
if(info.action == 2) // 2 = contact
lvgl.SetNewTapEvent(info.x, info.y);
}
}
void DisplayApp::RunningState() {
@@ -219,7 +225,8 @@ TouchEvents DisplayApp::OnTouchEvent() {
if(info.isTouch) {
switch(info.gesture) {
case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
lvgl.SetNewTapEvent(info.x, info.y);
if(touchMode == TouchModes::Gestures)
lvgl.SetNewTapEvent(info.x, info.y);
return TouchEvents::Tap;
case Pinetime::Drivers::Cst816S::Gestures::LongPress:
return TouchEvents::LongTap;
@@ -257,3 +264,7 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
}
}
void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) {
touchMode = mode;
}