aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--src/ImageViewer.cpp32
2 files changed, 26 insertions, 12 deletions
diff --git a/TODO b/TODO
index 69c0f62..a980a66 100644
--- a/TODO
+++ b/TODO
@@ -31,7 +31,9 @@ Scrolling past page causes the page to jump up and down very fast because the ne
Add setting to disable sending typing events to the server (matrix).
Support emoji (mainly for matrix), by readding Text code from dchat. Also do the same but for inline images, text editing and url colors and clicking (also clicking on inline images).
Also take code from dchat to support gifs (inline in text).
-Fix page jumping up/down in image continuous mode when scrolling past images that fail to load / scrolling fast.
Use pixel buffer object for asynchronous texture transfer to gpu? is this necessary?
When pressing backspace to delete text, auto search will kick in because the key repeat delay is longer on the first key. SearchBar should instead check of key press/key release state.
-Set the thumbnail fallback image dimensions to the image dimensions we get from matrix. That means we can know the dimensions of images in matrix before they have finished downloading. This is good for removing popouts in the body. \ No newline at end of file
+Set the thumbnail fallback image dimensions to the image dimensions we get from matrix. That means we can know the dimensions of images in matrix before they have finished downloading. This is good for removing popouts in the body.
+Add hyphen at end of wrapped text if it wrapped at a character.
+Add option to edit input in vim (using temporary file).
+Scrolling in images still messes up the |current| page sometimes, need a way to fix this. \ No newline at end of file
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
index 416f27f..c45e35d 100644
--- a/src/ImageViewer.cpp
+++ b/src/ImageViewer.cpp
@@ -76,6 +76,8 @@ namespace QuickMedia {
}
if(page_image_data) {
+ page_image_data->visible_on_screen = true;
+
if(page_image_data->image_status == ImageStatus::APPLIED_TO_TEXTURE) {
page_image_data->sprite.setPosition(render_pos.x, render_pos.y);
window.draw(page_image_data->sprite);
@@ -255,16 +257,26 @@ namespace QuickMedia {
int page_i = 0;
for(auto &page_data : image_data) {
- if(page_data && page_data->image_status == ImageStatus::LOADED) {
- if(page_data->texture.loadFromImage(*page_data->image)) {
- page_data->sprite.setTexture(page_data->texture, true);
- page_size[page_i].size = get_page_size(page_i);
- page_size[page_i].loaded = true;
- page_data->image_status = ImageStatus::APPLIED_TO_TEXTURE;
- } else {
- page_data->image_status = ImageStatus::FAILED_TO_LOAD;
+ if(page_data) {
+ if(page_data->image_status == ImageStatus::LOADED) {
+ if(page_data->texture.loadFromImage(*page_data->image)) {
+ double height_before = get_page_size(page_i).y;
+ page_data->image_status = ImageStatus::APPLIED_TO_TEXTURE;
+ page_data->sprite.setTexture(page_data->texture, true);
+ page_size[page_i].size = get_page_size(page_i);
+ page_size[page_i].loaded = true;
+ double height_after = page_size[page_i].size.y;
+
+ double height_diff = height_before - height_after;
+ if(scroll_speed <= 0.0 && page_i < current_page) {
+ scroll -= height_diff;
+ }
+ } else {
+ page_data->image_status = ImageStatus::FAILED_TO_LOAD;
+ }
+ page_data->image.reset();
}
- page_data->image.reset();
+ page_data->visible_on_screen = false;
}
++page_i;
}
@@ -345,7 +357,7 @@ namespace QuickMedia {
if(page_size[page].loaded)
return page_size[page].size;
- if(!image_data[page])
+ if(!image_data[page] || image_data[page]->image_status != ImageStatus::APPLIED_TO_TEXTURE)
return no_image_page_size;
sf::Vector2u texture_size = image_data[page]->texture.getSize();