aboutsummaryrefslogtreecommitdiff
path: root/src/SearchBar.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-03-19 12:55:55 +0100
committerdec05eba <dec05eba@protonmail.com>2021-03-19 12:55:55 +0100
commit62bbf0daacdd110509f8166e9a1bf162ecb23138 (patch)
tree15c75254514f47bc6c6f7c4be515a107449050c2 /src/SearchBar.cpp
parentc207201a4a5a47e4ad286ba7371e4176c8ed5056 (diff)
Fix glitching when using fractional scaling
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r--src/SearchBar.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 8232033..26b00a4 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -12,11 +12,11 @@
static const sf::Color text_placeholder_color(255, 255, 255, 100);
static const sf::Color front_color(55, 60, 68);
-static const float background_margin_horizontal = 10.0f + 5.0f * QuickMedia::get_ui_scale();
-static const float PADDING_HORIZONTAL = 25.0f * QuickMedia::get_ui_scale();
-static const float padding_top = 10.0f * QuickMedia::get_ui_scale();
-static const float padding_bottom = 15.0f * QuickMedia::get_ui_scale();
-static const float background_margin_vertical = 4.0f * QuickMedia::get_ui_scale();
+static const float background_margin_horizontal = 10.0f + std::floor(5.0f * QuickMedia::get_ui_scale());
+static const float PADDING_HORIZONTAL = std::floor(25.0f * QuickMedia::get_ui_scale());
+static const float padding_top = std::floor(10.0f * QuickMedia::get_ui_scale());
+static const float padding_bottom = std::floor(15.0f * QuickMedia::get_ui_scale());
+static const float background_margin_vertical = std::floor(4.0f * QuickMedia::get_ui_scale());
namespace QuickMedia {
SearchBar::SearchBar(sf::Texture *plugin_logo, const std::string &placeholder, bool input_masked) :
@@ -27,8 +27,8 @@ namespace QuickMedia {
text_autosearch_delay(0),
autocomplete_search_delay(0),
caret_visible(true),
- text(placeholder, *FontLoader::get_font(FontLoader::FontType::LATIN), 16 * get_ui_scale()),
- autocomplete_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), 16 * get_ui_scale()),
+ text(placeholder, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale())),
+ autocomplete_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale())),
background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10),
placeholder_str(placeholder),
show_placeholder(true),
@@ -152,7 +152,7 @@ namespace QuickMedia {
background.setSize(sf::Vector2f(width, rect_height));
shade.setSize(sf::Vector2f(window_size.x, padding_top + rect_height + padding_bottom));
- caret.setSize(sf::Vector2f(2.0f * get_ui_scale(), text.getCharacterSize() + 2.0f * get_ui_scale()));
+ caret.setSize(sf::Vector2f(std::floor(2.0f * get_ui_scale()), text.getCharacterSize() + std::floor(2.0f * get_ui_scale())));
background_shadow.setSize(sf::Vector2f(window_size.x, 5.0f));
background.setPosition(offset_x, padding_top + vertical_pos);