From e8623f6189d71ad03a0ea9ba8f3d904df69cf6d0 Mon Sep 17 00:00:00 2001 From: hi80482 <66435094+hi80482@users.noreply.github.com> Date: Wed, 29 Jul 2020 23:32:08 +0800 Subject: [PATCH] add loop scroll --- sys.py/UI/Emulator/rom_list_page.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sys.py/UI/Emulator/rom_list_page.py b/sys.py/UI/Emulator/rom_list_page.py index 5d9b75f..bd2c5ac 100644 --- a/sys.py/UI/Emulator/rom_list_page.py +++ b/sys.py/UI/Emulator/rom_list_page.py @@ -318,13 +318,12 @@ class RomListPage(Page): # loop scroll, to end if self._PsIndex == len(self._MyList) - 1: # check items per page - if len(self._MyList) < self._ItemsPerPage: - self._ItemsPerPage = len(self._MyList) - self._ItemsPerPage -= 1 # not include current item - for i in range(0, len(self._MyList)): - self._MyList[i]._PosY -= self._MyList[i]._Height * (dy - self._ItemsPerPage) + if len(self._MyList) > self._ItemsPerPage: + self._ItemsPerPage -= 1 # not include current item + for i in range(0, len(self._MyList)): + self._MyList[i]._PosY -= self._MyList[i]._Height * (dy - self._ItemsPerPage) self._Scrolled -= dy - self._ItemsPerPage = 6 # reset to 6 + self._ItemsPerPage = 6 # reset to 6 def ScrollDown(self): # if len(self._MyList) == 0: @@ -349,13 +348,12 @@ class RomListPage(Page): # loop scroll, to first if self._PsIndex == 0: # check items per page - if len(self._MyList) < self._ItemsPerPage: - self._ItemsPerPage = len(self._MyList) - self._ItemsPerPage -= 1 # not include current item - for i in range(0, len(self._MyList)): - self._MyList[i]._PosY += self._MyList[i]._Height * (dy - self._ItemsPerPage) + if len(self._MyList) > self._ItemsPerPage: + self._ItemsPerPage -= 1 # not include current item + for i in range(0, len(self._MyList)): + self._MyList[i]._PosY += self._MyList[i]._Height * (dy - self._ItemsPerPage) self._Scrolled += dy - self._ItemsPerPage = 6 # reset to 6 + self._ItemsPerPage = 6 # reset to 6 def SyncScroll(self): ##