Improved image display

This commit is contained in:
p11 2025-04-18 21:19:08 +02:00
parent 995b946dcb
commit 8d9da220d5

View File

@ -141,12 +141,16 @@ pub fn render_novel(
let html = html! { let html = html! {
div id="story-container" { div id="story-container" {
div class="textbox-container" { div class="textbox-container" {
div class="scene-container" {
@for (index, scene) in scenes.iter().enumerate() { @for (index, scene) in scenes.iter().enumerate() {
div class="scene-section" data-section-index=(index) div class="scene-section" data-section-index=(index)
style=(format!("display: {};", if index == 0 { "block" } else { "none" })) { style=(format!("display: {};", if index == 0 { "block" } else { "none" })) {
div class="scene-content" {
(maud::PreEscaped(scene)) (maud::PreEscaped(scene))
} }
} }
}
}
div class="textbox-content" { div class="textbox-content" {
@for (index, section) in sections.iter().enumerate() { @for (index, section) in sections.iter().enumerate() {
@ -219,16 +223,53 @@ pub fn render_novel(
overflow: hidden; overflow: hidden;
} }
.textbox-content { .scene-container {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
display: flex; z-index: 1;
flex-direction: column; }
padding: 1rem;
justify-content: flex-end; .scene-content {
width: 100%;
height: 100%;
position: relative;
}
.scene-section {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
}
.scene-section[style*='block'] {
display: flex !important;
align-items: center;
justify-content: center;
}
.scene-section img {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
}
.textbox-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 2;
background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 30%);
padding: 2rem;
} }
.visual-novel-box { .visual-novel-box {