タブバー上でのドラッグで自動スクロールするように

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4050 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-04-06 17:47:57 +00:00
parent f2805baac8
commit a9d5dbfcf0
2 changed files with 88 additions and 53 deletions

View File

@ -1110,6 +1110,8 @@ catch(e) {
var TSTTabBrowser = this; var TSTTabBrowser = this;
if ((function(aSelf) { if ((function(aSelf) {
try{ try{
if (TSTTabBrowser.treeStyleTab.processAutoScroll(aEvent)) return true;
var info = TSTTabBrowser.treeStyleTab.getDropAction(aEvent, TST_DRAGSESSION); var info = TSTTabBrowser.treeStyleTab.getDropAction(aEvent, TST_DRAGSESSION);
if (!info.target || info.target != TreeStyleTabService.evaluateXPath( if (!info.target || info.target != TreeStyleTabService.evaluateXPath(

View File

@ -2580,6 +2580,39 @@ TreeStyleTabBrowser.prototype = {
return tabsInfo.draggedTabs.length == this.getTabs(this.mTabBrowser).snapshotLength; 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 */ /* commands */
/* attach/part */ /* attach/part */