From b2d346da57198822ddf59563a7c100eb6f6bc5a2 Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Tue, 20 Apr 2010 05:24:31 +0000 Subject: Minor aesthetic change on new net internals page: when you resize the window and it is in the requests view, grow the right box (details view) to fit the new space, rather than growing the left box. BUG=37421 Review URL: http://codereview.chromium.org/1627026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45013 0039d316-1c4b-4281-b951-d872f2087c98 --- .../net_internals/resizableverticalsplitview.js | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/chrome/browser/resources/net_internals/resizableverticalsplitview.js b/chrome/browser/resources/net_internals/resizableverticalsplitview.js index 78b62a0..289e20d 100644 --- a/chrome/browser/resources/net_internals/resizableverticalsplitview.js +++ b/chrome/browser/resources/net_internals/resizableverticalsplitview.js @@ -52,18 +52,18 @@ ResizableVerticalSplitView.prototype.setGeometry = function( this, left, top, width, height); // If this is the first setGeometry(), initialize the split point at 50%. - if (!this.rightSplit_) - this.rightSplit_ = parseInt((width / 2).toFixed(0)); + if (!this.leftSplit_) + this.leftSplit_ = parseInt((width / 2).toFixed(0)); // Calculate the horizontal split points. - var rightboxWidth = this.rightSplit_; + var leftboxWidth = this.leftSplit_; var sizerWidth = this.sizerView_.getWidth(); - var leftboxWidth = width - (rightboxWidth + sizerWidth); + var rightboxWidth = width - (leftboxWidth + sizerWidth); - // Don't let the left pane get too small. - if (leftboxWidth < ResizableVerticalSplitView.MIN_PANEL_WIDTH) { - leftboxWidth = ResizableVerticalSplitView.MIN_PANEL_WIDTH; - rightboxWidth = width - (sizerWidth + leftboxWidth); + // Don't let the right pane get too small. + if (rightboxWidth < ResizableVerticalSplitView.MIN_PANEL_WIDTH) { + rightboxWidth = ResizableVerticalSplitView.MIN_PANEL_WIDTH; + leftboxWidth = width - (sizerWidth + rightboxWidth); } // Position the boxes using calculated split points. @@ -100,13 +100,17 @@ ResizableVerticalSplitView.prototype.onDragSizerStart_ = function(event) { */ ResizableVerticalSplitView.prototype.onDragSizer = function(event) { // Convert from page coordinates, to view coordinates. - this.rightSplit_ = this.getWidth() - (event.pageX - this.getLeft()); + this.leftSplit_ = (event.pageX - this.getLeft()); + // Avoid shrinking the left box too much. + this.leftSplit_ = Math.max( + this.leftSplit_, ResizableVerticalSplitView.MIN_PANEL_WIDTH); // Avoid shrinking the right box too much. - this.rightSplit_ = Math.max( - this.rightSplit_, ResizableVerticalSplitView.MIN_PANEL_WIDTH); + this.leftSplit_ = Math.min( + this.leftSplit_, + this.getWidth() - ResizableVerticalSplitView.MIN_PANEL_WIDTH); - // Force a layout with the new |rightSplit_|. + // Force a layout with the new |leftSplit_|. this.setGeometry( this.getLeft(), this.getTop(), this.getWidth(), this.getHeight()); }; -- cgit v1.1