aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shaders/rounded_rectangle.glsl2
-rw-r--r--src/Body.cpp14
2 files changed, 5 insertions, 11 deletions
diff --git a/shaders/rounded_rectangle.glsl b/shaders/rounded_rectangle.glsl
index 5af174b..7c797f2 100644
--- a/shaders/rounded_rectangle.glsl
+++ b/shaders/rounded_rectangle.glsl
@@ -21,5 +21,5 @@ void main() {
vec4 front_color = mix(gl_Color, band_color, band_blend.x*band_blend.y);
float shadow_a = 1.0 - smoothstep(0.0, shadow_offset.x, rect_dist);
front_color.a *= a;
- gl_FragColor = mix(front_color, vec4(0.0, 0.0, 0.0, 0.14), shadow_a - a);
+ gl_FragColor = mix(front_color, vec4(0.0, 0.0, 0.0, 0.14), clamp(shadow_a - a, 0.0, 1.0));
} \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index 4ab90f3..67c5c8e 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -735,7 +735,7 @@ namespace QuickMedia {
// TODO: Move up where scroll is limited? then we wont delay this by 1 frame creating a small scroll overflow only in the opposite direction of attach side.
// Also take |selected_scrolled| into consideration
// Limit scroll in the opposide direction of attach side, since the scroll is already limited for the attach side above (with a simple check)
- if(!rendering_card_view) {
+ if(!rendering_card_view && (body_size_changed || is_touch_enabled())) {
if(attach_side == AttachSide::TOP) {
if(top_cut_off && !bottom_cut_off && body_total_height > (size.y - body_spacing[body_theme].body_padding_vertical))
page_scroll = -(body_total_height - (size.y - body_spacing[body_theme].body_padding_vertical));
@@ -1489,12 +1489,10 @@ namespace QuickMedia {
const bool rendering_card_view = card_view && card_view_enabled;
sf::Vector2i content_size = get_item_thumbnail_size(item);
- float image_height = 0.0f;
float text_offset_x = body_spacing[body_theme].padding_x;
if(draw_thumbnails && load_texture && !item->thumbnail_url.empty() && !merge_with_previous) {
std::shared_ptr<ThumbnailData> item_thumbnail = AsyncImageLoader::get_instance().get_thumbnail(item->thumbnail_url, item->thumbnail_is_local, content_size);
content_size = clamp_to_size_x(content_size, sf::Vector2i(width - (rendering_card_view ? 0.0f : body_spacing[body_theme].image_padding_x * 2.0f), content_size.y));
- image_height = content_size.y;
if(item_thumbnail && item_thumbnail->loading_state == LoadingState::FINISHED_LOADING && item_thumbnail->image->getSize().x > 0 && item_thumbnail->image->getSize().y > 0) {
if(!item_thumbnail->texture.loadFromImage(*item_thumbnail->image))
@@ -1509,17 +1507,13 @@ namespace QuickMedia {
auto image_size = item_thumbnail->texture.getSize();
sf::Vector2f image_size_f(image_size.x, image_size.y);
auto new_image_size = clamp_to_size(image_size_f, to_vec2f(content_size));
- image_height = new_image_size.y;
text_offset_x += body_spacing[body_theme].image_padding_x + new_image_size.x;
+ item->loaded_image_height = new_image_size.y;
} else {
text_offset_x += body_spacing[body_theme].image_padding_x + content_size.x;
+ if(item->loaded_image_height < 0.1f)
+ item->loaded_image_height = content_size.y;
}
-
- // TODO: This wont work if the image has changed to a different image (for example if the image is a local image and it has been overwritten).
- if(body_size_changed)
- item->loaded_image_height = image_height;
- else
- item->loaded_image_height = std::max(item->loaded_image_height, image_height);
} else if(item->thumbnail_size.x > 0) {
text_offset_x += body_spacing[body_theme].image_padding_x + content_size.x;
// TODO: Fix. This makes the body item have incorrect position when loading and if the item is merge_with_previous? and has an embedded item