diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-17 17:09:19 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-17 17:09:19 +0100 |
| commit | 89f2e71852e96062ea9b756bf92fbf4e894871b1 (patch) | |
| tree | 836099ebd17adf30a24fc62464dfdd3d9c248480 /src/library/image.rs | |
| parent | 9a800daa82833c57eee04e92c701ca9a05a67d3b (diff) | |
Align node
Diffstat (limited to 'src/library/image.rs')
| -rw-r--r-- | src/library/image.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/image.rs b/src/library/image.rs index ea9a050c..ea4f775c 100644 --- a/src/library/image.rs +++ b/src/library/image.rs @@ -54,9 +54,9 @@ impl Layout for ImageNode { let canvas = if expand.x && expand.y { current } else if expand.x || (wide && current.w.is_finite()) { - Size::new(current.w, current.w.safe_div(pixel_ratio)) + Size::new(current.w, current.h.min(current.w.safe_div(pixel_ratio))) } else if current.h.is_finite() { - Size::new(current.h * pixel_ratio, current.h) + Size::new(current.w.min(current.h * pixel_ratio), current.h) } else { Size::new(Length::pt(pixel_w), Length::pt(pixel_h)) }; |
