safely ignore unknown directions

master
Tomáš Mládek 2021-04-22 11:27:11 +02:00
parent bfc364fe4b
commit 50b9883f99
2 changed files with 9 additions and 6 deletions

View File

@ -469,10 +469,11 @@ async function processScrolls(svg: XMLDocument): Promise<VideoScrollDef[]> {
direction as VideoScrollDirection
)
) {
throw new Error(`Unknown direction string: "${direction}"`);
console.error(`Unknown direction definition: "${direction}"`);
return false;
}
return direction as VideoScrollDirection;
});
}).filter((d) => Boolean(d)) as VideoScrollDirection[];
console.debug(`[SVG/VIDEOSCROLLS] Fetching ${filesURL}...`);
const fileFetch = await fetch(`content/${filesURL}`);

View File

@ -1,5 +1,5 @@
<template>
<div class="video-scroll" ref="root">
<div class="video-scroll" ref="root" v-if="definition.directions.length > 0">
<img class="visible displayed loaded"
:src="definition.files[0]"
:style="{
@ -93,9 +93,11 @@ export default defineComponent({
}
});
});
Array.from((this.$refs.root as Element).children).forEach((el) => {
observer.observe(el);
});
if (this.$refs.root){
Array.from((this.$refs.root as Element).children).forEach((el) => {
observer.observe(el);
});
}
}
});