1
0
Fork 0

apps: software: Fix some scrolling bugs

Currently the number of pages is (acidentally) hardcoded where it need
not be and the scroll directions aren't right as soon as we go beyond
two pages (where scroll up and down are equivalent actions).

Fix both.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
Daniel Thompson 2021-01-10 18:06:18 +00:00
parent 79db167ed9
commit 62288cc81e

View file

@ -47,10 +47,10 @@ class SoftwareApp():
def swipe(self, event):
"""Notify the application of a touchscreen swipe event."""
page = self.page
pages = 1
if event[0] == wasp.EventType.UP:
page = page - 1 if page > 0 else pages
pages = (len(self.db)-1) // 5
if event[0] == wasp.EventType.DOWN:
page = page - 1 if page > 0 else pages
if event[0] == wasp.EventType.UP:
page = page + 1 if page < pages else 0
self.page = page