From 9aa932860f78442f9543e1ba8554558862c6d620 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 20 Apr 2010 11:47:54 -0700 Subject: [PATCH] + First working version of squish --- browser/base/content/tabcandy/app/items.js | 16 ++++++++++++++-- browser/base/content/tabcandy/app/tabitems.js | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/browser/base/content/tabcandy/app/items.js b/browser/base/content/tabcandy/app/items.js index 0067bed1c6d6..0f80bb7d7a37 100644 --- a/browser/base/content/tabcandy/app/items.js +++ b/browser/base/content/tabcandy/app/items.js @@ -181,14 +181,14 @@ window.Item.prototype = { pushOne(itemsToPush.shift()); // ___ Squish! - if(false) { + if(true) { var pageBounds = Items.getPageBounds(); $.each(items, function(index, item) { var data = item.pushAwayData; if(data.generation == 0 || item.locked) return; - function apply(item, postStep, posStep2, sizeStep) { + function apply(item, posStep, posStep2, sizeStep) { var data = item.pushAwayData; if(data.generation == 0) return; @@ -218,6 +218,18 @@ window.Item.prototype = { var posStep = new Point(); var posStep2 = new Point(); var sizeStep = new Point(); + + if(bounds.left < pageBounds.left) { + posStep.x = pageBounds.left - bounds.left; + sizeStep.x = posStep.x / data.generation; + posStep2.x = -sizeStep.x; + } else if(bounds.right > pageBounds.right) { + posStep.x = pageBounds.right - bounds.right; + sizeStep.x = -posStep.x / data.generation; + posStep.x += sizeStep.x; + posStep2.x = sizeStep.x; + } + if(bounds.top < pageBounds.top) { posStep.y = pageBounds.top - bounds.top; sizeStep.y = posStep.y / data.generation; diff --git a/browser/base/content/tabcandy/app/tabitems.js b/browser/base/content/tabcandy/app/tabitems.js index 98b5054a19b2..c8b573bedbf1 100644 --- a/browser/base/content/tabcandy/app/tabitems.js +++ b/browser/base/content/tabcandy/app/tabitems.js @@ -228,7 +228,7 @@ window.TabItems = { var box = Items.getPageBounds(); box.inset(20, 20); - Items.arrange(items, box, {padding: 10}); + Items.arrange(items, box, {padding: 10, animate:false}); } // TODO: Figure out this really weird bug?