[gnome-shell] Be more careful with workspace thumbnail scale
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Be more careful with workspace thumbnail scale
- Date: Fri, 18 Feb 2011 16:37:49 +0000 (UTC)
commit ef983480c0e5b7a59731462a48e73aa53bb860aa
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Feb 18 10:31:18 2011 -0500
Be more careful with workspace thumbnail scale
- When tweening a workspace to collapse it, round the multiplied
height so that we don't change other workspace sizes via rounding
differences.
- Use separate horizontal and vertical scales, so that every thumbnail
has the same horizontal scale.
https://bugzilla.gnome.org/show_bug.cgi?id=641881
js/ui/workspaceThumbnail.js | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index d86f019..f555bba 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -714,6 +714,7 @@ ThumbnailsBox.prototype = {
let thumbnailHeight = portholeHeight * this._scale;
let thumbnailWidth = Math.round(portholeWidth * this._scale);
+ let roundedHScale = thumbnailWidth / portholeWidth;
let slideOffset; // X offset when thumbnail is fully slid offscreen
if (rtl)
@@ -746,7 +747,7 @@ ThumbnailsBox.prototype = {
let thumbnail = this._thumbnails[i];
if (i > 0)
- y += (1 - thumbnail.collapseFraction) * spacing;
+ y += spacing - Math.round(thumbnail.collapseFraction * spacing);
// We might end up with thumbnailHeight being something like 99.33
// pixels. To make this work and not end up with a gap at the bottom,
@@ -754,7 +755,7 @@ ThumbnailsBox.prototype = {
// we compute an actual scale separately for each thumbnail.
let y1 = Math.round(y);
let y2 = Math.round(y + thumbnailHeight);
- let roundedScale = (y2 - y1) / portholeHeight;
+ let roundedVScale = (y2 - y1) / portholeHeight;
let x1, x2;
if (rtl) {
@@ -775,10 +776,13 @@ ThumbnailsBox.prototype = {
childBox.y1 = y1;
childBox.y2 = y1 + portholeHeight;
- thumbnail.actor.set_scale(roundedScale, roundedScale);
+ thumbnail.actor.set_scale(roundedHScale, roundedVScale);
thumbnail.actor.allocate(childBox, flags);
- y += thumbnailHeight * (1 - thumbnail.collapseFraction);
+ // We round the collapsing portion so that we don't get thumbnails resizing
+ // during an animation due to differences in rounded, but leave the uncollapsed
+ // portion unrounded so that non-animating we end up with the right total
+ y += thumbnailHeight - Math.round(thumbnailHeight * thumbnail.collapseFraction);
}
if (rtl) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]