aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-21 03:33:59 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-21 03:33:59 +0200
commit0f151afa58c1f725a652eaa4444ce3e2b2509770 (patch)
tree376bb535a376678891ae635d62e60382f33ff9da
parent26614c66d4b57d857457fff8278fd8c1cb04d690 (diff)
Proper top alignment
-rw-r--r--src/QuickMedia.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index e213f94..79f1f74 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1234,8 +1234,16 @@ namespace QuickMedia {
void Program::page_loop_render(sf::RenderWindow &window, std::vector<Tab> &tabs, int selected_tab, TabAssociatedData &tab_associated_data, const Json::Value *json_chapters, Tabs &ui_tabs) {
if(tabs[selected_tab].search_bar) tabs[selected_tab].search_bar->draw(window, false);
+ float shade_extra_height = 0.0f;
+ if(!tabs[selected_tab].search_bar) {
+ shade_extra_height = std::floor(10.0f * get_ui_scale());
+ sf::RectangleShape shade_top(sf::Vector2f(window_size.x, shade_extra_height));
+ shade_top.setFillColor(sf::Color(33, 37, 44));
+ window.draw(shade_top);
+ }
+
float tab_vertical_offset = tabs[selected_tab].search_bar ? tabs[selected_tab].search_bar->getBottomWithoutShadow() : 0.0f;
- ui_tabs.draw(window, sf::Vector2f(0.0f, tab_vertical_offset), window_size.x);
+ ui_tabs.draw(window, sf::Vector2f(0.0f, tab_vertical_offset + shade_extra_height), window_size.x);
tabs[selected_tab].body->draw(window, body_pos, body_size, *json_chapters);
if(tab_associated_data.fetching_next_page_running)