Skip to content

Commit 8f330e4

Browse files
committed
Fix mouse index page bug
1 parent 2de4173 commit 8f330e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
}
187187

188188
cell_width = WIDTH // config["width"]
189+
page_size = config["width"] * config["height"]
189190

190191
default_icon_bmp, default_icon_palette = adafruit_imageload.load("launcher_assets/default_icon.bmp")
191192
default_icon_palette.make_transparent(0)
@@ -562,7 +563,7 @@ def handle_key_press(key):
562563
print("left click")
563564
clicked_cell = menu_grid.which_cell_contains((mouse_tg.x, mouse_tg.y))
564565
if clicked_cell is not None:
565-
index = clicked_cell[1] * config["width"] + clicked_cell[0]
566+
index = (clicked_cell[1] * config["width"] + clicked_cell[0]) + (cur_page * page_size)
566567

567568
if right_tg.contains((mouse_tg.x, mouse_tg.y, 0)):
568569
page_right()

0 commit comments

Comments
 (0)