diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-12-02 12:28:19 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-12-02 12:28:19 +0100 |
commit | c15aa4decf523b81d87925942642507fe7d02848 (patch) | |
tree | 0320be675b43a53dcc378dd3140237efc8b272cd /src | |
parent | 55287c0f48db741f93f1be122c6eb12e48ba995c (diff) |
Better layout for different font scale
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 2 | ||||
-rw-r--r-- | src/Entry.cpp | 4 | ||||
-rw-r--r-- | src/SearchBar.cpp | 10 | ||||
-rw-r--r-- | src/plugins/NyaaSi.cpp | 22 |
4 files changed, 19 insertions, 19 deletions
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<const char*, 10> 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<const char*, 10> sort_params = { |