[gnome-shell] dash: Add minor optimization to _adjustIconSize()
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] dash: Add minor optimization to _adjustIconSize()
- Date: Mon, 17 Oct 2011 14:15:17 +0000 (UTC)
commit 6d0be86a4efae4d46f520df24d82d6773d57cdab
Author: Florian MÃllner <fmuellner gnome org>
Date: Tue Sep 20 18:35:48 2011 +0200
dash: Add minor optimization to _adjustIconSize()
In case _adjustIconSize() is called while the the dash icons are
animating, some extra work is required to yield the expected result.
Skip those extra steps when the icons are not actually animating.
https://bugzilla.gnome.org/show_bug.cgi?id=649248
js/ui/dash.js | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index aa5f972..36588c0 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -427,14 +427,20 @@ Dash.prototype = {
let firstIcon = iconChildren[0]._delegate.child._delegate.icon;
- // Icons may be animating, so enforce the current icon size
- // during the size request
- let [currentWidth, currentHeight] = firstIcon.icon.get_size();
+ let minHeight, natHeight;
- firstIcon.icon.set_size(this.iconSize, this.iconSize);
- let [minHeight, natHeight] = iconChildren[0].get_preferred_height(-1);
+ // Enforce the current icon size during the size request if
+ // the icon is animating
+ if (firstIcon._animating) {
+ let [currentWidth, currentHeight] = firstIcon.icon.get_size();
- firstIcon.icon.set_size(currentWidth, currentHeight);
+ firstIcon.icon.set_size(this.iconSize, this.iconSize);
+ [minHeight, natHeight] = iconChildren[0].get_preferred_height(-1);
+
+ firstIcon.icon.set_size(currentWidth, currentHeight);
+ } else {
+ [minHeight, natHeight] = iconChildren[0].get_preferred_height(-1);
+ }
// Subtract icon padding and box spacing from the available height
@@ -478,11 +484,15 @@ Dash.prototype = {
icon.icon.set_size(icon.icon.width * scale,
icon.icon.height * scale);
+ icon._animating = true;
Tweener.addTween(icon.icon,
{ width: targetWidth,
height: targetHeight,
time: DASH_ANIMATION_TIME,
- transition: 'easeOutQuad'
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ icon._animating = false;
+ }
});
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]