From c15aa4decf523b81d87925942642507fe7d02848 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Dec 2022 12:28:19 +0100 Subject: Better layout for different font scale --- depends/mglpp | 2 +- src/Body.cpp | 2 +- src/Entry.cpp | 4 ++-- src/SearchBar.cpp | 10 +++++----- src/plugins/NyaaSi.cpp | 22 +++++++++++----------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/depends/mglpp b/depends/mglpp index 0108af4..e72c8d1 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 0108af496da089dbee70ce80d778dfb5c238460b +Subproject commit e72c8d1bbd0d74dcf4a4832d0352f5f8211fc343 diff --git a/src/Body.cpp b/src/Body.cpp index 5384050..505db2b 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -1677,7 +1677,7 @@ namespace QuickMedia { } if(reaction.text) { - reaction.text->set_position(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, 0.0f)); + reaction.text->set_position(mgl::vec2f(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, -(float)reaction.text->get_character_size()*0.18f)).floor()); } if(draw && reaction.text) { diff --git a/src/Entry.cpp b/src/Entry.cpp index 8357216..7e664c3 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -109,8 +109,8 @@ namespace QuickMedia { void Entry::set_position(const mgl::vec2f &pos) { background.set_position(pos); - text.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - text.get_character_size() * 0.3f).floor()); - placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - text.get_character_size() * 0.005f).floor()); + text.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - (float)text.get_character_size() * 0.3f).floor()); + placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - (float)text.get_character_size() * 0.005f).floor()); } void Entry::set_max_width(float width) { diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp index 4d5cbef..00a66d2 100644 --- a/src/SearchBar.cpp +++ b/src/SearchBar.cpp @@ -15,12 +15,11 @@ namespace QuickMedia { return (int)v; } - static const float background_margin_horizontal = floor(5.0f * get_config().scale + 10.0f * get_config().spacing_scale); static const float padding_top_default = floor(10.0f * get_config().scale * get_config().spacing_scale); static const float padding_bottom_default = floor(15.0f * get_config().scale * get_config().spacing_scale); static const float background_margin_vertical = floor(4.0f * get_config().scale * get_config().spacing_scale); static const int character_size = get_config().search.font_size * get_config().scale * get_config().font_scale; - static const int search_icon_padding_x = 10 * get_config().scale; + static const int search_icon_padding_x = 7 * get_config().scale * get_config().font_scale; SearchBar::SearchBar(mgl::Texture *plugin_logo, mgl::Shader *rounded_rectangle_shader, const std::string &placeholder, SearchBarType type) : onTextUpdateCallback(nullptr), @@ -197,14 +196,15 @@ namespace QuickMedia { background.set_position(mgl::vec2f(pos.x + offset_x, pos.y + padding_top)); shade.set_position(pos); - mgl::vec2f text_position(pos.x + offset_x + background_margin_horizontal + search_padding + search_padding, pos.y + padding_top + rect_height * 0.5f - character_size * 0.7f); - text.set_position(text_position.floor()); - placeholder_text.set_position(text_position.floor()); mgl::vec2f texture_size = search_icon_sprite.get_texture()->get_size().to_vec2f(); mgl::vec2f new_size = wrap_to_size_y(texture_size, character_size); search_icon_sprite.set_scale(get_ratio(texture_size, new_size)); search_icon_sprite.set_position(background.get_position() + mgl::vec2f(search_padding, background.get_size().y * 0.5f - new_size.y * 0.5f).floor()); + + mgl::vec2f text_position(search_icon_sprite.get_position().x + search_icon_sprite.get_size().x + search_padding, pos.y + padding_top + rect_height * 0.5f - character_size * 0.7f); + text.set_position(text_position.floor()); + placeholder_text.set_position(text_position.floor()); } void SearchBar::onTextEntered(const mgl::Event::TextEvent &text_event) { diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp index 705d961..cd80997 100644 --- a/src/plugins/NyaaSi.cpp +++ b/src/plugins/NyaaSi.cpp @@ -101,17 +101,17 @@ namespace QuickMedia { } static const std::array sort_type_names = { - "Size desc 🡇", - "Uploaded date desc 🡇", - "Seeders desc 🡇", - "Leechers desc 🡇", - "Downloads desc 🡇", - - "Size asc 🡅", - "Uploaded date asc 🡅", - "Seeders asc 🡅", - "Leechers asc 🡅", - "Downloads asc 🡅" + "Size desc ⬇️", + "Uploaded date desc ⬇️", + "Seeders desc ⬇️", + "Leechers desc ⬇️", + "Downloads desc ⬇️", + + "Size asc ⬆️", + "Uploaded date asc ⬆️", + "Seeders asc ⬆️", + "Leechers asc ⬆️", + "Downloads asc ⬆️" }; static const std::array sort_params = { -- cgit v1.2.3