Use a canvas for the text boxes
This commit is contained in:
parent
191ffa7d57
commit
a3cb04f213
40
src/main.rs
40
src/main.rs
@ -614,19 +614,23 @@ fn handle_relative_connection(
|
|||||||
|
|
||||||
let html = html! {
|
let html = html! {
|
||||||
div id="story-container" {
|
div id="story-container" {
|
||||||
|
div class="textbox-container" {
|
||||||
|
div class="textbox-content" {
|
||||||
|
@for (index, section) in sections.iter().enumerate() {
|
||||||
|
div class="story-section" data-section-index=(index)
|
||||||
|
style=(format!("display: {};", if index == 0 { "block" } else { "none" })) {
|
||||||
|
(maud::PreEscaped(section))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
div class="nav-controls" {
|
div class="nav-controls" {
|
||||||
button class="nav-button" onclick="prev()" { "←" }
|
button class="nav-button" onclick="prev()" { "←" }
|
||||||
span id="section-counter" { "1/" (sections.len()) }
|
span id="section-counter" { "1/" (sections.len()) }
|
||||||
button class="nav-button" onclick="next()" { "→" }
|
button class="nav-button" onclick="next()" { "→" }
|
||||||
}
|
}
|
||||||
|
|
||||||
@for (index, section) in sections.iter().enumerate() {
|
|
||||||
div class="story-section" data-section-index=(index)
|
|
||||||
style=(format!("display: {};", if index == 0 { "block" } else { "none" })) {
|
|
||||||
(maud::PreEscaped(section))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
style {
|
style {
|
||||||
(maud::PreEscaped(r"
|
(maud::PreEscaped(r"
|
||||||
.nav-controls {
|
.nav-controls {
|
||||||
@ -671,6 +675,28 @@ fn handle_relative_connection(
|
|||||||
.nav-button:active {
|
.nav-button:active {
|
||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.textbox-container {
|
||||||
|
width: 75%;
|
||||||
|
margin: 0 auto;
|
||||||
|
position: relative;
|
||||||
|
padding-top: 42.1875%; /* 16:9 Aspect Ratio */
|
||||||
|
background: #f8f8f8;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textbox-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 1rem;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
"))
|
"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user