changing pageBounds and default guide ranges so that the extend animation looks better

This commit is contained in:
Michael Yoshitaka Erlewine 2010-06-30 01:06:36 -04:00
parent 8ffb32bd67
commit 51a6895e12
2 changed files with 10 additions and 7 deletions

View File

@ -844,12 +844,11 @@ window.Items = {
// ----------
// Function: getPageBounds
// Returns a <Rect> defining the area of the page <Item>s should stay within.
getPageBounds: function() {
var top = 0;
var bottom = TabItems.tabHeight + 10; // MAGIC NUMBER: giving room for the "new tabs" group
getPageBounds: function( dontCountNewTabGroup ) {
var bottom = dontCountNewTabGroup ? 0 : TabItems.tabHeight + Items.defaultGutter;
var width = Math.max(100, window.innerWidth);
var height = Math.max(100, window.innerHeight - (top + bottom));
return new Rect(0, top, width, height);
var height = Math.max(100, window.innerHeight - bottom);
return new Rect(0, 0, width, height);
},
// ----------

View File

@ -130,9 +130,13 @@ Trench.prototype = {
setPosition: function Trench_setPos(position, range, minRange) {
this.position = position;
var page = Items.getPageBounds( true );
// optionally, set the range.
if (isRange(range)) {
this.range = range;
} else {
this.range = new Range( 0, (this.xory == 'x' ? page.height : page.width) );
}
// if there's a minRange, set that too.
@ -140,9 +144,9 @@ Trench.prototype = {
this.minRange = minRange;
// set the appropriate bounds as a rect.
if ( this.xory == "x" ) // horizontal
if ( this.xory == "x" ) // vertical
this.rect = new Rect ( this.position - this.radius, this.range.min, 2 * this.radius, this.range.extent );
else
else // horizontal
this.rect = new Rect ( this.range.min, this.position - this.radius, this.range.extent, 2 * this.radius );
this.show(); // DEBUG