[gnome-shell/wip/re-search: 133/151] dash: Add show/hide methods
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search: 133/151] dash: Add show/hide methods
- Date: Thu, 1 Nov 2012 16:59:43 +0000 (UTC)
commit afe8198d4b6d821bac29e21e1449db620a375e7d
Author: Tanner Doshier <doshitan gmail com>
Date: Thu Aug 16 19:59:07 2012 -0500
dash: Add show/hide methods
https://bugzilla.gnome.org/show_bug.cgi?id=682050
js/ui/dash.js | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index ee9c4a9..ada3460 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -372,6 +372,9 @@ const Dash = new Lang.Class({
this._maxHeight = -1;
this.iconSize = 64;
this._shownInitially = false;
+ this.visible = false;
+ this._hiddenX;
+ this._targetX;
this._dragPlaceholder = null;
this._dragPlaceholderPos = -1;
@@ -546,6 +549,17 @@ const Dash = new Lang.Class({
}
},
+ _computeDashX: function() {
+ this._targetX = this.actor.get_x();
+
+ let rtl = (this.actor.get_text_direction() == Clutter.TextDirection.RTL);
+
+ if (rtl)
+ this._hiddenX = this._targetX + this.actor.width;
+ else
+ this._hiddenX = -this.actor.width;
+ },
+
_adjustIconSize: function() {
// For the icon size, we only consider children which are "proper"
// icons (i.e. ignoring drag placeholders) and which are not
@@ -641,6 +655,8 @@ const Dash = new Lang.Class({
}
});
}
+
+ this._computeDashX();
},
_redisplay: function () {
@@ -757,6 +773,7 @@ const Dash = new Lang.Class({
// of items, to avoid all items zooming in at once
if (!this._shownInitially) {
this._shownInitially = true;
+ this.visible = true;
return;
}
@@ -901,6 +918,34 @@ const Dash = new Lang.Class({
}));
return true;
+ },
+
+ show: function() {
+ if (this.visible)
+ return;
+
+ this.visible = true;
+
+ this.actor.show();
+ Tweener.addTween(this.actor, { translation_x: this._targetX,
+ transition: 'easeOutQuad',
+ time: DASH_ANIMATION_TIME
+ });
+ },
+
+ hide: function() {
+ if (!this.visible)
+ return;
+
+ this.visible = false;
+
+ Tweener.addTween(this.actor, { translation_x: this._hiddenX,
+ transition: 'easeOutQuad',
+ time: DASH_ANIMATION_TIME,
+ onComplete: Lang.bind(this, function () {
+ this.actor.hide();
+ })
+ });
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]