fade-in window transition + faded bg overlay

This commit is contained in:
thecozies 2024-01-08 09:42:21 -06:00
parent 5ee7eaed1f
commit f2ea206d15
4 changed files with 20 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,7 @@ $base-height: 1080;
bottom: 0; bottom: 0;
left: 0; left: 0;
padding: space($page-margin); padding: space($page-margin);
background-color: $color-border-soft;
} }
.centered-page__modal { .centered-page__modal {

View File

@ -14,6 +14,16 @@ body
font-family: $font-stack; font-family: $font-stack;
} }
.rmlui-window {
opacity: 1;
transition: opacity 0.1s quadratic-in-out;
&--hidden {
opacity: 0;
transition: none;
}
}
*, *:before, *:after { *, *:before, *:after {
box-sizing: border-box; box-sizing: border-box;
} }

View File

@ -650,6 +650,10 @@ struct {
void swap_document(recomp::Menu menu) { void swap_document(recomp::Menu menu) {
if (current_document != nullptr) { if (current_document != nullptr) {
Rml::Element* window_el = current_document->GetElementById("window");
if (window_el != nullptr) {
window_el->SetClassNames("rmlui-window rmlui-window--hidden");
}
current_document->Hide(); current_document->Hide();
} }
@ -657,6 +661,10 @@ struct {
if (find_it != documents.end()) { if (find_it != documents.end()) {
assert(find_it->second && "Document for menu not loaded!"); assert(find_it->second && "Document for menu not loaded!");
current_document = find_it->second; current_document = find_it->second;
Rml::Element* window_el = current_document->GetElementById("window");
if (window_el != nullptr) {
window_el->SetClassNames("rmlui-window");
}
current_document->Show(); current_document->Show();
} }
else { else {