safely ignore unknown directions

This commit is contained in:
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,10 +93,12 @@ export default defineComponent({
}
});
});
if (this.$refs.root){
Array.from((this.$refs.root as Element).children).forEach((el) => {
observer.observe(el);
});
}
}
});
export enum VideoScrollDirection {