switcherPopup: Use local variable for index in scrolling functions
Make sure the index that's being scrolled to doesn't change while the scrolling animation is running by using an argument instead of the this._highlighed class scope variable. This fixes wrongly shown arrows when selecting new elements faster than the scrolling animation takes for one index. The check run to disable the arrow might be checking against a newer index than the one at the start of the animation which results in the arrow not getting hidden even if no more scrolling is possible. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167
This commit is contained in:
parent
5c8f3a65f7
commit
172d21cf50
@ -467,17 +467,17 @@ var SwitcherList = GObject.registerClass({
|
||||
let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
|
||||
let [containerWidth] = this.get_transformed_size();
|
||||
if (posX + this._items[index].get_width() > containerWidth)
|
||||
this._scrollToRight();
|
||||
this._scrollToRight(index);
|
||||
else if (this._items[index].allocation.x1 - value < 0)
|
||||
this._scrollToLeft();
|
||||
this._scrollToLeft(index);
|
||||
|
||||
}
|
||||
|
||||
_scrollToLeft() {
|
||||
_scrollToLeft(index) {
|
||||
let adjustment = this._scrollView.hscroll.adjustment;
|
||||
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
||||
|
||||
let item = this._items[this._highlighted];
|
||||
let item = this._items[index];
|
||||
|
||||
if (item.allocation.x1 < value)
|
||||
value = Math.min(0, item.allocation.x1);
|
||||
@ -489,18 +489,18 @@ var SwitcherList = GObject.registerClass({
|
||||
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: POPUP_SCROLL_TIME,
|
||||
onComplete: () => {
|
||||
if (this._highlighted == 0)
|
||||
if (index === 0)
|
||||
this._scrollableLeft = false;
|
||||
this.queue_relayout();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
_scrollToRight() {
|
||||
_scrollToRight(index) {
|
||||
let adjustment = this._scrollView.hscroll.adjustment;
|
||||
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
||||
|
||||
let item = this._items[this._highlighted];
|
||||
let item = this._items[index];
|
||||
|
||||
if (item.allocation.x1 < value)
|
||||
value = Math.max(0, item.allocation.x1);
|
||||
@ -512,7 +512,7 @@ var SwitcherList = GObject.registerClass({
|
||||
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: POPUP_SCROLL_TIME,
|
||||
onComplete: () => {
|
||||
if (this._highlighted == this._items.length - 1)
|
||||
if (index === this._items.length - 1)
|
||||
this._scrollableRight = false;
|
||||
this.queue_relayout();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user