diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-03 01:04:17 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-03 01:04:17 +0200 |
commit | 59295d52e65deaba992df55c5fe2ad4f52fa3046 (patch) | |
tree | 150f12d5d480923e45431186edd80d908757d9ab | |
parent | 704b996effe104df07d3f3abd14fe5d1a48ba1fa (diff) |
Do not floor position images, smoother scroll
-rw-r--r-- | src/ImageViewer.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp index fcf9519..b567e1b 100644 --- a/src/ImageViewer.cpp +++ b/src/ImageViewer.cpp @@ -36,7 +36,7 @@ namespace QuickMedia { const sf::Vector2<double> image_size = get_page_size(page); std::unique_ptr<ImageData> &page_image_data = image_data[page]; - sf::Vector2<double> render_pos(std::floor(window_size.x * 0.5 - image_size.x * 0.5), std::floor(- image_size.y * 0.5 + scroll + offset_y)); + sf::Vector2<double> render_pos(window_size.x * 0.5 - image_size.x * 0.5, - image_size.y * 0.5 + scroll + offset_y); if(render_pos.y + image_size.y <= 0.0 || render_pos.y >= window_size.y) { if(page_image_data) page_image_data->visible_on_screen = false; @@ -54,7 +54,7 @@ namespace QuickMedia { sf::Text error_message("Failed to load image for page " + std::to_string(1 + page), *font, 30); auto text_bounds = error_message.getLocalBounds(); error_message.setFillColor(sf::Color::Black); - sf::Vector2<double> render_pos_text(std::floor(window_size.x * 0.5 - text_bounds.width * 0.5), std::floor(- text_bounds.height * 0.5 + scroll + offset_y)); + sf::Vector2<double> render_pos_text(window_size.x * 0.5 - text_bounds.width * 0.5, - text_bounds.height * 0.5 + scroll + offset_y); sf::RectangleShape background(sf::Vector2f(image_size.x, image_size.y)); background.setFillColor(sf::Color::White); @@ -73,7 +73,7 @@ namespace QuickMedia { sf::Text error_message("Downloading page " + page_str, *font, 30); auto text_bounds = error_message.getLocalBounds(); error_message.setFillColor(sf::Color::Black); - sf::Vector2<double> render_pos_text(std::floor(window_size.x * 0.5 - text_bounds.width * 0.5), std::floor(- text_bounds.height * 0.5 + scroll + offset_y)); + sf::Vector2<double> render_pos_text(window_size.x * 0.5 - text_bounds.width * 0.5, - text_bounds.height * 0.5 + scroll + offset_y); sf::RectangleShape background(sf::Vector2f(image_size.x, image_size.y)); background.setFillColor(sf::Color::White); diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 3c98f12..c0180d8 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -1,5 +1,4 @@ #include "../../plugins/Youtube.hpp" -#include <quickmedia/HtmlSearch.h> #include <json/reader.h> #include <string.h> |