タブバー上でのドラッグで自動スクロールするように
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4050 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
f2805baac8
commit
a9d5dbfcf0
@ -1110,6 +1110,8 @@ catch(e) {
|
||||
var TSTTabBrowser = this;
|
||||
if ((function(aSelf) {
|
||||
try{
|
||||
if (TSTTabBrowser.treeStyleTab.processAutoScroll(aEvent)) return true;
|
||||
|
||||
var info = TSTTabBrowser.treeStyleTab.getDropAction(aEvent, TST_DRAGSESSION);
|
||||
|
||||
if (!info.target || info.target != TreeStyleTabService.evaluateXPath(
|
||||
|
@ -2580,6 +2580,39 @@ TreeStyleTabBrowser.prototype = {
|
||||
return tabsInfo.draggedTabs.length == this.getTabs(this.mTabBrowser).snapshotLength;
|
||||
},
|
||||
|
||||
processAutoScroll : function(aEvent)
|
||||
{
|
||||
var tabs = this.mTabBrowser.mTabContainer;
|
||||
if (tabs.getAttribute('overflow') != 'true') return false;
|
||||
|
||||
var tabStrip = tabs.mTabstrip;
|
||||
var pixels = tabStrip.scrollIncrement;
|
||||
var box = tabs.boxObject;
|
||||
if (this.isVertical) {
|
||||
if (aEvent.screenY < box.screenY + this.autoScrollArea) {
|
||||
pixels *= -1;
|
||||
}
|
||||
else if (aEvent.screenY < box.screenY + box.height - this.autoScrollArea) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var ltr = window.getComputedStyle(this.parentNode, null).direction == 'ltr';
|
||||
if (aEvent.screenX < box.screenX + this.autoScrollArea) {
|
||||
pixels *= -1;
|
||||
}
|
||||
else if (aEvent.screenX < box.screenX + box.width - this.autoScrollArea) {
|
||||
return false;
|
||||
}
|
||||
pixels = (ltr ? 1 : -1) * pixels;
|
||||
}
|
||||
tabStrip.scrollByPixels(pixels);
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
return true;
|
||||
},
|
||||
autoScrollArea : 20,
|
||||
|
||||
/* commands */
|
||||
|
||||
/* attach/part */
|
||||
|
Loading…
x
Reference in New Issue
Block a user