"removed unnecessary transitions and jumpiness when presentation starts"
This commit is contained in:
@@ -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 = {
|
||||
@@ -310,7 +312,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// transitionEnd event handler
|
||||
|
||||
var expectedTransitionTarget = null;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user