mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 12:19:11 +00:00
parent
b878feca59
commit
3372eb3ba6
@ -84,33 +84,26 @@ ClassicStoryView.prototype.remove = function(widget) {
|
|||||||
};
|
};
|
||||||
// Abandon if the list entry isn't a DOM element (it might be a text node)
|
// Abandon if the list entry isn't a DOM element (it might be a text node)
|
||||||
if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) {
|
if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) {
|
||||||
widget.removeChildDomNodes();
|
removeElement();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Clone the target element
|
|
||||||
var cloneElement = targetElement.cloneNode(true);
|
|
||||||
targetElement.parentNode.insertBefore(cloneElement,targetElement);
|
|
||||||
// Remove the original element
|
|
||||||
widget.removeChildDomNodes();
|
|
||||||
// Get the current height of the tiddler
|
// Get the current height of the tiddler
|
||||||
var currWidth = cloneElement.offsetWidth,
|
var currWidth = targetElement.offsetWidth,
|
||||||
computedStyle = window.getComputedStyle(cloneElement),
|
computedStyle = window.getComputedStyle(targetElement),
|
||||||
currMarginBottom = parseInt(computedStyle.marginBottom,10),
|
currMarginBottom = parseInt(computedStyle.marginBottom,10),
|
||||||
currMarginTop = parseInt(computedStyle.marginTop,10),
|
currMarginTop = parseInt(computedStyle.marginTop,10),
|
||||||
currHeight = cloneElement.offsetHeight + currMarginTop;
|
currHeight = targetElement.offsetHeight + currMarginTop;
|
||||||
// Remove the dom nodes of the widget at the end of the transition
|
// Remove the dom nodes of the widget at the end of the transition
|
||||||
setTimeout(function() {
|
setTimeout(removeElement,duration);
|
||||||
cloneElement.parentNode.removeChild(cloneElement);
|
|
||||||
},duration);
|
|
||||||
// Animate the closure
|
// Animate the closure
|
||||||
$tw.utils.setStyle(cloneElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
{transform: "translateX(0px)"},
|
{transform: "translateX(0px)"},
|
||||||
{marginBottom: currMarginBottom + "px"},
|
{marginBottom: currMarginBottom + "px"},
|
||||||
{opacity: "1.0"}
|
{opacity: "1.0"}
|
||||||
]);
|
]);
|
||||||
$tw.utils.forceLayout(cloneElement);
|
$tw.utils.forceLayout(targetElement);
|
||||||
$tw.utils.setStyle(cloneElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms " + easing + ", " +
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms " + easing + ", " +
|
||||||
"opacity " + duration + "ms " + easing + ", " +
|
"opacity " + duration + "ms " + easing + ", " +
|
||||||
"margin-bottom " + duration + "ms " + easing},
|
"margin-bottom " + duration + "ms " + easing},
|
||||||
|
Loading…
Reference in New Issue
Block a user