[gnome-shell] Lightbox: have animation times passed as parameters to show() and hide()
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Lightbox: have animation times passed as parameters to show() and hide()
- Date: Tue, 20 Aug 2013 19:53:24 +0000 (UTC)
commit 6b8339e9b4135a590796c56d259b322eb1c06f33
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun May 12 17:39:44 2013 +0200
Lightbox: have animation times passed as parameters to show() and hide()
This way it is possible to use the same lightbox with different
times.
https://bugzilla.gnome.org/show_bug.cgi?id=699112
js/ui/lightbox.js | 22 +++++++++++-----------
js/ui/messageTray.js | 6 ++----
2 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js
index cf80bd3..48a3c8e 100644
--- a/js/ui/lightbox.js
+++ b/js/ui/lightbox.js
@@ -42,15 +42,11 @@ const Lightbox = new Lang.Class({
params = Params.parse(params, { inhibitEvents: false,
width: null,
height: null,
- fadeInTime: null,
- fadeOutTime: null,
- fadeFactor: DEFAULT_FADE_FACTOR
+ fadeFactor: DEFAULT_FADE_FACTOR,
});
this._container = container;
this._children = container.get_children();
- this._fadeInTime = params.fadeInTime;
- this._fadeOutTime = params.fadeOutTime;
this._fadeFactor = params.fadeFactor;
this.actor = new St.Bin({ x: 0,
y: 0,
@@ -101,14 +97,16 @@ const Lightbox = new Lang.Class({
}
},
- show: function() {
+ show: function(fadeInTime) {
+ fadeInTime = fadeInTime || 0;
+
Tweener.removeTweens(this.actor);
- if (this._fadeInTime) {
+ if (fadeInTime != 0) {
this.shown = false;
this.actor.opacity = 0;
Tweener.addTween(this.actor,
{ opacity: 255 * this._fadeFactor,
- time: this._fadeInTime,
+ time: fadeInTime,
transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() {
this.shown = true;
@@ -123,13 +121,15 @@ const Lightbox = new Lang.Class({
this.actor.show();
},
- hide: function() {
+ hide: function(fadeOutTime) {
+ fadeOutTime = fadeOutTime || 0;
+
this.shown = false;
Tweener.removeTweens(this.actor);
- if (this._fadeOutTime) {
+ if (fadeOutTime != 0) {
Tweener.addTween(this.actor,
{ opacity: 0,
- time: this._fadeOutTime,
+ time: fadeOutTime,
transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() {
this.actor.hide();
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index ce9802e..0ba3e62 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1730,8 +1730,6 @@ const MessageTray = new Lang.Class({
for (let i = 0; i < lightboxContainers.length; i++)
this._lightboxes.push(new Lightbox.Lightbox(lightboxContainers[i],
{ inhibitEvents: true,
- fadeInTime: ANIMATION_TIME,
- fadeOutTime: ANIMATION_TIME,
fadeFactor: 0.2
}));
@@ -2339,7 +2337,7 @@ const MessageTray = new Lang.Class({
});
for (let i = 0; i < this._lightboxes.length; i++)
- this._lightboxes[i].show();
+ this._lightboxes[i].show(ANIMATION_TIME);
return true;
},
@@ -2395,7 +2393,7 @@ const MessageTray = new Lang.Class({
// This is a no-op in that case.
this._grabHelper.ungrab({ actor: this.actor });
for (let i = 0; i < this._lightboxes.length; i++)
- this._lightboxes[i].hide();
+ this._lightboxes[i].hide(ANIMATION_TIME);
},
_hideDesktopClone: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]