diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-06 21:43:38 +0100 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-06 21:43:38 +0100 |
commit | 456817d3b59a9e800bcad292a5d74c2dc4d2f502 (patch) | |
tree | 2f34155d5b6f653cbc20261c378b9838260e0b1e | |
parent | 45fcf19c4d2c8096fbafe71de67e2c5279d4d70d (diff) | |
download | impress.js-456817d3b59a9e800bcad292a5d74c2dc4d2f502.tar.gz |
scaling elements to make them fit the screen (by @fmate14)
-rw-r--r-- | js/impress.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/js/impress.js b/js/impress.js index 7395cd9..f82dad1 100644 --- a/js/impress.js +++ b/js/impress.js @@ -141,6 +141,19 @@ document.head.appendChild(meta); } + // configuration object + // probably will get extended (and configurable) later + var config = { + width: 1024, + height: 768 + } + + // computing scale of the window + var hScale = window.innerHeight / config.height; + var wScale = window.innerWidth / config.width; + var windowScale = hScale > wScale ? wScale : hScale; + + var canvas = document.createElement("div"); canvas.className = "canvas"; @@ -285,8 +298,8 @@ css(root, { // to keep the perspective look similar for different scales // we need to 'scale' the perspective, too - perspective: step.scale * 1000 + "px", - transform: scale(target.scale), + perspective: step.scale * (1/windowScale) * 1000 + "px", + transform: scale(target.scale * windowScale), transitionDuration: duration, transitionDelay: (zoomin ? "500ms" : "0ms") }); |