Fix glitch when scrolling the listing with mouse.

- Stopped the scroll position going negative.
This commit is contained in:
Andrew Hamilton 2021-06-10 01:55:42 +10:00
parent 1d3e44f7ad
commit 8a8f139084

View file

@ -762,17 +762,16 @@ class Screen:
dx, dy = vector dx, dy = vector
selected_widget = self._summary.get_selection() selected_widget = self._summary.get_selection()
x, y = selected_widget.scroll_position x, y = selected_widget.scroll_position
if dy < 0 or dx < 0: # up or left widget_width, widget_height = fill3.appearance_dimensions(
x, y = max(x + dx, 0), max(y + dy, 0) selected_widget.result.appearance_min())
else: # down or right listing_width, listing_height = (self._listing.widget.
widget_width, widget_height = fill3.appearance_dimensions( last_dimensions)
selected_widget.result.appearance_min()) listing_width -= 1 # scrollbars
listing_width, listing_height = (self._listing.widget. listing_height -= 1
last_dimensions) x = min(x + dx, max(widget_width - listing_width, 0))
listing_width -= 1 # scrollbars y = min(y + dy, max(widget_height - listing_height, 0))
listing_height -= 1 x = max(0, x)
x = min(x + dx, max(widget_width - listing_width, 0)) y = max(0, y)
y = min(y + dy, max(widget_height - listing_height, 0))
selected_widget.scroll_position = x, y selected_widget.scroll_position = x, y
def cursor_up(self): def cursor_up(self):