diff options
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r-- | src/SearchBar.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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) { |