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 9ee095b6db - Show all commits

View File

@ -49,8 +49,8 @@ function previous() {
function start(idx) { function start(idx) {
var data = slideData[idx] var data = slideData[idx]
console.log(current, data) console.log('start', current, data)
if (data.zoom_to) { if (data.zooms) {
start_zoom(data) start_zoom(data)
} else if (data.video && data.video.length) { } else if (data.video && data.video.length) {
start_video(data) start_video(data)
@ -83,10 +83,10 @@ function load_slide(slide) {
if (video) { if (video) {
data.video = load_urls(video.dataset) data.video = load_urls(video.dataset)
data.container = video data.container = video
// fixme only doucments
if (data.video.length == 2) { // assumes documents if length > 1
data.zoom_from = data.video[0].split('/').pop().split('#')[0].split(',').map(a => Math.round(a)) if (data.video.length > 1) {
data.zoom_to = data.video[1].split('/').pop().split('#')[0].split(',').map(a => Math.round(a)) data.zooms = data.video.map(url => url.split('/').pop().split('#')[0].split(',').map(a => Math.round(a)))
} }
} }
return data return data
@ -127,13 +127,17 @@ function reset_zoom(data) {
} }
function start_zoom(data) { function start_zoom(data) {
console.log('start zoon', Math.round(1000 * data.duration / 2)) // console.log('start zoon', Math.round(1000 * data.duration / 2))
setTimeout(function() {
console.log('now zoom') for (var i=1; i<data.zooms.length; i++) {
data.embed.postMessage('options', { (function(j) {
'area': data.zoom_to setTimeout(function() {
}) data.embed.postMessage('options', {
}, Math.round(1000 * data.duration / 2)) 'area': data.zooms[j]
})
}, Math.round(1000 * (data.duration / data.zooms.length) * j))
})(i)
}
} }