From 485609a3e42696a12e750bce3e43287f26c185f3 Mon Sep 17 00:00:00 2001 From: p11 Date: Mon, 21 Apr 2025 11:04:32 +0200 Subject: [PATCH] Put the text box and the scene into the same selection parent --- src/vn.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/vn.rs b/src/vn.rs index a2cafae..82a2a33 100644 --- a/src/vn.rs +++ b/src/vn.rs @@ -41,15 +41,13 @@ fn generate_html(scenes: Vec, sections: Vec) -> Markup { div #story-container { div .scene-viewport { @for (index, (scene, section)) in (scenes.iter().zip(sections)).enumerate() { - article .scene-section + section .selection-section data-section-index=(index) style=(format!("display: {};", if index == 0 { "block" } else { "none" })) { - (scene) - } + article .scene-section { + (scene) + } - section .text-section - data-section-index=(index) - style=(format!("display: {};", if index == 0 { "block" } else { "none" })) { (section) } } @@ -129,8 +127,6 @@ fn global_styles() -> Markup { height: 100%; display: none; aspect-ratio: 16/9; - } - .scene-section[style*='block'] { display: flex !important; align-items: center; justify-content: center; @@ -261,10 +257,7 @@ fn interactive_script(total_scenes: usize) -> Markup { const totalScenes = {total_scenes}; function updateSection() {{ - document.querySelectorAll('.text-section').forEach((el, index) => {{ - el.style.display = index === currentScene ? 'block' : 'none'; - }}); - document.querySelectorAll('.scene-section').forEach((el, index) => {{ + document.querySelectorAll('.selection-section').forEach((el, index) => {{ el.style.display = index === currentScene ? 'block' : 'none'; }}); document.getElementById('section-counter').textContent =