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
selected_widget = self._summary.get_selection()
x, y = selected_widget.scroll_position
if dy < 0 or dx < 0: # up or left
x, y = max(x + dx, 0), max(y + dy, 0)
else: # down or right
widget_width, widget_height = fill3.appearance_dimensions(
selected_widget.result.appearance_min())
listing_width, listing_height = (self._listing.widget.
last_dimensions)
listing_width -= 1 # scrollbars
listing_height -= 1
x = min(x + dx, max(widget_width - listing_width, 0))
y = min(y + dy, max(widget_height - listing_height, 0))
widget_width, widget_height = fill3.appearance_dimensions(
selected_widget.result.appearance_min())
listing_width, listing_height = (self._listing.widget.
last_dimensions)
listing_width -= 1 # scrollbars
listing_height -= 1
x = min(x + dx, max(widget_width - listing_width, 0))
y = min(y + dy, max(widget_height - listing_height, 0))
x = max(0, x)
y = max(0, y)
selected_widget.scroll_position = x, y
def cursor_up(self):