Merge pull request #2833 from myk002/myk_list_recenter

ensure scrollable lists are centered in the visible viewport
develop
Myk 2023-02-06 12:57:43 -08:00 committed by GitHub
commit c0358d642d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
- ``Units::isFortControlled``: Account for agitated wildlife - ``Units::isFortControlled``: Account for agitated wildlife
- Fix right click sometimes closing both a DFHack window and a vanilla panel - Fix right click sometimes closing both a DFHack window and a vanilla panel
- Fixed issue with scrollable lists having some data off-screen if they were scrolled before being made visible
## Misc Improvements ## Misc Improvements
- `automelt`: is now more resistent to savegame corruption - `automelt`: is now more resistent to savegame corruption

@ -1638,6 +1638,7 @@ end
function List:postComputeFrame(body) function List:postComputeFrame(body)
self.page_size = math.max(1, math.floor(body.height / self.row_height)) self.page_size = math.max(1, math.floor(body.height / self.row_height))
self.page_top = math.max(1, math.min(#self.choices - self.page_size + 1))
update_list_scrollbar(self) update_list_scrollbar(self)
end end