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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user