[gnome-shell/wip/swarm: 49/51] f
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/swarm: 49/51] f
- Date: Mon, 9 Jun 2014 19:31:30 +0000 (UTC)
commit cc0866525735556dc8ba134d665607678f849adb
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Fri May 23 21:46:40 2014 +0200
f
js/ui/appDisplay.js | 21 ++++++++-----
js/ui/iconGrid.js | 81 ++++++++++++++++++++++-----------------------------
2 files changed, 48 insertions(+), 54 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index dac04b6..ea44724 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -93,7 +93,8 @@ const BaseAppView = new Lang.Class({
minRows: MIN_ROWS,
minColumns: MIN_COLUMNS,
fillParent: false,
- padWithSpacing: true });
+ padWithSpacing: true,
+ animation: IconGrid.ANIMATION_NONE });
params = Params.parse(params, { usePagination: false });
if(params.usePagination)
@@ -273,7 +274,7 @@ const AllView = new Lang.Class({
Extends: BaseAppView,
_init: function() {
- this.parent({ usePagination: true }, null);
+ this.parent({ usePagination: true }, { animation: IconGrid.ANIMATION_SWARM_FAR_FIRST });
this._scrollView = new St.ScrollView({ style_class: 'all-apps',
x_expand: true,
y_expand: true,
@@ -636,7 +637,7 @@ const FrequentView = new Lang.Class({
Extends: BaseAppView,
_init: function() {
- this.parent(null, { fillParent: true });
+ this.parent(null, { fillParent: true, animation: IconGrid.ANIMATION_SWARM_FAR_FIRST });
this.actor = new St.Widget({ style_class: 'frequent-apps',
layout_manager: new Clutter.BinLayout(),
x_expand: true, y_expand: true });
@@ -954,7 +955,7 @@ const FolderView = new Lang.Class({
Extends: BaseAppView,
_init: function() {
- this.parent(null, null);
+ this.parent(null, { animation: IconGrid.ANIMATION_APPEAR });
// If it not expand, the parent doesn't take into account its preferred_width when allocating
// the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
this._grid.actor.x_expand = true;
@@ -973,6 +974,10 @@ const FolderView = new Lang.Class({
_keyFocusIn: function(actor) {
Util.ensureActorVisibleInScrollView(this.actor, actor);
},
+
+ animateItems: function() {
+ this._grid.animate(this._grid._getVisibleItems());
+ },
createFolderIcon: function(size) {
let layout = new Clutter.TableLayout();
@@ -1214,6 +1219,8 @@ const FolderIcon = new Lang.Class({
function(popup, isOpen) {
if (!isOpen)
this.actor.checked = false;
+ else
+ this.view.animateItems();
}));
} else {
this._popup.updateArrowSide(this._boxPointerArrowside);
@@ -1312,8 +1319,7 @@ const AppFolderPopup = new Lang.Class({
this.actor.show();
this._boxPointer.setArrowActor(this._source.actor);
- this._boxPointer.show(BoxPointer.PopupAnimation.FADE |
- BoxPointer.PopupAnimation.SLIDE);
+ this._boxPointer.show(BoxPointer.PopupAnimation.FADE);
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
@@ -1325,8 +1331,7 @@ const AppFolderPopup = new Lang.Class({
if (!this._isOpen)
return;
- this._boxPointer.hide(BoxPointer.PopupAnimation.FADE |
- BoxPointer.PopupAnimation.SLIDE);
+ this._boxPointer.hide(BoxPointer.PopupAnimation.FADE);
this._isOpen = false;
this.emit('open-state-changed', false);
},
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 477892f..d717e0f 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -19,9 +19,12 @@ const EXTRA_SPACE_ANIMATION_TIME = 0.25;
const SWARM_ANIMATION_TIME = 0.5;
const SWARM_ANIMATION_MAX_DELAY_FOR_ITEM = 0.3;
-const SWARM_ANIMATION_FADE_IN_TIME_FOR_ITEM = 0.0;
-const SWARM_TYPE_RANDOM = 0;
-const SWARM_TYPE_FAR_FIRST = 1;
+const SWARM_ANIMATION_FADE_IN_TIME_FOR_ITEM = 0.1;
+
+const ANIMATION_NONE = 0;
+const ANIMATION_APPEAR = 1;
+const ANIMATION_SWARM_RANDOM = 2;
+const ANIMATION_SWARM_FAR_FIRST = 3;
const BaseIcon = new Lang.Class({
Name: 'BaseIcon',
@@ -195,7 +198,8 @@ const IconGrid = new Lang.Class({
minColumns: 1,
fillParent: false,
xAlign: St.Align.MIDDLE,
- padWithSpacing: false });
+ padWithSpacing: false,
+ animation: ANIMATION_NONE });
this._rowLimit = params.rowLimit;
this._colLimit = params.columnLimit;
this._minRows = params.minRows;
@@ -203,6 +207,7 @@ const IconGrid = new Lang.Class({
this._xAlign = params.xAlign;
this._fillParent = params.fillParent;
this._padWithSpacing = params.padWithSpacing;
+ this._animationType = params.animation;
this.topPadding = 0;
this.bottomPadding = 0;
@@ -227,12 +232,11 @@ const IconGrid = new Lang.Class({
this._grid.connect('actor-removed', Lang.bind(this, this._childRemoved));
this._paintedItems = [];
- this._swarmType = SWARM_TYPE_FAR_FIRST;
- this._animating = false;
+ this._animating = false;
this._mappedId = this.actor.connect("notify::allocation", Lang.bind(this,
function() {
if (this.actor.mapped)
- this.swarmAnimation(this._paintedItems);
+ this.animate(this._paintedItems);
}));
},
@@ -370,7 +374,7 @@ const IconGrid = new Lang.Class({
}
},
- swarmAnimation: function(items) {
+ animate: function(items) {
if (this._animating)
return;
@@ -387,17 +391,25 @@ const IconGrid = new Lang.Class({
for (let index = 0; index < items.length; index++) {
items[index].actor.opacity = 0;
let [finalX, finalY] = items[index].actor.get_transformed_position();
- if (this._swarmType == SWARM_TYPE_FAR_FIRST) {
- let distance = this._distance([startX, startY], [finalX, finalY]);
- log("dist, norm");
- log(distance);
- log(normalization)
- delay = (1 - this._distance([startX, startY], [finalX, finalY]) / normalization) *
SWARM_ANIMATION_MAX_DELAY_FOR_ITEM;
- } else {
- delay = Math.random() * SWARM_ANIMATION_MAX_DELAY_FOR_ITEM;
+ switch (this._animationType) {
+ case ANIMATION_SWARM_FAR_FIRST:
+ let distance = this._distance([startX, startY], [finalX, finalY]);
+ delay = (1 - this._distance([startX, startY], [finalX, finalY]) / normalization) *
SWARM_ANIMATION_MAX_DELAY_FOR_ITEM;
+ break;
+ case ANIMATION_SWARM_RANDOM:
+ delay = Math.random() * SWARM_ANIMATION_MAX_DELAY_FOR_ITEM;
+ break;
+ case ANIMATION_APPEAR:
+ startX = finalX;
+ startY = finalY;
+ delay = 0;
+ break;
+ default:
+ startX = finalX;
+ startY = finalY;
+ delay = 0;
}
- log(delay);
- //delay = 0;
+
this._animateItem(items[index], [startX, startY], [finalX, finalY], delay);
}
},
@@ -430,10 +442,9 @@ const IconGrid = new Lang.Class({
time: SWARM_ANIMATION_FADE_IN_TIME_FOR_ITEM });
},
onComplete: Lang.bind(this, function() {
- log("opacity 255");
item.actor.opacity = 255;
itemClone.actor.destroy();
- // Assume the random value of delay is not important,
+ // FIXME: Assume the random value of delay is not important,
// and setting animating to true in the first finished
// animation is fine.
this._animating = false;
@@ -660,10 +671,10 @@ const PaginatedIconGrid = new Lang.Class({
this._childrenPerPage = 0;
this._mappedId = 0;
- this._mappedId = this.actor.connect("notify::allocation", Lang.bind(this,
+ this._mappedId = this.actor.connect("notify::allocation", Lang.bind(this,
function() {
if (this.actor.mapped)
- this.swarmAnimation();
+ this.animate();
}));
},
@@ -705,11 +716,6 @@ const PaginatedIconGrid = new Lang.Class({
let columnIndex = 0;
let rowIndex = 0;
-/*
- let dimmedItems = this._getItemsInPage(0);
- for (let index = 0; index < dimmedItems.length; index++)
- dimmedItems[index].actor.opacity = 0;*/
-
let visibleItems = this._getVisibleItems();
for (let i = 0; i < visibleItems.length; i++) {
let childBox = this._calculateChildBox(visibleItems[i].actor, x, y, box);
@@ -731,30 +737,13 @@ const PaginatedIconGrid = new Lang.Class({
}
},
- swarmAnimation: function() {
- log("paginated swarm");
- /*this.actor.disconnect(this._mappedId);
- this._mappedId = 0;
-
- log("animating" + items);
- if (items.length == 0) {
- this._mappedId = this.actor.connect("notify::allocation", Lang.bind(this,
- function() {
- if (this.actor.mapped)
- this.swarmAnimation(0);
- }));
- }*/
+ animate: function() {
let items = this._getItemsInPage(0);
// TODO: Fix this
if (items.length == 0)
return;
+
this.parent(items);
- /*
- this._animating = true;
- for (let index = 0; index < items.length; index++) {
- items[index].actor.opacity = 0;
- this._animateItem(items[index]);
- }*/
},
_computePages: function (availWidthPerPage, availHeightPerPage) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]