messageList: Use duration 0 when not animating

Instead of using a special branch for the not animate case, just use
the same path with duration 0.

Since commit ee09c5c85312f571e14abe69bb6674a361c16d65 we are sure that
duration 0 is always preserved.

In the not animate case, we now call this._actionBin.hide(). This was not
happening before.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2987>
This commit is contained in:
Alessandro Bono 2023-01-15 13:12:18 +01:00 committed by Marge Bot
parent 7d835bf455
commit be49c8efc2

View File

@ -481,47 +481,38 @@ export const Message = GObject.registerClass({
this.setExpandedBody(this._expandedLabel);
}
if (animate) {
const duration = animate ? MessageTray.ANIMATION_TIME : 0;
this._bodyStack.ease_property('@layout.expansion', 1, {
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: MessageTray.ANIMATION_TIME,
duration,
});
this._actionBin.scale_y = 0;
this._actionBin.ease({
scale_y: 1,
duration: MessageTray.ANIMATION_TIME,
duration,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
} else {
this._bodyStack.layout_manager.expansion = 1;
this._actionBin.scale_y = 1;
}
this.emit('expanded');
}
unexpand(animate) {
if (animate) {
const duration = animate ? MessageTray.ANIMATION_TIME : 0;
this._bodyStack.ease_property('@layout.expansion', 0, {
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: MessageTray.ANIMATION_TIME,
duration,
});
this._actionBin.ease({
scale_y: 0,
duration: MessageTray.ANIMATION_TIME,
duration,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._actionBin.hide();
this.expanded = false;
},
});
} else {
this._bodyStack.layout_manager.expansion = 0;
this._actionBin.scale_y = 0;
this.expanded = false;
}
this.emit('unexpanded');
}
@ -643,16 +634,15 @@ export const MessageListSection = GObject.registerClass({
this._list.insert_child_at_index(listItem, index);
if (animate) {
const duration = animate ? MESSAGE_ANIMATION_TIME : 0;
listItem.set({scale_x: 0, scale_y: 0});
listItem.ease({
scale_x: 1,
scale_y: 1,
duration: MESSAGE_ANIMATION_TIME,
duration,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
}
}
moveMessage(message, index, animate) {
if (!this._messages.includes(message))
@ -702,21 +692,17 @@ export const MessageListSection = GObject.registerClass({
this._list;
}
if (animate) {
const duration = animate ? MESSAGE_ANIMATION_TIME : 0;
listItem.ease({
scale_x: 0,
scale_y: 0,
duration: MESSAGE_ANIMATION_TIME,
duration,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
listItem.destroy();
nextMessage?.grab_key_focus();
},
});
} else {
listItem.destroy();
nextMessage?.grab_key_focus();
}
}
clear() {