[gnome-shell/wip/fmuellner/ease-actors: 12/20] dash: Directly tween actors
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/ease-actors: 12/20] dash: Directly tween actors
- Date: Tue, 6 Aug 2019 13:08:44 +0000 (UTC)
commit e09316bea36ab46cbd8a4bf77f5f5bc193c64fff
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Jul 21 07:08:33 2018 +0200
dash: Directly tween actors
Dash items are currently animated via the custom "childScale" and
"childOpacity" properties. However since commit efb3025d8cdb, those
properties actually control the scale-x/scale-y and opacity properties
of the actor itself (not the child), so cut out the intermediate
custom properties in favor of the "real" ones.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
js/ui/dash.js | 50 ++++++++++++++------------------------------------
1 file changed, 14 insertions(+), 36 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index d3206aa4f..75749d48f 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -32,6 +32,9 @@ class DashItemContainer extends St.Widget {
_init() {
super._init({ style_class: 'dash-item-container',
pivot_point: new Clutter.Point({ x: .5, y: .5 }),
+ scale_x: 0,
+ scale_y: 0,
+ opacity: 0,
x_expand: true,
x_align: Clutter.ActorAlign.CENTER });
@@ -42,10 +45,11 @@ class DashItemContainer extends St.Widget {
this.label_actor = this.label;
this.child = null;
- this._childScale = 0;
- this._childOpacity = 0;
this.animatingOut = false;
+ this.connect('notify::scale-x', () => this.queue_relayout());
+ this.connect('notify::scale-y', () => this.queue_relayout());
+
this.connect('destroy', () => {
if (this.child != null)
this.child.destroy();
@@ -127,9 +131,6 @@ class DashItemContainer extends St.Widget {
this.child = actor;
this.add_actor(this.child);
-
- this.set_scale(this._childScale, this._childScale);
- this.set_opacity(this._childOpacity);
}
show(animate) {
@@ -138,8 +139,9 @@ class DashItemContainer extends St.Widget {
let time = animate ? DASH_ANIMATION_TIME : 0;
Tweener.addTween(this,
- { childScale: 1.0,
- childOpacity: 255,
+ { scale_x: 1.0,
+ scale_y: 1.0,
+ opacity: 255,
time: time / 1000,
transition: 'easeOutQuad'
});
@@ -155,37 +157,14 @@ class DashItemContainer extends St.Widget {
this.animatingOut = true;
Tweener.addTween(this,
- { childScale: 0.0,
- childOpacity: 0,
+ { scale_x: 0,
+ scale_y: 0,
+ opacity: 0,
time: DASH_ANIMATION_TIME / 1000,
transition: 'easeOutQuad',
- onComplete: () => {
- this.destroy();
- }
+ onComplete: () => this.destroy()
});
}
-
- set childScale(scale) {
- this._childScale = scale;
-
- this.set_scale(scale, scale);
- this.queue_relayout();
- }
-
- get childScale() {
- return this._childScale;
- }
-
- set childOpacity(opacity) {
- this._childOpacity = opacity;
-
- this.set_opacity(opacity);
- this.queue_redraw();
- }
-
- get childOpacity() {
- return this._childOpacity;
- }
});
var ShowAppsIcon = GObject.registerClass(
@@ -352,8 +331,7 @@ var Dash = class Dash {
this._container.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
this._showAppsIcon = new ShowAppsIcon();
- this._showAppsIcon.childScale = 1;
- this._showAppsIcon.childOpacity = 255;
+ this._showAppsIcon.show(false);
this._showAppsIcon.icon.setIconSize(this.iconSize);
this._hookUpLabel(this._showAppsIcon);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]