From 2b2cb50f283447c723b300945430acb918cb4b11 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 1 Nov 2024 03:54:28 +0200 Subject: [PATCH] add horizontal margins for picture --- .../browser/window/tab/item/page/content/image.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 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 4fd36541..e9b64bb7 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,6 @@ -use gtk::{gdk_pixbuf::Pixbuf, Picture}; +use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture}; + +const MARGIN: i32 = 6; pub struct Image { gobject: Picture, @@ -7,9 +9,12 @@ pub struct Image { impl Image { // Construct pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self { - Self { - gobject: Picture::for_pixbuf(buffer), - } + let gobject = Picture::for_pixbuf(buffer); + + gobject.set_margin_end(MARGIN); + gobject.set_margin_start(MARGIN); + + Self { gobject } } // Getters