[gnome-shell] messageTray: fix summary area wobbling
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] messageTray: fix summary area wobbling
- Date: Wed, 16 Mar 2011 13:47:29 +0000 (UTC)
commit e27293edbc1c26ea1c3ddd54f25fac3a8a04e9dd
Author: Dan Winship <danw gnome org>
Date: Mon Mar 7 14:04:03 2011 -0500
messageTray: fix summary area wobbling
Due to accumulation of rounding errors, the left edge of the summary area
could wobble by a few pixels during animations. Fix that.
https://bugzilla.gnome.org/show_bug.cgi?id=636930
js/ui/messageTray.js | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 8a29597..c105d4d 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1339,6 +1339,8 @@ MessageTray.prototype = {
},
set _expandedSummaryItemTitleWidth(expansion) {
+ expansion = Math.round(expansion);
+
// Expand the expanding item to its new width
if (this._expandedSummaryItem)
this._expandedSummaryItem.setTitleWidth(expansion);
@@ -1369,11 +1371,32 @@ MessageTray.prototype = {
if (this._summaryItems[i] == this._expandedSummaryItem)
continue;
- let width = this._summaryItems[i].getTitleWidth();
- this._summaryItems[i].setTitleWidth(width * shrinkage);
+ let oldWidth = this._summaryItems[i].getTitleWidth();
+ let newWidth = Math.floor(oldWidth * shrinkage);
+ excess -= newWidth;
+ this._summaryItems[i].setTitleWidth(newWidth);
+ }
+ if (this._expandedSummaryItem) {
+ let oldWidth = this._imaginarySummaryItemTitleWidth;
+ let newWidth = Math.floor(oldWidth * shrinkage);
+ excess -= newWidth;
+ this._imaginarySummaryItemTitleWidth = newWidth;
+ }
+
+ // If the tray as a whole is fully-expanded, make sure the
+ // left edge doesn't wobble during animation due to rounding.
+ if (this._imaginarySummaryItemTitleWidth == 0 && excess != 0) {
+ for (let i = 0; i < this._summaryItems.length; i++) {
+ if (this._summaryItems[i] == this._expandedSummaryItem)
+ continue;
+
+ let oldWidth = this._summaryItems[i].getTitleWidth();
+ if (oldWidth != 0) {
+ this._summaryItems[i].setTitleWidth (oldWidth + excess);
+ break;
+ }
+ }
}
- if (this._expandedSummaryItem)
- this._imaginarySummaryItemTitleWidth *= shrinkage;
},
_expandSummaryItemCompleted: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]