Skip to content

Commit

Permalink
Update launcher.py for infinite scrolling (#23)
Browse files Browse the repository at this point in the history
Change the logic, so that you start again on the top page if you scroll further down on the last page.
  • Loading branch information
jsh97 authored Mar 12, 2024
1 parent 06ca4c0 commit e40a941
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions badger_os/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ def button(pin):
if pin == badger2040.BUTTON_C:
launch_example(2)
if pin == badger2040.BUTTON_UP:
if state["page"] > 0:
state["page"] -= 1
state["page"] = (state["page"] - 1) % MAX_PAGE
render()
if pin == badger2040.BUTTON_DOWN:
if state["page"] < MAX_PAGE - 1:
state["page"] += 1
state["page"] = (state["page"] + 1) % MAX_PAGE
render()


Expand Down

0 comments on commit e40a941

Please sign in to comment.