diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ImageViewer.hpp | 5 | ||||
-rw-r--r-- | include/Scale.hpp | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/ImageViewer.hpp b/include/ImageViewer.hpp index c29ea13..74d93c1 100644 --- a/include/ImageViewer.hpp +++ b/include/ImageViewer.hpp @@ -29,6 +29,7 @@ namespace QuickMedia { ImageStatus image_status; std::unique_ptr<sf::Image> image; bool visible_on_screen; + float prev_height = 0.0f; }; struct PageSize { @@ -44,7 +45,7 @@ namespace QuickMedia { class ImageViewer { public: - ImageViewer(sf::RenderWindow *window, int num_pages, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir); + ImageViewer(sf::RenderWindow *window, int num_pages, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir, bool *fit_image_to_window); ~ImageViewer(); ImageViewerAction draw(); // Returns page as 1 indexed @@ -95,5 +96,7 @@ namespace QuickMedia { std::thread image_loader_thread; bool loading_image = false; + + bool *fit_image_to_window; }; }
\ No newline at end of file diff --git a/include/Scale.hpp b/include/Scale.hpp index 375ddff..e458894 100644 --- a/include/Scale.hpp +++ b/include/Scale.hpp @@ -33,6 +33,14 @@ namespace QuickMedia { } template<typename T> + static T clamp_to_size_x(const T &size, const T &clamp_size) { + T new_size = size; + if(size.x > clamp_size.x) + new_size = wrap_to_size_x(new_size, clamp_size); + return new_size; + } + + template<typename T> static T clamp_to_size(const T &size, const T &clamp_size) { T new_size = size; if(size.x > clamp_size.x || size.y > clamp_size.y) |