Put the text box and the scene into the same selection parent

This commit is contained in:
p11 2025-04-21 11:04:32 +02:00
parent 631812abdf
commit 485609a3e4

View File

@ -41,15 +41,13 @@ fn generate_html(scenes: Vec<Markup>, sections: Vec<Markup>) -> 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" })) {
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 =