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
Родитель 3dfd5085de
Коммит 41fc519159
2 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -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);
},
// ----------

Просмотреть файл

@ -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