Don't try to scroll to the selected tab when it is already in the viewport in its axis.

This fixes annoyingly horizontal scroll happend when ColourfulTabs is activated. #842
This commit is contained in:
Piro / YUKI Hiroshi 2015-03-01 23:35:28 +09:00
parent 9463bb8062
commit 0afae1c655

View File

@ -483,16 +483,23 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
{ {
if (!this.windowService.preInitialized || !aTab) if (!this.windowService.preInitialized || !aTab)
return false; return false;
if (aTab.getAttribute('pinned') == 'true') if (aTab.getAttribute('pinned') == 'true')
return true; return true;
var tabBox = this.getFutureBoxObject(aTab); var tabBox = this.getFutureBoxObject(aTab);
var barBox = this.scrollBox.boxObject; var barBox = this.scrollBox.boxObject;
return (
tabBox.screenX >= barBox.screenX && if (this.isVertical)
tabBox.screenX + tabBox.width <= barBox.screenX + barBox.width && return (
tabBox.screenY >= barBox.screenY && tabBox.screenY >= barBox.screenY &&
tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height
); );
else
return (
tabBox.screenX >= barBox.screenX &&
tabBox.screenX + tabBox.width <= barBox.screenX + barBox.width
);
}, },
isMultiRow : function TSTBrowser_isMultiRow() isMultiRow : function TSTBrowser_isMultiRow()