minimum and maximum scale added to config

This commit is contained in:
Bartek Szopka
2012-03-08 21:59:41 +01:00
parent 807943dadc
commit eb4df9c0ee

View File

@@ -149,7 +149,9 @@
// probably will get extended (and configurable) later // probably will get extended (and configurable) later
var config = { var config = {
width: 1024, width: 1024,
height: 768 height: 768,
maxScale: 1,
minScale: 0
} }
var canvas = document.createElement("div"); var canvas = document.createElement("div");
@@ -197,14 +199,24 @@
var isStep = function ( el ) { var isStep = function ( el ) {
return !!(el && el.id && stepData["impress-" + el.id]); return !!(el && el.id && stepData["impress-" + el.id]);
} };
var computeWindowScale = function () { var computeWindowScale = function () {
var hScale = window.innerHeight / config.height; var hScale = window.innerHeight / config.height,
var wScale = window.innerWidth / config.width; wScale = window.innerWidth / config.width,
return hScale > wScale ? wScale : hScale; 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 ) { steps.forEach(function ( el, idx ) {
var data = el.dataset, var data = el.dataset,
step = { step = {