mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 02:27:19 +00:00
Fix animation behaviour of reveal widget
This commit is contained in:
parent
73ca33d82d
commit
31ae8910c6
@ -89,6 +89,8 @@ RevealWidget.prototype.execute = function() {
|
|||||||
this["default"] = this.getAttribute("default","");
|
this["default"] = this.getAttribute("default","");
|
||||||
this.qualifyTiddlerTitles = this.getAttribute("qualifyTiddlerTitles");
|
this.qualifyTiddlerTitles = this.getAttribute("qualifyTiddlerTitles");
|
||||||
this.animate = this.getAttribute("animate","no");
|
this.animate = this.getAttribute("animate","no");
|
||||||
|
this.openAnimation = this.animate === "no" ? undefined : "open";
|
||||||
|
this.closeAnimation = this.animate === "no" ? undefined : "close";
|
||||||
// Compute the title of the state tiddler and read it
|
// Compute the title of the state tiddler and read it
|
||||||
this.stateTitle = this.state;
|
this.stateTitle = this.state;
|
||||||
if(this.qualifyTiddlerTitles) {
|
if(this.qualifyTiddlerTitles) {
|
||||||
@ -184,9 +186,9 @@ RevealWidget.prototype.updateState = function() {
|
|||||||
}
|
}
|
||||||
if(this.isOpen) {
|
if(this.isOpen) {
|
||||||
domNode.removeAttribute("hidden");
|
domNode.removeAttribute("hidden");
|
||||||
$tw.anim.perform("open",domNode);
|
$tw.anim.perform(this.openAnimation,domNode);
|
||||||
} else {
|
} else {
|
||||||
$tw.anim.perform("close",domNode,{callback: function() {
|
$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {
|
||||||
domNode.setAttribute("hidden","true");
|
domNode.setAttribute("hidden","true");
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,15 @@ Animator.prototype.perform = function(type,domNode,options) {
|
|||||||
chosenAnimation = animation[type];
|
chosenAnimation = animation[type];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Call the animation
|
if(!chosenAnimation) {
|
||||||
if(chosenAnimation) {
|
chosenAnimation = function(domNode,options) {
|
||||||
chosenAnimation(domNode,options);
|
if(options.callback) {
|
||||||
|
options.callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
// Call the animation
|
||||||
|
chosenAnimation(domNode,options);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Animator = Animator;
|
exports.Animator = Animator;
|
||||||
|
Loading…
Reference in New Issue
Block a user