From 6222e65b0b4de2fc8ed1e609bb17d058ba0274a3 Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 8 Apr 2009 15:00:21 +0000 Subject: [PATCH] =?UTF-8?q?=E5=BA=A7=E6=A8=99=E3=81=AE=E3=81=9A=E3=82=8C?= =?UTF-8?q?=E3=82=92=E5=B1=9E=E6=80=A7=E5=80=A4=E3=81=A8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E3=81=95=E3=81=9B=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4095 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 2 ++ content/treestyletab/treestyletabbrowser.js | 25 +++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 8af3b95f..4f2d8ebe 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -8,6 +8,8 @@ var TreeStyleTabService = { kCOLLAPSED : 'treestyletab-collapsed', kCOLLAPSED_DONE : 'treestyletab-collapsed-done', kCOLLAPSING : 'treestyletab-collapsing', + kX_OFFSET : 'treestyletab-x-offset', + kY_OFFSET : 'treestyletab-y-offset', kTWISTY_HOVER : 'treestyletab-twisty-hover', kNEST : 'treestyletab-nest', kDROP_POSITION : 'treestyletab-drop-position', diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index a5992c0a..147b2aa4 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -3054,6 +3054,9 @@ TreeStyleTabBrowser.prototype = { { this.stopTabCollapseAnimation(aTab); + aTab.removeAttribute(this.kX_OFFSET); + aTab.removeAttribute(this.kY_OFFSET); + var regexp = this.collapseRulesRegExp; if ( !this.animationEnabled || @@ -3075,16 +3078,27 @@ TreeStyleTabBrowser.prototype = { return; } - var height = this.getFirstTab(this.mTabBrowser).boxObject.height; + var maxMargin; + var offsetAttr; + if (this.isVertical) { + maxMargin = this.getFirstTab(this.mTabBrowser).boxObject.height; + offsetAttr = this.kY_OFFSET; + } + else { + maxMargin = this.getFirstTab(this.mTabBrowser).boxObject.width; + offsetAttr = this.kX_OFFSET; + } + var startMargin, endMargin, startOpacity, endOpacity; if (aCollapsed) { startMargin = 0; - endMargin = height; + endMargin = maxMargin; startOpacity = 1; endOpacity = 0; } else { - startMargin = height; + aTab.setAttribute(offsetAttr, -maxMargin); + startMargin = maxMargin; endMargin = 0; startOpacity = 0; endOpacity = 1; @@ -3101,6 +3115,7 @@ TreeStyleTabBrowser.prototype = { collapseProp+': -'+startMargin+'px !important;'+ 'opacity: '+startOpacity+' !important;' ); + if (!aCollapsed) aTab.removeAttribute(this.kCOLLAPSED_DONE); var radian = 90 * Math.PI / 180; @@ -3108,14 +3123,15 @@ TreeStyleTabBrowser.prototype = { aTab.__treestyletab__updateTabCollapsedTask = function(aTime, aBeginning, aFinal, aDelay) { if (aTime >= aDelay) { delete aTab.__treestyletab__updateTabCollapsedTask; - if (aCollapsed) aTab.setAttribute(self.kCOLLAPSED_DONE, true); aTab.removeAttribute(self.kCOLLAPSING); + if (aCollapsed) aTab.setAttribute(self.kCOLLAPSED_DONE, true); aTab.setAttribute( 'style', aTab.getAttribute('style') .replace(regexp, '') .replace(self.kOPACITY_RULE_REGEXP, '') ); + aTab.removeAttribute(offsetAttr); return true; } else { @@ -3129,6 +3145,7 @@ TreeStyleTabBrowser.prototype = { collapseProp+': -'+margin+'px !important;'+ 'opacity: '+opacity+' !important;' ); + aTab.setAttribute(offsetAttr, -maxMargin); return false; } };