タブバー上のイベントからタブを取得する処理を汎用化
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3452 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
7f7b081ff7
commit
b49b06ffb1
@ -1681,16 +1681,10 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.collapseExpandSubtree(tab, tab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true');
|
||||
}
|
||||
else if (!this.getTabFromEvent(aEvent)) {
|
||||
var clickedPoint = aEvent[this.positionProp];
|
||||
Array.slice(this.mTabBrowser.mTabContainer.childNodes).some(function(aTab) {
|
||||
var box = aTab.boxObject;
|
||||
if (box[this.positionProp] > clickedPoint ||
|
||||
box[this.positionProp] + box[this.sizeProp] < clickedPoint) {
|
||||
return false;
|
||||
}
|
||||
var tab = this.getTabFromTabbarEvent(aEvent);
|
||||
if (tab) {
|
||||
this.mTabBrowser.selectedTab = aTab;
|
||||
return true;
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
@ -1699,6 +1693,21 @@ TreeStyleTabBrowser.prototype = {
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
},
|
||||
getTabFromTabbarEvent : function(aEvent)
|
||||
{
|
||||
var tab = null;
|
||||
var clickedPoint = aEvent[this.positionProp];
|
||||
Array.slice(this.mTabBrowser.mTabContainer.childNodes).some(function(aTab) {
|
||||
var box = aTab.boxObject;
|
||||
if (box[this.positionProp] > clickedPoint ||
|
||||
box[this.positionProp] + box[this.sizeProp] < clickedPoint) {
|
||||
return false;
|
||||
}
|
||||
tab = aTab;
|
||||
return true;
|
||||
}, this);
|
||||
return tab;
|
||||
},
|
||||
|
||||
onTabMouseDown : function(aEvent)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user