+ First working version of squish

This commit is contained in:
Ian Gilman 2010-04-20 11:47:54 -07:00
parent f2998ab293
commit 9aa932860f
2 changed files with 15 additions and 3 deletions

View File

@ -181,14 +181,14 @@ window.Item.prototype = {
pushOne(itemsToPush.shift()); pushOne(itemsToPush.shift());
// ___ Squish! // ___ Squish!
if(false) { if(true) {
var pageBounds = Items.getPageBounds(); var pageBounds = Items.getPageBounds();
$.each(items, function(index, item) { $.each(items, function(index, item) {
var data = item.pushAwayData; var data = item.pushAwayData;
if(data.generation == 0 || item.locked) if(data.generation == 0 || item.locked)
return; return;
function apply(item, postStep, posStep2, sizeStep) { function apply(item, posStep, posStep2, sizeStep) {
var data = item.pushAwayData; var data = item.pushAwayData;
if(data.generation == 0) if(data.generation == 0)
return; return;
@ -218,6 +218,18 @@ window.Item.prototype = {
var posStep = new Point(); var posStep = new Point();
var posStep2 = new Point(); var posStep2 = new Point();
var sizeStep = 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) { if(bounds.top < pageBounds.top) {
posStep.y = pageBounds.top - bounds.top; posStep.y = pageBounds.top - bounds.top;
sizeStep.y = posStep.y / data.generation; sizeStep.y = posStep.y / data.generation;

View File

@ -228,7 +228,7 @@ window.TabItems = {
var box = Items.getPageBounds(); var box = Items.getPageBounds();
box.inset(20, 20); 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? // TODO: Figure out this really weird bug?