kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Move the animation duration into a tiddler so that we can easily let it be adjusted in the control panel
rodzic
e8425131f4
commit
fbfe5a26c5
|
|
@ -14,8 +14,6 @@ Core configuration constants
|
||||||
|
|
||||||
exports.preferences = {};
|
exports.preferences = {};
|
||||||
|
|
||||||
exports.preferences.animationDuration = 400;
|
|
||||||
exports.preferences.animationDurationMs = exports.preferences.animationDuration + "ms";
|
|
||||||
exports.preferences.notificationDuration = 3 * 1000;
|
exports.preferences.notificationDuration = 3 * 1000;
|
||||||
exports.preferences.jsonSpaces = 4;
|
exports.preferences.jsonSpaces = 4;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
/*\
|
|
||||||
title: $:/core/modules/hacks.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: global
|
|
||||||
|
|
||||||
These functions are designed to be invoked in the browser developer tools or the node.js REPL.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Switch slowmotion animation mode on or off
|
|
||||||
*/
|
|
||||||
exports.slowmo = function(status) {
|
|
||||||
if(status === undefined || status) {
|
|
||||||
$tw.config.preferences.animationDuration = 4000;
|
|
||||||
} else {
|
|
||||||
$tw.config.preferences.animationDuration = 400;
|
|
||||||
}
|
|
||||||
$tw.config.preferences.animationDurationMs = $tw.config.preferences.animationDuration + "ms";
|
|
||||||
return "Slowmo is " + ($tw.config.preferences.animationDuration === 400 ? "dis" : "") + "engaged."
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
@ -13,6 +13,7 @@ A simple slide animation that varies the height of the element
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function slideOpen(domNode,options) {
|
function slideOpen(domNode,options) {
|
||||||
|
var duration = $tw.utils.getAnimationDuration();
|
||||||
// Get the current height of the domNode
|
// Get the current height of the domNode
|
||||||
var computedStyle = window.getComputedStyle(domNode),
|
var computedStyle = window.getComputedStyle(domNode),
|
||||||
currMarginBottom = parseInt(computedStyle.marginBottom,10),
|
currMarginBottom = parseInt(computedStyle.marginBottom,10),
|
||||||
|
|
@ -34,7 +35,7 @@ function slideOpen(domNode,options) {
|
||||||
if(options.callback) {
|
if(options.callback) {
|
||||||
options.callback();
|
options.callback();
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Set up the initial position of the element
|
// Set up the initial position of the element
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
|
|
@ -48,12 +49,12 @@ function slideOpen(domNode,options) {
|
||||||
$tw.utils.forceLayout(domNode);
|
$tw.utils.forceLayout(domNode);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
{transition: "margin-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: "margin-top " + duration + "ms ease-in-out, " +
|
||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"margin-bottom " + duration + "ms ease-in-out, " +
|
||||||
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-top " + duration + "ms ease-in-out, " +
|
||||||
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-bottom " + duration + "ms ease-in-out, " +
|
||||||
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"height " + duration + "ms ease-in-out, " +
|
||||||
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"opacity " + duration + "ms ease-in-out"},
|
||||||
{marginBottom: currMarginBottom + "px"},
|
{marginBottom: currMarginBottom + "px"},
|
||||||
{marginTop: currMarginTop + "px"},
|
{marginTop: currMarginTop + "px"},
|
||||||
{paddingBottom: currPaddingBottom + "px"},
|
{paddingBottom: currPaddingBottom + "px"},
|
||||||
|
|
@ -64,7 +65,8 @@ function slideOpen(domNode,options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function slideClosed(domNode,options) {
|
function slideClosed(domNode,options) {
|
||||||
var currHeight = domNode.offsetHeight;
|
var duration = $tw.utils.getAnimationDuration(),
|
||||||
|
currHeight = domNode.offsetHeight;
|
||||||
// Clear the properties we've set when the animation is over
|
// Clear the properties we've set when the animation is over
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
|
|
@ -79,7 +81,7 @@ function slideClosed(domNode,options) {
|
||||||
if(options.callback) {
|
if(options.callback) {
|
||||||
options.callback();
|
options.callback();
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Set up the initial position of the element
|
// Set up the initial position of the element
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
{height: currHeight + "px"},
|
{height: currHeight + "px"},
|
||||||
|
|
@ -88,12 +90,12 @@ function slideClosed(domNode,options) {
|
||||||
$tw.utils.forceLayout(domNode);
|
$tw.utils.forceLayout(domNode);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
{transition: "margin-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: "margin-top " + duration + "ms ease-in-out, " +
|
||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"margin-bottom " + duration + "ms ease-in-out, " +
|
||||||
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-top " + duration + "ms ease-in-out, " +
|
||||||
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-bottom " + duration + "ms ease-in-out, " +
|
||||||
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"height " + duration + "ms ease-in-out, " +
|
||||||
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"opacity " + duration + "ms ease-in-out"},
|
||||||
{marginTop: "0px"},
|
{marginTop: "0px"},
|
||||||
{marginBottom: "0px"},
|
{marginBottom: "0px"},
|
||||||
{paddingTop: "0px"},
|
{paddingTop: "0px"},
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ Options include:
|
||||||
*/
|
*/
|
||||||
Modal.prototype.display = function(title,options) {
|
Modal.prototype.display = function(title,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var self = this;
|
var self = this,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Up the modal count and adjust the body class
|
// Up the modal count and adjust the body class
|
||||||
this.modalCount++;
|
this.modalCount++;
|
||||||
this.adjustPageClass();
|
this.adjustPageClass();
|
||||||
|
|
@ -42,7 +43,7 @@ Modal.prototype.display = function(title,options) {
|
||||||
modalFooterHelp = document.createElement("span"),
|
modalFooterHelp = document.createElement("span"),
|
||||||
modalFooterButtons = document.createElement("span"),
|
modalFooterButtons = document.createElement("span"),
|
||||||
tiddler = this.wiki.getTiddler(title),
|
tiddler = this.wiki.getTiddler(title),
|
||||||
d = $tw.config.preferences.animationDuration + "ms";
|
d = duration + "ms";
|
||||||
// Don't do anything if the tiddler doesn't exist
|
// Don't do anything if the tiddler doesn't exist
|
||||||
if(!tiddler) {
|
if(!tiddler) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -154,7 +155,7 @@ Modal.prototype.display = function(title,options) {
|
||||||
{transition: "opacity " + d + " ease-out"}
|
{transition: "opacity " + d + " ease-out"}
|
||||||
]);
|
]);
|
||||||
$tw.utils.setStyle(modalWrapper,[
|
$tw.utils.setStyle(modalWrapper,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in-out"}
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in-out"}
|
||||||
]);
|
]);
|
||||||
// Force layout
|
// Force layout
|
||||||
$tw.utils.forceLayout(modalBackdrop);
|
$tw.utils.forceLayout(modalBackdrop);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Notifier.prototype.display = function(title,options) {
|
||||||
// Create the wrapper divs
|
// Create the wrapper divs
|
||||||
var notification = document.createElement("div"),
|
var notification = document.createElement("div"),
|
||||||
tiddler = this.wiki.getTiddler(title),
|
tiddler = this.wiki.getTiddler(title),
|
||||||
d = $tw.config.preferences.animationDuration + "ms";
|
d = $tw.utils.getAnimationDuration() + "ms";
|
||||||
// Don't do anything if the tiddler doesn't exist
|
// Don't do anything if the tiddler doesn't exist
|
||||||
if(!tiddler) {
|
if(!tiddler) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -47,7 +47,7 @@ Notifier.prototype.display = function(title,options) {
|
||||||
{opacity: "0"},
|
{opacity: "0"},
|
||||||
{transformOrigin: "0% 0%"},
|
{transformOrigin: "0% 0%"},
|
||||||
{transform: "translateY(" + (-window.innerHeight) + "px)"},
|
{transform: "translateY(" + (-window.innerHeight) + "px)"},
|
||||||
{transition: "opacity " + d + " ease-out, " + $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in-out"}
|
{transition: "opacity " + d + " ease-out, " + $tw.utils.roundTripPropertyName("transform") + " " + d + " ease-in-out"}
|
||||||
]);
|
]);
|
||||||
// Add the notification to the DOM
|
// Add the notification to the DOM
|
||||||
document.body.appendChild(notification);
|
document.body.appendChild(notification);
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ PageScroller.prototype.handleEvent = function(event) {
|
||||||
Handle a scroll event hitting the page document
|
Handle a scroll event hitting the page document
|
||||||
*/
|
*/
|
||||||
PageScroller.prototype.scrollIntoView = function(element) {
|
PageScroller.prototype.scrollIntoView = function(element) {
|
||||||
|
var duration = $tw.utils.getAnimationDuration()
|
||||||
// Get the offset bounds of the element
|
// Get the offset bounds of the element
|
||||||
var bounds = {
|
var bounds = {
|
||||||
left: element.offsetLeft,
|
left: element.offsetLeft,
|
||||||
|
|
@ -94,7 +95,7 @@ PageScroller.prototype.scrollIntoView = function(element) {
|
||||||
var self = this,
|
var self = this,
|
||||||
drawFrame;
|
drawFrame;
|
||||||
drawFrame = function () {
|
drawFrame = function () {
|
||||||
var t = ((new Date()) - self.startTime) / $tw.config.preferences.animationDuration;
|
var t = ((new Date()) - self.startTime) / duration;
|
||||||
if(t >= 1) {
|
if(t >= 1) {
|
||||||
self.cancelScroll();
|
self.cancelScroll();
|
||||||
t = 1;
|
t = 1;
|
||||||
|
|
|
||||||
|
|
@ -395,4 +395,11 @@ exports.extractVersionInfo = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get the animation duration in ms
|
||||||
|
*/
|
||||||
|
exports.getAnimationDuration = function() {
|
||||||
|
return parseInt($tw.wiki.getTiddlerText("$:/config/AnimationDuration","400"),10);
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ ClassicListView.prototype.navigateTo = function(historyInfo) {
|
||||||
|
|
||||||
ClassicListView.prototype.insert = function(index) {
|
ClassicListView.prototype.insert = function(index) {
|
||||||
var listElementNode = this.listWidget.children[index],
|
var listElementNode = this.listWidget.children[index],
|
||||||
targetElement = listElementNode.domNode;
|
targetElement = listElementNode.domNode,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Get the current height of the tiddler
|
// Get the current height of the tiddler
|
||||||
var currMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),
|
var currMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),
|
||||||
currMarginTop = parseInt(window.getComputedStyle(targetElement).marginTop,10),
|
currMarginTop = parseInt(window.getComputedStyle(targetElement).marginTop,10),
|
||||||
|
|
@ -42,7 +43,7 @@ ClassicListView.prototype.insert = function(index) {
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
{marginBottom: ""}
|
{marginBottom: ""}
|
||||||
]);
|
]);
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Set up the initial position of the element
|
// Set up the initial position of the element
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
|
|
@ -52,8 +53,8 @@ ClassicListView.prototype.insert = function(index) {
|
||||||
$tw.utils.forceLayout(targetElement);
|
$tw.utils.forceLayout(targetElement);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: "opacity " + duration + "ms ease-in-out, " +
|
||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"margin-bottom " + duration + "ms ease-in-out"},
|
||||||
{marginBottom: currMarginBottom + "px"},
|
{marginBottom: currMarginBottom + "px"},
|
||||||
{opacity: "1.0"}
|
{opacity: "1.0"}
|
||||||
]);
|
]);
|
||||||
|
|
@ -61,7 +62,8 @@ ClassicListView.prototype.insert = function(index) {
|
||||||
|
|
||||||
ClassicListView.prototype.remove = function(index) {
|
ClassicListView.prototype.remove = function(index) {
|
||||||
var listElementNode = this.listWidget.children[index],
|
var listElementNode = this.listWidget.children[index],
|
||||||
targetElement = listElementNode.domNode;
|
targetElement = listElementNode.domNode,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Get the current height of the tiddler
|
// Get the current height of the tiddler
|
||||||
var currWidth = targetElement.offsetWidth,
|
var currWidth = targetElement.offsetWidth,
|
||||||
currMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),
|
currMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),
|
||||||
|
|
@ -72,7 +74,7 @@ ClassicListView.prototype.remove = function(index) {
|
||||||
if(targetElement.parentNode) {
|
if(targetElement.parentNode) {
|
||||||
targetElement.parentNode.removeChild(targetElement);
|
targetElement.parentNode.removeChild(targetElement);
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Animate the closure
|
// Animate the closure
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
|
|
@ -82,9 +84,9 @@ ClassicListView.prototype.remove = function(index) {
|
||||||
]);
|
]);
|
||||||
$tw.utils.forceLayout(targetElement);
|
$tw.utils.forceLayout(targetElement);
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in-out, " +
|
||||||
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"opacity " + duration + "ms ease-in-out, " +
|
||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"margin-bottom " + duration + "ms ease-in-out"},
|
||||||
{transform: "translateX(-" + currWidth + "px)"},
|
{transform: "translateX(-" + currWidth + "px)"},
|
||||||
{marginBottom: (-currHeight) + "px"},
|
{marginBottom: (-currHeight) + "px"},
|
||||||
{opacity: "0.0"}
|
{opacity: "0.0"}
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,15 @@ var PopListView = function(listWidget) {
|
||||||
|
|
||||||
PopListView.prototype.insert = function(index) {
|
PopListView.prototype.insert = function(index) {
|
||||||
var listElementNode = this.listWidget.children[index],
|
var listElementNode = this.listWidget.children[index],
|
||||||
targetElement = listElementNode.domNode;
|
targetElement = listElementNode.domNode,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Reset once the transition is over
|
// Reset once the transition is over
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
{transform: "none"}
|
{transform: "none"}
|
||||||
]);
|
]);
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Set up the initial position of the element
|
// Set up the initial position of the element
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
|
|
@ -35,8 +36,8 @@ PopListView.prototype.insert = function(index) {
|
||||||
$tw.utils.forceLayout(targetElement);
|
$tw.utils.forceLayout(targetElement);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in-out, " +
|
||||||
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"opacity " + duration + "ms ease-in-out"},
|
||||||
{transform: "scale(1)"},
|
{transform: "scale(1)"},
|
||||||
{opacity: "1.0"}
|
{opacity: "1.0"}
|
||||||
]);
|
]);
|
||||||
|
|
@ -44,13 +45,14 @@ PopListView.prototype.insert = function(index) {
|
||||||
|
|
||||||
PopListView.prototype.remove = function(index) {
|
PopListView.prototype.remove = function(index) {
|
||||||
var listElementNode = this.listWidget.children[index],
|
var listElementNode = this.listWidget.children[index],
|
||||||
targetElement = listElementNode.domNode;
|
targetElement = listElementNode.domNode,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Remove the element at the end of the transition
|
// Remove the element at the end of the transition
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(targetElement.parentNode) {
|
if(targetElement.parentNode) {
|
||||||
targetElement.parentNode.removeChild(targetElement);
|
targetElement.parentNode.removeChild(targetElement);
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Animate the closure
|
// Animate the closure
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: "none"},
|
{transition: "none"},
|
||||||
|
|
@ -59,8 +61,8 @@ PopListView.prototype.remove = function(index) {
|
||||||
]);
|
]);
|
||||||
$tw.utils.forceLayout(targetElement);
|
$tw.utils.forceLayout(targetElement);
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in-out, " +
|
||||||
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"opacity " + duration + "ms ease-in-out"},
|
||||||
{transform: "scale(0.1)"},
|
{transform: "scale(0.1)"},
|
||||||
{opacity: "0.0"}
|
{opacity: "0.0"}
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,8 @@ Visualise navigating back to the previous tiddler
|
||||||
*/
|
*/
|
||||||
ZoominListView.prototype.remove = function(index) {
|
ZoominListView.prototype.remove = function(index) {
|
||||||
var listElementNode = this.listWidget.children[index],
|
var listElementNode = this.listWidget.children[index],
|
||||||
targetElement = listElementNode.domNode;
|
targetElement = listElementNode.domNode,
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
// Set up the tiddler that is being closed
|
// Set up the tiddler that is being closed
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{position: "absolute"},
|
{position: "absolute"},
|
||||||
|
|
@ -96,7 +97,7 @@ ZoominListView.prototype.remove = function(index) {
|
||||||
{display: "block"},
|
{display: "block"},
|
||||||
{transformOrigin: "50% 50%"},
|
{transformOrigin: "50% 50%"},
|
||||||
{transform: "translateX(0px) translateY(0px) scale(10)"},
|
{transform: "translateX(0px) translateY(0px) scale(10)"},
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in, opacity " + $tw.config.preferences.animationDurationMs + " ease-in"},
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in, opacity " + duration + "ms ease-in"},
|
||||||
{opacity: "0"},
|
{opacity: "0"},
|
||||||
{zIndex: "500"}
|
{zIndex: "500"}
|
||||||
]);
|
]);
|
||||||
|
|
@ -109,7 +110,7 @@ ZoominListView.prototype.remove = function(index) {
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transformOrigin: "50% 50%"},
|
{transformOrigin: "50% 50%"},
|
||||||
{transform: "translateX(0px) translateY(0px) scale(0.1)"},
|
{transform: "translateX(0px) translateY(0px) scale(0.1)"},
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in, opacity " + $tw.config.preferences.animationDurationMs + " ease-in"},
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in, opacity " + duration + "ms ease-in"},
|
||||||
{opacity: "0"},
|
{opacity: "0"},
|
||||||
{zIndex: "0"}
|
{zIndex: "0"}
|
||||||
]);
|
]);
|
||||||
|
|
@ -118,7 +119,7 @@ ZoominListView.prototype.remove = function(index) {
|
||||||
if(targetElement.parentNode) {
|
if(targetElement.parentNode) {
|
||||||
targetElement.parentNode.removeChild(targetElement);
|
targetElement.parentNode.removeChild(targetElement);
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
// Now the tiddler we're going back to
|
// Now the tiddler we're going back to
|
||||||
if(toElement) {
|
if(toElement) {
|
||||||
$tw.utils.setStyle(toElement,[
|
$tw.utils.setStyle(toElement,[
|
||||||
|
|
@ -130,7 +131,8 @@ ZoominListView.prototype.remove = function(index) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ZoominListView.prototype.navigateTo = function(historyInfo) {
|
ZoominListView.prototype.navigateTo = function(historyInfo) {
|
||||||
var listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title);
|
var listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title),
|
||||||
|
duration = $tw.utils.getAnimationDuration();
|
||||||
if(listElementIndex === undefined) {
|
if(listElementIndex === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +174,7 @@ ZoominListView.prototype.navigateTo = function(historyInfo) {
|
||||||
this.currentTiddler = targetElement;
|
this.currentTiddler = targetElement;
|
||||||
// Transform the target tiddler to its natural size
|
// Transform the target tiddler to its natural size
|
||||||
$tw.utils.setStyle(targetElement,[
|
$tw.utils.setStyle(targetElement,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in, opacity " + $tw.config.preferences.animationDurationMs + " ease-in"},
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in, opacity " + duration + "ms ease-in"},
|
||||||
{opacity: "1.0"},
|
{opacity: "1.0"},
|
||||||
{transform: "translateX(0px) translateY(0px) scale(1)"},
|
{transform: "translateX(0px) translateY(0px) scale(1)"},
|
||||||
{zIndex: "500"},
|
{zIndex: "500"},
|
||||||
|
|
@ -183,7 +185,7 @@ ZoominListView.prototype.navigateTo = function(historyInfo) {
|
||||||
x = zoomBounds.left - targetBounds.left - (sourceBounds.left - targetBounds.left) * scale;
|
x = zoomBounds.left - targetBounds.left - (sourceBounds.left - targetBounds.left) * scale;
|
||||||
y = zoomBounds.top - targetBounds.top - (sourceBounds.top - targetBounds.top) * scale;
|
y = zoomBounds.top - targetBounds.top - (sourceBounds.top - targetBounds.top) * scale;
|
||||||
$tw.utils.setStyle(prevCurrentTiddler,[
|
$tw.utils.setStyle(prevCurrentTiddler,[
|
||||||
{transition: $tw.utils.roundTripPropertyName("transform") + " " + $tw.config.preferences.animationDurationMs + " ease-in, opacity " + $tw.config.preferences.animationDurationMs + " ease-in"},
|
{transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms ease-in, opacity " + duration + "ms ease-in"},
|
||||||
{opacity: "0.0"},
|
{opacity: "0.0"},
|
||||||
{transformOrigin: "0 0"},
|
{transformOrigin: "0 0"},
|
||||||
{transform: "translateX(" + x + "px) translateY(" + y + "px) scale(" + scale + ")"},
|
{transform: "translateX(" + x + "px) translateY(" + y + "px) scale(" + scale + ")"},
|
||||||
|
|
@ -194,7 +196,7 @@ ZoominListView.prototype.navigateTo = function(historyInfo) {
|
||||||
if(self.currentTiddler !== prevCurrentTiddler) {
|
if(self.currentTiddler !== prevCurrentTiddler) {
|
||||||
prevCurrentTiddler.style.display = "none";
|
prevCurrentTiddler.style.display = "none";
|
||||||
}
|
}
|
||||||
},$tw.config.preferences.animationDuration);
|
},duration);
|
||||||
}
|
}
|
||||||
// Scroll the target into view
|
// Scroll the target into view
|
||||||
// $tw.pageScroller.scrollIntoView(targetElement);
|
// $tw.pageScroller.scrollIntoView(targetElement);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ title: $:/ControlPanel
|
||||||
|
|
||||||
* [[Username for signing edits|$:/status/UserName]]: <$edit tiddler="$:/status/UserName" default="" type="input"/>
|
* [[Username for signing edits|$:/status/UserName]]: <$edit tiddler="$:/status/UserName" default="" type="input"/>
|
||||||
|
|
||||||
|
* [[Animation duration|$:/config/AnimationDuration]]: <$edit tiddler="$:/config/AnimationDuration" default="" type="input"/>
|
||||||
|
|
||||||
* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to choose which tiddlers are displayed at startup
|
* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to choose which tiddlers are displayed at startup
|
||||||
|
|
||||||
! Import tiddlers
|
! Import tiddlers
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: $:/config/AnimationDuration
|
||||||
|
|
||||||
|
400
|
||||||
Ładowanie…
Reference in New Issue