[gnome-shell/wip/swarm: 2/7] viewSelector: Allow different animation types
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/swarm: 2/7] viewSelector: Allow different animation types
- Date: Fri, 22 Aug 2014 14:24:39 +0000 (UTC)
commit 2dc5e4c3563f1ba9735dcffa5c5035a08bd1d16e
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Tue Jun 17 19:10:54 2014 +0200
viewSelector: Allow different animation types
Make viewSelector able to manage different kind of animations for pages.
This is necessary for the upcoming patch to animate AllView and
FrequentView.
https://bugzilla.gnome.org/show_bug.cgi?id=734726
js/ui/viewSelector.js | 57 +++++++++++++++++++++++++++++++-----------------
1 files changed, 37 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 80c3035..e0de436 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -371,18 +371,37 @@ 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, 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) {
@@ -396,18 +415,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)
- 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();
+ animateActivePage();
},
_a11yFocusPage: function(page) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]