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/834
This commit is contained in:
parent
96ac00b53c
commit
e257be64d0
@ -140,12 +140,15 @@ var Spinner = class extends AnimatedIcon {
|
||||
|
||||
params = Params.parse(params, {
|
||||
animate: false,
|
||||
hideOnStop: false,
|
||||
});
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
||||
super(file, size);
|
||||
|
||||
this.actor.opacity = 0;
|
||||
this._animate = params.animate;
|
||||
this._hideOnStop = params.hideOnStop;
|
||||
this.actor.visible = !this._hideOnStop;
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
@ -155,6 +158,7 @@ var Spinner = class extends AnimatedIcon {
|
||||
|
||||
play() {
|
||||
this.actor.remove_all_transitions();
|
||||
this.actor.show();
|
||||
|
||||
if (this._animate) {
|
||||
super.play();
|
||||
@ -178,11 +182,18 @@ var Spinner = class extends AnimatedIcon {
|
||||
opacity: 0,
|
||||
duration: SPINNER_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.LINEAR,
|
||||
onComplete: () => super.stop()
|
||||
onComplete: () => {
|
||||
super.stop();
|
||||
if (this._hideOnStop)
|
||||
this.actor.hide();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.actor.opacity = 0;
|
||||
super.stop();
|
||||
|
||||
if (this._hideOnStop)
|
||||
this.actor.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user