appDisplay/baseAppView: Cleanup animate()
Simplify the opacity dance to simply setting it to the initial value before animating (0 when animating in, and 255 when animating out), and to the final value after the spring animation is done (vice-versa). Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>
This commit is contained in:
parent
b730875012
commit
cd82691859
@ -670,7 +670,6 @@ var BaseAppView = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_doSpringAnimation(animationDirection) {
|
_doSpringAnimation(animationDirection) {
|
||||||
this._grid.opacity = 255;
|
|
||||||
this._grid.animateSpring(
|
this._grid.animateSpring(
|
||||||
animationDirection,
|
animationDirection,
|
||||||
Main.overview.dash.showAppsButton);
|
Main.overview.dash.showAppsButton);
|
||||||
@ -688,15 +687,16 @@ var BaseAppView = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
animate(animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
if (onComplete) {
|
const animationDoneId = this._grid.connect('animation-done', () => {
|
||||||
let animationDoneId = this._grid.connect('animation-done', () => {
|
|
||||||
this._grid.disconnect(animationDoneId);
|
this._grid.disconnect(animationDoneId);
|
||||||
|
this._grid.opacity =
|
||||||
|
animationDirection === IconGrid.AnimationDirection.IN
|
||||||
|
? 255 : 0;
|
||||||
|
if (onComplete)
|
||||||
onComplete();
|
onComplete();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
this._clearAnimateLater();
|
this._clearAnimateLater();
|
||||||
this._grid.opacity = 255;
|
|
||||||
|
|
||||||
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
||||||
const doSpringAnimationLater = laterType => {
|
const doSpringAnimationLater = laterType => {
|
||||||
@ -708,18 +708,18 @@ var BaseAppView = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this._viewIsReady) {
|
|
||||||
this._grid.opacity = 0;
|
this._grid.opacity = 0;
|
||||||
|
if (this._viewIsReady) {
|
||||||
doSpringAnimationLater(Meta.LaterType.IDLE);
|
doSpringAnimationLater(Meta.LaterType.IDLE);
|
||||||
} else {
|
} else {
|
||||||
this._viewLoadedHandlerId = this.connect('view-loaded',
|
this._viewLoadedHandlerId = this.connect('view-loaded',
|
||||||
() => {
|
() => {
|
||||||
this._clearAnimateLater();
|
this._clearAnimateLater();
|
||||||
this._grid.opacity = 255;
|
|
||||||
doSpringAnimationLater(Meta.LaterType.BEFORE_REDRAW);
|
doSpringAnimationLater(Meta.LaterType.BEFORE_REDRAW);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this._grid.opacity = 255;
|
||||||
this._doSpringAnimation(animationDirection);
|
this._doSpringAnimation(animationDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user