aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Szopka <bartek.szopka+github@gmail.com>2012-03-10 22:51:20 +0000
committerBartek Szopka <bartek.szopka+github@gmail.com>2012-03-10 22:51:20 +0000
commitb0a139ef81aaa73a5227b5ac47b6caf8f58d359d (patch)
treeb0f5e0303c42b9d4ad272cf67077ca45509d0407
parent1bbf205bc71b89b0f72a83ac6a1e7f5c4c0f46b1 (diff)
downloadimpress.js-b0a139ef81aaa73a5227b5ac47b6caf8f58d359d.tar.gz
"removed unnecessary transitions and jumpiness when presentation starts"
-rw-r--r--js/impress.js41
1 files changed, 20 insertions, 21 deletions
diff --git a/js/impress.js b/js/impress.js
index bf824e2..8498cc6 100644
--- a/js/impress.js
+++ b/js/impress.js
@@ -112,6 +112,22 @@
return byId( window.location.hash.replace(/^#\/?/,"") );
};
+ var computeWindowScale = function ( config ) {
+ var hScale = window.innerHeight / config.height,
+ wScale = window.innerWidth / config.width,
+ scale = hScale > wScale ? wScale : hScale;
+
+ if (config.maxScale && scale > config.maxScale) {
+ scale = config.maxScale;
+ }
+
+ if (config.minScale && scale < config.minScale) {
+ scale = config.minScale;
+ }
+
+ return scale;
+ };
+
// CHECK SUPPORT
var body = document.body;
@@ -199,6 +215,8 @@
var steps = $$(".step", root);
+ var windowScale = computeWindowScale( config );
+
// SETUP
// set initial values and defaults
@@ -220,7 +238,7 @@
css(root, {
top: "50%",
left: "50%",
- transform: perspective( config.perspective )
+ transform: perspective( config.perspective/windowScale ) + scale( windowScale )
});
css(canvas, props);
@@ -236,22 +254,6 @@
return !!(el && el.id && stepData["impress-" + el.id]);
};
- var computeWindowScale = function () {
- var hScale = window.innerHeight / config.height,
- wScale = window.innerWidth / config.width,
- scale = hScale > wScale ? wScale : hScale;
-
- if (config.maxScale && scale > config.maxScale) {
- scale = config.maxScale;
- }
-
- if (config.minScale && scale < config.minScale) {
- scale = config.minScale;
- }
-
- return scale;
- };
-
steps.forEach(function ( el, idx ) {
var data = el.dataset,
step = {
@@ -285,7 +287,7 @@
});
});
-
+
var active = null;
// step events
@@ -309,7 +311,6 @@
triggerEvent(step, "impressStepLeave");
}
};
-
// transitionEnd event handler
@@ -325,8 +326,6 @@
root.addEventListener(transitionEnd, onTransitionEnd, false);
canvas.addEventListener(transitionEnd, onTransitionEnd, false);
- var windowScale = computeWindowScale();
-
var stepTo = function ( el, force ) {
if ( !isStep(el) || (el === active && !force) ) {
// selected element is not defined as step or is already active