changing pageBounds and default guide ranges so that the extend animation looks better
authorMichael Yoshitaka Erlewine <mitcho@mitcho.com>
Wed, 30 Jun 2010 01:06:36 -0400
changeset 50057 787f642748303420ddd37c2f58868b2acfa37a53
parent 50056 ae8ed0a14a61dcf8de6b95007f62063f1278cc5c
child 50058 3f5bbeb43a9bd07107b88e3398e008a40f10032f
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
changing pageBounds and default guide ranges so that the extend animation looks better
browser/base/content/tabcandy/app/items.js
browser/base/content/tabcandy/app/trench.js
--- a/browser/base/content/tabcandy/app/items.js
+++ b/browser/base/content/tabcandy/app/items.js
@@ -839,22 +839,21 @@ window.Items = {
     });
     
     return 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);
   },
   
   // ----------
   // Function: getSafeWindowBounds
   // Returns the bounds within which it is safe to place all non-stationary <Item>s.
   getSafeWindowBounds: function( dontCountNewTabGroup ) {
     // the safe bounds that would keep it "in the window"
     var gutter = Items.defaultGutter;
--- a/browser/base/content/tabcandy/app/trench.js
+++ b/browser/base/content/tabcandy/app/trench.js
@@ -125,29 +125,33 @@ Trench.prototype = {
   // 
   // Parameters:
   //   position - (integer) px center position of the trench
   //   range - (<Range>) the explicit active range of the trench
   //   minRange - (<Range>) the minimum range of the trench
   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.
     if (isRange(minRange))
       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
 
   },
   
   //----------
   // Function: setActiveRange