comments, reorganize

This commit is contained in:
Tomáš Mládek 2021-01-10 22:59:50 +01:00
parent b270693868
commit 72ecb5d4c2

View file

@ -45,13 +45,10 @@ export default defineComponent({
const svg = element.appendChild(svgParsed.firstElementChild as Element) as any;
// Set document background
const svgBaseEl = svg.getElementById("base");
if (svgBaseEl) {
const pageColor = svgBaseEl.attributes.getNamedItem("pagecolor");
const pageColor = svg.getElementById("base")?.attributes.getNamedItem("pagecolor");
if (pageColor) {
emit("setBackground", pageColor.value);
}
}
// PanZoom
const pz = createPanZoom(element, {
@ -105,6 +102,7 @@ export default defineComponent({
panToElement(start, false);
}
// Calculate SVG-unit bounding box
pz.on("transform", function (_) {
const transform = pz.getTransform();
const currentRatio = svg.clientWidth * transform.scale / svg.viewBox.baseVal.width;
@ -161,19 +159,18 @@ export default defineComponent({
panToElement(anchor, true);
};
// DEBUG
window.addEventListener("keydown", (ev) => {
if (ev.key !== " ") {
return;
}
panToAnchor.value(anchors.value[0]);
});
// Videoscrolls
scrolls.value = await processScrolls(svg);
// Audio areas
audioAreas.value = processAudio(svg);
// DEBUG
window.addEventListener("keydown", (ev) => {
if (ev.key === " ") {
panToAnchor.value(anchors.value[0]);
}
});
});
return {