From 548c41d16415cda72d85a1ca5872f6cbef91072b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Wed, 25 Apr 2018 23:56:29 +0200 Subject: [PATCH] switcherPopup: Swap Math.max and Math.min in _scrollToLeft Limit the minimum and maximum value to scroll to inside the box to 0 and the upper limit, for some reason this was done right in _scrollToRight, but not in _scrollToLeft. This fixes the behavior of scrolling to the left: Before, scrolling one item to the left moved the view to the first element of the list (this can make the selected element invisible in large lists). Instead, scroll one item to the left, just like scrolling to the right works. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167 --- js/ui/switcherPopup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index 16aa24c64..2f88ce5fe 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -480,9 +480,9 @@ var SwitcherList = GObject.registerClass({ let item = this._items[index]; if (item.allocation.x1 < value) - value = Math.min(0, item.allocation.x1); + value = Math.max(0, item.allocation.x1); else if (item.allocation.x2 > value + pageSize) - value = Math.max(upper, item.allocation.x2 - pageSize); + value = Math.min(upper, item.allocation.x2 - pageSize); this._scrollableRight = true; adjustment.ease(value, {