iconGrid: Restore grid actors when cancelling animations

When cancelling the animations of the icon grid, right now we simply
destroy all the clones without resetting the opacity and making the
actor reactive again. So if the spring animation to show the grid is
cancelled by pressing a key to start a search, the icon clones would be
destroyed, but the icon-opacity would still be set to 0. Now if the
Escape key is pressed, viewSelector will show the last active page (ie.
the iconGrid) without a custom animation and only fade in the page, and
because the icons still have an opacity of 0, they will be invisible.

Fix this by always restoring the opacity and reactive property of the
original actors if the animation is cancelled instead of only destroying
the clones.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/678
This commit is contained in:
Jonas Dreßler 2019-08-09 00:15:48 +02:00 committed by Florian Müllner
parent dc38e48202
commit b499ca47a3

View File

@ -226,7 +226,7 @@ var IconGrid = GObject.registerClass({
// swarming into the void ...
this.connect('notify::mapped', () => {
if (!this.mapped)
this._cancelAnimation();
this._resetAnimationActors();
});
this.connect('actor-added', this._childAdded.bind(this));
@ -417,18 +417,17 @@ var IconGrid = GObject.registerClass({
return this._getVisibleChildren();
}
_cancelAnimation() {
this._clonesAnimating.forEach(clone => clone.destroy());
this._clonesAnimating = [];
}
_animationDone() {
_resetAnimationActors() {
this._clonesAnimating.forEach(clone => {
clone.source.reactive = true;
clone.source.opacity = 255;
clone.destroy();
});
this._clonesAnimating = [];
}
_animationDone() {
this._resetAnimationActors();
this.emit('animation-done');
}
@ -437,7 +436,7 @@ var IconGrid = GObject.registerClass({
throw new GObject.NotImplementedError("Pulse animation only implements " +
"'in' animation direction");
this._cancelAnimation();
this._resetAnimationActors();
let actors = this._getChildrenToAnimate();
if (actors.length == 0) {
@ -485,7 +484,7 @@ var IconGrid = GObject.registerClass({
}
animateSpring(animationDirection, sourceActor) {
this._cancelAnimation();
this._resetAnimationActors();
let actors = this._getChildrenToAnimate();
if (actors.length == 0) {