allow more than two document zooms #2

Merged
j merged 2 commits from many-documents into master 2018-03-15 10:24:54 +00:00
Showing only changes of commit 3fd440a849 - Show all commits

View File

@ -60,7 +60,7 @@ function start(idx) {
function stop(idx) {
var data = slideData[idx]
console.log(current, data)
if (data.zoom_to) {
if (data.zooms) {
reset_zoom(data)
} else if (data.video && data.video.length) {
reset_video(data)
@ -121,8 +121,9 @@ window.addEventListener('blur', function(){
function reset_zoom(data) {
data.zoomTimeouts.forEach(timeout => clearTimeout(timeout))
data.embed.postMessage('options', {
'area': data.zoom_from
'area': data.zooms[0]
})
}
@ -130,12 +131,13 @@ function start_zoom(data) {
// console.log('start zoon', Math.round(1000 * data.duration / 2))
for (var i=1; i<data.zooms.length; i++) {
data.zoomTimeouts = [];
(function(j) {
setTimeout(function() {
data.zoomTimeouts.push(setTimeout(function() {
data.embed.postMessage('options', {
'area': data.zooms[j]
})
}, Math.round(1000 * (data.duration / data.zooms.length) * j))
}, Math.round(1000 * (data.duration / data.zooms.length) * j)))
})(i)
}
}