Add support for gestures and integrate it with the vertical scrolling transition.

This commit is contained in:
JF
2020-03-09 21:29:12 +01:00
parent 968f18f472
commit 35e221078b
5 changed files with 184 additions and 100 deletions

View File

@@ -14,6 +14,7 @@ namespace Pinetime {
namespace Components {
class LittleVgl {
public:
enum class FullRefreshDirections { None, Up, Down };
LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel);
LittleVgl(const LittleVgl&) = delete;
@@ -23,7 +24,9 @@ namespace Pinetime {
void FlushDisplay(const lv_area_t * area, lv_color_t * color_p);
bool GetTouchPadInfo(lv_indev_data_t *ptr);
void SetFullRefresh();
void SetFullRefresh(FullRefreshDirections direction);
void SetNewTapEvent(uint16_t x, uint16_t y);
private:
void InitDisplay();
void InitTouchpad();
@@ -99,15 +102,17 @@ namespace Pinetime {
lv_style_t win_btn_pr;
bool firstTouch = true;
bool fullRefresh = false;
static constexpr uint8_t nbWriteLines = 4;
static constexpr uint16_t totalNbLines = 320;
static constexpr uint16_t visibleNbLines = 240;
static constexpr uint8_t MaxScrollOffset() { return LV_VER_RES_MAX - nbWriteLines; }
enum class ScrollDirections {Unknown, Up, Down};
ScrollDirections scrollDirection = ScrollDirections::Up;
FullRefreshDirections scrollDirection = FullRefreshDirections::None;
uint16_t writeOffset = 0;
uint16_t scrollOffset = 0;
uint16_t tap_x = 0;
uint16_t tap_y = 0;
bool tapped = false;
};
}
}