座標のずれを属性値として保持させるように

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4095 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-04-08 15:00:21 +00:00
parent 507295e46b
commit 6222e65b0b
2 changed files with 23 additions and 4 deletions

View File

@ -8,6 +8,8 @@ var TreeStyleTabService = {
kCOLLAPSED : 'treestyletab-collapsed', kCOLLAPSED : 'treestyletab-collapsed',
kCOLLAPSED_DONE : 'treestyletab-collapsed-done', kCOLLAPSED_DONE : 'treestyletab-collapsed-done',
kCOLLAPSING : 'treestyletab-collapsing', kCOLLAPSING : 'treestyletab-collapsing',
kX_OFFSET : 'treestyletab-x-offset',
kY_OFFSET : 'treestyletab-y-offset',
kTWISTY_HOVER : 'treestyletab-twisty-hover', kTWISTY_HOVER : 'treestyletab-twisty-hover',
kNEST : 'treestyletab-nest', kNEST : 'treestyletab-nest',
kDROP_POSITION : 'treestyletab-drop-position', kDROP_POSITION : 'treestyletab-drop-position',

View File

@ -3054,6 +3054,9 @@ TreeStyleTabBrowser.prototype = {
{ {
this.stopTabCollapseAnimation(aTab); this.stopTabCollapseAnimation(aTab);
aTab.removeAttribute(this.kX_OFFSET);
aTab.removeAttribute(this.kY_OFFSET);
var regexp = this.collapseRulesRegExp; var regexp = this.collapseRulesRegExp;
if ( if (
!this.animationEnabled || !this.animationEnabled ||
@ -3075,16 +3078,27 @@ TreeStyleTabBrowser.prototype = {
return; 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; var startMargin, endMargin, startOpacity, endOpacity;
if (aCollapsed) { if (aCollapsed) {
startMargin = 0; startMargin = 0;
endMargin = height; endMargin = maxMargin;
startOpacity = 1; startOpacity = 1;
endOpacity = 0; endOpacity = 0;
} }
else { else {
startMargin = height; aTab.setAttribute(offsetAttr, -maxMargin);
startMargin = maxMargin;
endMargin = 0; endMargin = 0;
startOpacity = 0; startOpacity = 0;
endOpacity = 1; endOpacity = 1;
@ -3101,6 +3115,7 @@ TreeStyleTabBrowser.prototype = {
collapseProp+': -'+startMargin+'px !important;'+ collapseProp+': -'+startMargin+'px !important;'+
'opacity: '+startOpacity+' !important;' 'opacity: '+startOpacity+' !important;'
); );
if (!aCollapsed) aTab.removeAttribute(this.kCOLLAPSED_DONE); if (!aCollapsed) aTab.removeAttribute(this.kCOLLAPSED_DONE);
var radian = 90 * Math.PI / 180; var radian = 90 * Math.PI / 180;
@ -3108,14 +3123,15 @@ TreeStyleTabBrowser.prototype = {
aTab.__treestyletab__updateTabCollapsedTask = function(aTime, aBeginning, aFinal, aDelay) { aTab.__treestyletab__updateTabCollapsedTask = function(aTime, aBeginning, aFinal, aDelay) {
if (aTime >= aDelay) { if (aTime >= aDelay) {
delete aTab.__treestyletab__updateTabCollapsedTask; delete aTab.__treestyletab__updateTabCollapsedTask;
if (aCollapsed) aTab.setAttribute(self.kCOLLAPSED_DONE, true);
aTab.removeAttribute(self.kCOLLAPSING); aTab.removeAttribute(self.kCOLLAPSING);
if (aCollapsed) aTab.setAttribute(self.kCOLLAPSED_DONE, true);
aTab.setAttribute( aTab.setAttribute(
'style', 'style',
aTab.getAttribute('style') aTab.getAttribute('style')
.replace(regexp, '') .replace(regexp, '')
.replace(self.kOPACITY_RULE_REGEXP, '') .replace(self.kOPACITY_RULE_REGEXP, '')
); );
aTab.removeAttribute(offsetAttr);
return true; return true;
} }
else { else {
@ -3129,6 +3145,7 @@ TreeStyleTabBrowser.prototype = {
collapseProp+': -'+margin+'px !important;'+ collapseProp+': -'+margin+'px !important;'+
'opacity: '+opacity+' !important;' 'opacity: '+opacity+' !important;'
); );
aTab.setAttribute(offsetAttr, -maxMargin);
return false; return false;
} }
}; };