タブバーの自動開閉機能について、ポインタ位置の判別がおかしくなっていたのを修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4030 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-04-02 11:17:52 +00:00
parent d9dcc17f96
commit 700c0118ea

View File

@ -32,6 +32,7 @@ TreeStyleTabBrowser.prototype = {
invertedSizeProp : 'width', invertedSizeProp : 'width',
togglerSize : 0, togglerSize : 0,
sensitiveArea : 7,
get browser() get browser()
{ {
@ -478,6 +479,7 @@ TreeStyleTabBrowser.prototype = {
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.fixed'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.fixed');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.transparent.style'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.transparent.style');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.area');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.togglerSize'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.togglerSize');
window.setTimeout(function() { window.setTimeout(function() {
b.treeStyleTab.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.mode'); b.treeStyleTab.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.mode');
@ -1093,6 +1095,10 @@ TreeStyleTabBrowser.prototype = {
this.checkTabsIndentOverflow(); this.checkTabsIndentOverflow();
break; break;
case 'extensions.treestyletab.tabbar.autoHide.area':
this.sensitiveArea = value;
break;
case 'extensions.treestyletab.tabbar.togglerSize': case 'extensions.treestyletab.tabbar.togglerSize':
this.togglerSize = value; this.togglerSize = value;
var toggler = document.getAnonymousElementByAttribute(b, 'class', this.kTABBAR_TOGGLER); var toggler = document.getAnonymousElementByAttribute(b, 'class', this.kTABBAR_TOGGLER);
@ -3568,32 +3574,6 @@ TreeStyleTabBrowser.prototype = {
/* auto hide */ /* auto hide */
autoHideEnabled : false, autoHideEnabled : false,
get sensitiveArea()
{
var b = this.mTabBrowser;
var area = Math.abs(this.getTreePref('tabbar.autoHide.area'));
var pos = b.getAttribute(this.kTABBAR_POSITION);
switch (this.autoHideMode)
{
case this.kAUTOHIDE_MODE_HIDE:
if (!this.tabbarShown &&
this.getTreePref('tabbar.autoHide.expandArea'))
area += (pos == 'left' || pos == 'right') ?
this.autoHideXOffset + this.splitterWidth :
this.autoHideYOffset ;
break;
default:
case this.kAUTOHIDE_MODE_SHRINK:
if (pos == 'left' || pos == 'right') {
if (!this.tabbarExpanded)
area = b.mStrip.boxObject.width - area;
}
break;
}
return area;
},
startAutoHide : function() startAutoHide : function()
{ {
if (this.autoHideEnabled) return; if (this.autoHideEnabled) return;
@ -3673,14 +3653,15 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser; var b = this.mTabBrowser;
var pos = b.getAttribute(this.kTABBAR_POSITION); var pos = b.getAttribute(this.kTABBAR_POSITION);
var box = b.mCurrentBrowser.boxObject;
var shouldKeepShown = ( var shouldKeepShown = (
pos == 'left' ? pos == 'left' ?
(aEvent.screenX <= b.mCurrentBrowser.boxObject.screenX + this.sensitiveArea) : (aEvent.screenX <= box.screenX + this.sensitiveArea) :
pos == 'right' ? pos == 'right' ?
(aEvent.screenX >= b.mCurrentBrowser.boxObject.screenX + b.boxObject.width - this.sensitiveArea) : (aEvent.screenX >= box.screenX + box.width - this.sensitiveArea) :
pos == 'bottom' ? pos == 'bottom' ?
(aEvent.screenY >= b.mCurrentBrowser.boxObject.screenY + b.boxObject.height - this.sensitiveArea) : (aEvent.screenY >= box.screenY + box.height - this.sensitiveArea) :
(aEvent.screenY <= b.mCurrentBrowser.boxObject.screenY + this.sensitiveArea) (aEvent.screenY <= box.screenY + this.sensitiveArea)
); );
if (this.autoHideShown) { if (this.autoHideShown) {
if ( if (
@ -3709,12 +3690,12 @@ TreeStyleTabBrowser.prototype = {
} }
else if ( else if (
pos == 'left' ? pos == 'left' ?
(aEvent.screenX <= b.boxObject.screenX + this.sensitiveArea) : (aEvent.screenX <= box.screenX + this.sensitiveArea) :
pos == 'right' ? pos == 'right' ?
(aEvent.screenX >= b.boxObject.screenX + b.boxObject.width - this.sensitiveArea) : (aEvent.screenX >= box.screenX + box.width - this.sensitiveArea) :
pos == 'bottom' ? pos == 'bottom' ?
(aEvent.screenY >= b.boxObject.screenY + b.boxObject.height - this.sensitiveArea) : (aEvent.screenY >= box.screenY + box.height - this.sensitiveArea) :
(aEvent.screenY <= b.boxObject.screenY + this.sensitiveArea) (aEvent.screenY <= box.screenY + this.sensitiveArea)
) { ) {
this.showHideTabbarOnMousemoveTimer = window.setTimeout( this.showHideTabbarOnMousemoveTimer = window.setTimeout(
function(aSelf) { function(aSelf) {