From 69035be4c8d45029600683141f6b17796b22598c Mon Sep 17 00:00:00 2001 From: David Gerber Date: Mon, 30 Dec 2024 18:30:25 +0100 Subject: [PATCH] Fix image resize to account for margins --- .../java/io/xeres/ui/support/contentline/ContentImage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/main/java/io/xeres/ui/support/contentline/ContentImage.java b/ui/src/main/java/io/xeres/ui/support/contentline/ContentImage.java index 7ba8783c..cb24475d 100644 --- a/ui/src/main/java/io/xeres/ui/support/contentline/ContentImage.java +++ b/ui/src/main/java/io/xeres/ui/support/contentline/ContentImage.java @@ -105,7 +105,9 @@ public ContentImage(Image image, Region parent) if (parent != null) { - node.fitWidthProperty().bind(parent.widthProperty()); + parent.widthProperty().addListener((observable, oldValue, newValue) -> { + node.setFitWidth(newValue.doubleValue() - 24); // 12 margins + }); node.setPreserveRatio(true); node.setOnMouseClicked(ContentImage::view); }