From 0a506819451a58e764a6331fe5a5f4bec18119ce Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 1 Nov 2024 17:40:50 +0200 Subject: [PATCH] use ContentFit::ScaleDown for picture browser --- src/app/browser/window/tab/item/page/content/image.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content/image.rs b/src/app/browser/window/tab/item/page/content/image.rs index df2bc204..955cdb2f 100644 --- a/src/app/browser/window/tab/item/page/content/image.rs +++ b/src/app/browser/window/tab/item/page/content/image.rs @@ -1,4 +1,4 @@ -use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture}; +use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, ContentFit, Picture}; pub struct Image { gobject: Picture, @@ -7,13 +7,15 @@ pub struct Image { impl Image { // Defaults - const DEFAULT_MARGIN: i32 = 6; + pub const DEFAULT_MARGIN: i32 = 6; + pub const DEFAULT_CONTENT_FIT: ContentFit = ContentFit::ScaleDown; // Constructors pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self { let gobject = Picture::for_pixbuf(buffer); + gobject.set_content_fit(Self::DEFAULT_CONTENT_FIT); gobject.set_margin_end(Self::DEFAULT_MARGIN); gobject.set_margin_start(Self::DEFAULT_MARGIN);