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