[gnome-shell/wip/swarm: 1/11] viewSelector: Allow different animation types
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/swarm: 1/11] viewSelector: Allow different animation types
- Date: Wed, 25 Jun 2014 17:45:14 +0000 (UTC)
commit 1bc57f0e5ba40f8b944bbdf86e8f607f31066b19
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Tue Jun 17 19:10:54 2014 +0200
viewSelector: Allow different animation types
js/ui/viewSelector.js | 61 +++++++++++++++++++++++++++++++++----------------
1 files changed, 41 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 5a0ed09..13407a5 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -206,18 +206,41 @@ const ViewSelector = new Lang.Class({
return page;
},
- _fadePageIn: function(oldPage) {
- if (oldPage)
- oldPage.hide();
+ _fadePageIn: function(page) {
+ Tweener.addTween(page,
+ { opacity: 255,
+ time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
+ transition: 'easeOutQuad'
+ });
+ },
- this.emit('page-empty');
+ _fadePageOut: function(page, onComplete) {
+ Tweener.addTween(page,
+ { opacity: 0,
+ time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: Lang.bind(this,
+ function() {
+ if (onComplete)
+ onComplete();
+ })
+ });
+ },
- this._activePage.show();
- Tweener.addTween(this._activePage,
- { opacity: 255,
- time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
- transition: 'easeOutQuad'
- });
+ _animateIn: function(page) {
+ page.show();
+
+ this._fadePageIn(page);
+ },
+
+ _animateOut: function(page, onComplete) {
+ this._fadePageOut(page, onComplete);
+ },
+
+ _hidePageAndSyncEmpty: function(page) {
+ if (page)
+ page.hide();
+ this.emit('page-empty');
},
_showPage: function(page, animateOut) {
@@ -228,18 +251,16 @@ const ViewSelector = new Lang.Class({
this._activePage = page;
this.emit('page-changed');
+ let animateActivePage = Lang.bind(this,
+ function() {
+ this._hidePageAndSyncEmpty(oldPage);
+ this._animateIn(this._activePage);
+ });
+
if (oldPage && animateOut)
- Tweener.addTween(oldPage,
- { opacity: 0,
- time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
- transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this._fadePageIn(oldPage);
- })
- });
+ this._animateOut(oldPage, animateActivePage)
else
- this._fadePageIn(oldPage);
+ animateActivePage();
},
_a11yFocusPage: function(page) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]