タブを移動した時のツリーの自動編集処理を修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1631 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-11-27 00:41:51 +00:00
parent d24dac2666
commit 61f22fa749

View File

@ -1053,11 +1053,11 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser; var b = this.mTabBrowser;
this.initTabContents(tab); // twisty vanished after the tab is moved!! this.initTabContents(tab); // twisty vanished after the tab is moved!!
var rebuildTreeDone = false; // var rebuildTreeDone = false;
if (tab.getAttribute(this.kCHILDREN) && !this.isSubTreeMoving) { if (tab.getAttribute(this.kCHILDREN) && !this.isSubTreeMoving) {
this.moveTabSubTreeTo(tab, tab._tPos); this.moveTabSubTreeTo(tab, tab._tPos);
rebuildTreeDone = true; // rebuildTreeDone = true;
} }
var parentTab = this.getParentTab(tab); var parentTab = this.getParentTab(tab);
@ -1068,7 +1068,7 @@ TreeStyleTabBrowser.prototype = {
this.updateTabsCount(tab, true); this.updateTabsCount(tab, true);
if ( if (
rebuildTreeDone || // rebuildTreeDone ||
this.isSubTreeMoving || this.isSubTreeMoving ||
this.internallyTabMoving this.internallyTabMoving
) )
@ -1096,13 +1096,21 @@ TreeStyleTabBrowser.prototype = {
if (aOldPosition === void(0)) aOldPosition = aTab._tPos; if (aOldPosition === void(0)) aOldPosition = aTab._tPos;
var pos = this.getChildIndex(aTab, parent); var pos = this.getChildIndex(aTab, parent);
if (aTab._tPos < aOldPosition) aOldPosition--;
var oldPos = this.getChildIndex(this.mTabBrowser.mTabContainer.childNodes[aOldPosition], parent); var oldPos = this.getChildIndex(this.mTabBrowser.mTabContainer.childNodes[aOldPosition], parent);
if (pos < 0 || oldPos < 0) { var delta;
pos = this.getVisibleIndex(aTab); if (
oldPos = this.getVisibleIndex(this.mTabBrowser.mTabContainer.childNodes[aOldPosition]); // (parent && (
// parent != prevParent ||
// parent != nextParent
// )) ||
pos < 0 || oldPos < 0
) {
delta = 2;
}
else {
delta = Math.abs(pos - oldPos);
} }
var delta = Math.abs(pos - oldPos);
if (pos < oldPos) delta--;
var newParent = null; var newParent = null;