"removed unnecessary transitions and jumpiness when presentation starts"

This commit is contained in:
Bartek Szopka
2012-03-10 22:51:20 +00:00
parent 1bbf205bc7
commit b0a139ef81

View File

@@ -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