animation: Add parameter for hiding stopped Spinner actor
Not hiding leaves the empty actor space visible, which may have an undesirable effect on the parent element's size or spacing/padding. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/832
This commit is contained in:
parent
6af25b282c
commit
8f4e91a738
@ -141,12 +141,15 @@ class Spinner extends AnimatedIcon {
|
|||||||
_init(size, params) {
|
_init(size, params) {
|
||||||
params = Params.parse(params, {
|
params = Params.parse(params, {
|
||||||
animate: false,
|
animate: false,
|
||||||
|
hideOnStop: false,
|
||||||
});
|
});
|
||||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
||||||
super._init(file, size);
|
super._init(file, size);
|
||||||
|
|
||||||
this.opacity = 0;
|
this.opacity = 0;
|
||||||
this._animate = params.animate;
|
this._animate = params.animate;
|
||||||
|
this._hideOnStop = params.hideOnStop;
|
||||||
|
this.visible = !this._hideOnStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
@ -156,6 +159,7 @@ class Spinner extends AnimatedIcon {
|
|||||||
|
|
||||||
play() {
|
play() {
|
||||||
this.remove_all_transitions();
|
this.remove_all_transitions();
|
||||||
|
this.show();
|
||||||
|
|
||||||
if (this._animate) {
|
if (this._animate) {
|
||||||
super.play();
|
super.play();
|
||||||
@ -179,11 +183,18 @@ class Spinner extends AnimatedIcon {
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: SPINNER_ANIMATION_TIME,
|
duration: SPINNER_ANIMATION_TIME,
|
||||||
mode: Clutter.AnimationMode.LINEAR,
|
mode: Clutter.AnimationMode.LINEAR,
|
||||||
onComplete: () => super.stop(),
|
onComplete: () => {
|
||||||
|
super.stop();
|
||||||
|
if (this._hideOnStop)
|
||||||
|
this.hide();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.opacity = 0;
|
this.opacity = 0;
|
||||||
super.stop();
|
super.stop();
|
||||||
|
|
||||||
|
if (this._hideOnStop)
|
||||||
|
this.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user