Skip to content

Commit

Permalink
Fix image resize to account for margins
Browse files Browse the repository at this point in the history
  • Loading branch information
zapek committed Dec 30, 2024
1 parent 2e53009 commit 69035be
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 69035be

Please sign in to comment.