diff --git a/webapp/index.html b/webapp/index.html index 2d6e1dc..2e69712 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -1131,7 +1131,8 @@ function init() {
Klicke auf einen Themenknoten oder eine Episode.
`; buildFilters(); - buildGraph(); + // Wait for DOM to render the SVG element before building the graph + requestAnimationFrame(() => { requestAnimationFrame(() => { buildGraph(); }); }); Search.init(); } @@ -1169,8 +1170,13 @@ function filterStaffel(id) { function buildGraph() { const svg = d3.select('#svg'); const container = document.getElementById('mindmap'); - const W = container.clientWidth || window.innerWidth; - const H = container.clientHeight || window.innerHeight * 0.45; + let W = container.clientWidth; + let H = container.clientHeight; + // Fallback if container not yet laid out + if (!W || W < 100) W = window.innerWidth - 400; + if (!H || H < 100) H = window.innerHeight - 52; + if (W < 200) W = 600; + if (H < 200) H = 400; const isMobile = W < 600; const sc = isMobile ? 0.6 : 1;