Allow to disable "shrink others while dragging" feature

This commit is contained in:
YUKI Hiroshi 2016-09-13 12:42:34 +09:00
parent df530ca62c
commit a5d2fac9f1
3 changed files with 19 additions and 5 deletions

View File

@ -5,7 +5,9 @@
window['piro.sakura.ne.jp'].tabsDragUtils.initTabBrowser(gBrowser);
// in dragstart event listener
window['piro.sakura.ne.jp'].tabsDragUtils.startTabsDrag(aEvent, aArrayOfTabs);
window['piro.sakura.ne.jp'].tabsDragUtils.startTabsDrag(aEvent, aArrayOfTabs, {
shrinkOthers : true // shrink other dragged tabs while dragging
});
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
@ -433,7 +435,7 @@ TDUContext.destroy();
updateDraggedTabs : function TDU_updateDraggedTabs(context)
{
context.draggedTabs.forEach(function(draggedTab, aIndex) {
if (aIndex > 0) {
if (draggedTab._dragData.canShrink && aIndex > 0) {
let style = draggedTab.style;
if (!draggedTab.__tabsDragUtils__backupStyle) {
let backup = {
@ -582,8 +584,10 @@ TDUContext.destroy();
this.updatedTabDNDObservers = this.updatedTabDNDObservers.splice(index, 1);
},
startTabsDrag : function TDU_startTabsDrag(aEvent, aTabs)
startTabsDrag : function TDU_startTabsDrag(aEvent, aTabs, aOptions)
{
aOptions = aOptions || {};
var draggedTab = this.getTabFromEvent(aEvent);
var tabs = aTabs || [];
var index = tabs.indexOf(draggedTab);
@ -622,15 +626,18 @@ TDUContext.destroy();
scrollX: isVertical ? 0 : tabbar.mTabstrip.scrollPosition ,
scrollY: isVertical ? tabbar.mTabstrip.scrollPosition : 0 ,
screenX: aEvent.screenX,
screenY: aEvent.screenY
screenY: aEvent.screenY,
canShrink : aOptions.shrinkOthers || false
};
}, this);
}
aEvent.stopPropagation();
if (aOptions.shrinkOthers) {
document.addEventListener('dragend', this, true);
document.addEventListener('drop', this, true);
}
},
isVertical : function TDS_isVertical(aElement)
{

View File

@ -671,6 +671,11 @@ pref("extensions.treestyletab.pinnedTab.faviconized", true);
pref("extensions.treestyletab.groupTab.columnize", true);
pref("extensions.treestyletab.groupTab.columnize.width", "20em");
/**
* If true, other dragged tabs are shrunken while dragging.
*/
pref("extensions.treestyletab.shrinkOtherDraggedTabs", true);
/**
* If true, TST automatically disables Tabs in Titlebar appearance to avoid
* broken appearance problems.

View File

@ -773,7 +773,9 @@ catch(e) {
)
return;
w['piro.sakura.ne.jp'].tabsDragUtils.startTabsDrag(aEvent, tabsInfo.draggedTabs);
w['piro.sakura.ne.jp'].tabsDragUtils.startTabsDrag(aEvent, tabsInfo.draggedTabs, {
shrinkOthers : utils.getTreePref('shrinkOtherDraggedTabs')
});
},
onTabbarDragStart : function TabbarDND_onTabbarDragStart(aEvent)