popupMenu: 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. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2987>
This commit is contained in:
parent
1571171a21
commit
46219b1101
@ -1076,23 +1076,20 @@ export class PopupSubMenu extends PopupMenuBase {
|
|||||||
|
|
||||||
let targetAngle = this.actor.text_direction === Clutter.TextDirection.RTL ? -90 : 90;
|
let targetAngle = this.actor.text_direction === Clutter.TextDirection.RTL ? -90 : 90;
|
||||||
|
|
||||||
if (animate) {
|
const duration = animate ? 250 : 0;
|
||||||
let [, naturalHeight] = this.actor.get_preferred_height(-1);
|
let [, naturalHeight] = this.actor.get_preferred_height(-1);
|
||||||
this.actor.height = 0;
|
this.actor.height = 0;
|
||||||
this.actor.ease({
|
this.actor.ease({
|
||||||
height: naturalHeight,
|
height: naturalHeight,
|
||||||
duration: 250,
|
duration,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
||||||
onComplete: () => this.actor.set_height(-1),
|
onComplete: () => this.actor.set_height(-1),
|
||||||
});
|
});
|
||||||
this._arrow.ease({
|
this._arrow.ease({
|
||||||
rotation_angle_z: targetAngle,
|
rotation_angle_z: targetAngle,
|
||||||
duration: 250,
|
duration,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this._arrow.rotation_angle_z = targetAngle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(animate) {
|
close(animate) {
|
||||||
@ -1108,25 +1105,21 @@ export class PopupSubMenu extends PopupMenuBase {
|
|||||||
if (animate && this._needsScrollbar())
|
if (animate && this._needsScrollbar())
|
||||||
animate = false;
|
animate = false;
|
||||||
|
|
||||||
if (animate) {
|
const duration = animate ? 250 : 0;
|
||||||
this.actor.ease({
|
this.actor.ease({
|
||||||
height: 0,
|
height: 0,
|
||||||
duration: 250,
|
duration,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
this.actor.set_height(-1);
|
this.actor.set_height(-1);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this._arrow.ease({
|
this._arrow.ease({
|
||||||
rotation_angle_z: 0,
|
rotation_angle_z: 0,
|
||||||
duration: 250,
|
duration,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this._arrow.rotation_angle_z = 0;
|
|
||||||
this.actor.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onKeyPressEvent(actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user