fix: don't cause a fling in update_dimensions() (#778)

Opening a large menu with a selected item would not scroll
all the way to that selected item if there was a menu update during the
initial fling.
This commit is contained in:
christoph-heinrich
2023-11-09 09:30:30 +01:00
committed by GitHub
parent 0531659397
commit 8df5ea6efd

View File

@@ -338,8 +338,7 @@ function Menu:update_dimensions()
menu.search.max_width = math.max(menu.search.max_width, menu.width)
end
menu.scroll_height = math.max(content_height - menu.height - self.item_spacing, 0)
menu.scroll_y = menu.scroll_y or 0
self:scroll_to(menu.scroll_y, menu) -- clamps scroll_y to scroll limits
self:set_scroll_to(menu.scroll_y, menu) -- clamps scroll_y to scroll limits
end
self:update_coordinates()