diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | include/BodyItem.hpp | 2 | ||||
-rw-r--r-- | src/Body.cpp | 17 |
3 files changed, 22 insertions, 3 deletions
@@ -29,9 +29,9 @@ If you are running arch linux then you can install QuickMedia from aur (https:// ### Executables `curl` ### Fonts -`noto-fonts` (when `QM_USE_SYSTEM_FONTS` is not set to `1`) +`noto-fonts` (when `use_system_fonts` config is not set to `true`) ### Optional -`noto-fonts-cjk` needs to be installed to view chinese, japanese and korean characters (when `QM_USE_SYSTEM_FONTS` is not set to `1`).\ +`noto-fonts-cjk` needs to be installed to view chinese, japanese and korean characters (when `use_system_fonts` config is not set to `true`).\ `mpv` needs to be installed to play videos.\ `youtube-dl` needs to be installed to play/download xxx videos.\ `notify-send` (which is part of `libnotify`) needs to be installed to show notifications (on Linux and other systems that uses d-bus notification system).\ @@ -39,7 +39,7 @@ If you are running arch linux then you can install QuickMedia from aur (https:// `waifu2x-ncnn-vulkan` needs to be installed when using the `--upscale-images` or `--upscale-images-always` option.\ `xdg-utils` which provides `xdg-open` needs to be installed when downloading torrents with `nyaa.si` plugin.\ `ffmpeg (and ffprobe which is included in ffmpeg)` needs to be installed to display webp thumbnails, to upload videos with thumbnails on matrix or to merge video and audio when downloading youtube videos.\ -`fc-match` (which is part of `fontconfig`) needs to be installed when `QM_USE_SYSTEM_FONTS` is set to `1`. +`fc-match` (which is part of `fontconfig`) needs to be installed when `use_system_fonts` config is set to `true`. ## Controls ### General control Type text and then wait and QuickMedia will automatically search.\ diff --git a/include/BodyItem.hpp b/include/BodyItem.hpp index 1d967b5..e2f4918 100644 --- a/include/BodyItem.hpp +++ b/include/BodyItem.hpp @@ -145,6 +145,8 @@ namespace QuickMedia { std::string post_number; void *userdata; // Not managed, should be deallocated by whoever sets this float loaded_height = 0.0f; + float height = 0.0f; + float prev_height = 0.0f; sf::Vector2f loaded_image_size; float loaded_content_height = 0.0f; FetchStatus embedded_item_status = FetchStatus::NONE; diff --git a/src/Body.cpp b/src/Body.cpp index 10e31dd..45ca190 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -1050,6 +1050,8 @@ namespace QuickMedia { prev_body_item = items[prev_index].get(); } + const float pos_y_before = pos.y; + const bool merge_with_previous = body_item_merge_handler && body_item_merge_handler(prev_body_item, item.get()); if(attach_side == AttachSide::TOP && merge_with_previous) pos.y -= body_spacing[body_theme].spacing_y; @@ -1124,10 +1126,25 @@ namespace QuickMedia { if(attach_side == AttachSide::BOTTOM && merge_with_previous) pos.y += body_spacing[body_theme].spacing_y; + const float pos_y_after = pos.y; + item->height = std::abs(pos_y_after - pos_y_before); + const float height_diff = item->height - item->prev_height; + item->prev_height = item->height; + if(attach_side == AttachSide::TOP) { + if(index < selected_item) { + page_scroll -= height_diff; + pos.y -= height_diff; + } + prev_body_item = item.get(); index = get_next_visible_item(index); } else { + if(index > selected_item) { + page_scroll += height_diff; + pos.y += height_diff; + } + index = prev_index; } } |