fix "too narrow tab bar" probelm automatically (fix for https://github.com/piroor/treestyletab/issues/76 )
This commit is contained in:
parent
028399cd59
commit
b7194c201a
@ -1139,18 +1139,23 @@ var TreeStyleTabService = {
|
||||
if (this.tabbarResizeStartWidth < 0)
|
||||
return;
|
||||
|
||||
aEvent.stopPropagation();
|
||||
if ('releaseCapture' in aEvent.currentTarget)
|
||||
aEvent.currentTarget.releaseCapture();
|
||||
var target = aEvent.currentTarget;
|
||||
var b = this.getTabBrowserFromChild(target);
|
||||
|
||||
aEvent.currentTarget.removeEventListener('mousemove', this, false);
|
||||
aEvent.stopPropagation();
|
||||
if ('releaseCapture' in target)
|
||||
target.releaseCapture();
|
||||
|
||||
target.removeEventListener('mousemove', this, false);
|
||||
|
||||
this.tabbarResizeStartWidth = -1;
|
||||
this.tabbarResizeStartHeight = -1;
|
||||
this.tabbarResizeStartX = -1;
|
||||
this.tabbarResizeStartY = -1;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aEvent.currentTarget);
|
||||
this.Deferred.next(function() {
|
||||
b.treeStyleTab.fixTooNarrowTabbar();
|
||||
});
|
||||
},
|
||||
onTabbarResizing : function TSTService_onTabbarResizing(aEvent)
|
||||
{
|
||||
|
@ -388,6 +388,39 @@ TreeStyleTabBrowser.prototype = {
|
||||
);
|
||||
},
|
||||
|
||||
fixTooNarrowTabbar : function TSTBrowser_fixTooNarrowTabbar()
|
||||
{
|
||||
if (!this.isFloating) return;
|
||||
/**
|
||||
* The tab bar can become smaller than the actual size of the
|
||||
* floating tab bar, and then, we cannot resize tab bar by
|
||||
* dragging anymore. To avoid this problem, we have to enlarge
|
||||
* the tab bar larger than the floating tab bar.
|
||||
*/
|
||||
if (this.isVertical) {
|
||||
let key = this.autoHide.expanded ?
|
||||
'tabbar.width' : 'tabbar.shrunkenWidth' ;
|
||||
let width = this.getTreePref(key);
|
||||
let minWidth = this.scrollBox.boxObject.width
|
||||
if (minWidth > width) {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
this.setTreePref(key, minWidth);
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
let height = this.getTreePref('tabbar.height');
|
||||
let minHeight = this.scrollBox.boxObject.height
|
||||
if (minHeight > height) {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
this.setTreePref('tabbar.height', minHeight);
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* initialize */
|
||||
|
||||
init : function TSTBrowser_init()
|
||||
@ -460,6 +493,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.autoHide;
|
||||
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_INITIALIZE);
|
||||
this.fixTooNarrowTabbar();
|
||||
|
||||
this.fireTabbarPositionEvent(false, 'top', position); /* PUBLIC API */
|
||||
|
||||
|
@ -202,6 +202,8 @@ AutoHideBrowser.prototype = {
|
||||
this.updateTransparency();
|
||||
|
||||
this.showHideInternal();
|
||||
|
||||
b.treeStyleTab.fixTooNarrowTabbar();
|
||||
},
|
||||
|
||||
end : function AHB_end()
|
||||
|
Loading…
Reference in New Issue
Block a user