Centre raster images inside floats
Add an x offset to VerticalItem::Image and use it when placing a decoded image in a float, so a 0.4\textwidth plot is centred while its caption remains centred across the float. Other image uses keep x=0. Test count stays 1074.
This commit is contained in:
1 parent
bbedf7676c
commit
aa2f3cb0af
4 files changed
+12
-4
No files matched your search
@@ -13744,6 +13744,7 @@ fn build_document_with_labels(
|
||||
image_height = (natural_height as f64 * scale).round() as i64;
|
||||
}
|
||||
content.push(VerticalItem::Image {
|
||||
x: ((width - image_width) / 2).max(0),
|
||||
width: image_width.max(1),
|
||||
height: image_height.max(1),
|
||||
image: image.clone(),
|
||||
@@ -15482,6 +15483,7 @@ mod source_tests {
|
||||
width,
|
||||
height,
|
||||
image,
|
||||
..
|
||||
} => Some((*width, *height, image.clone())),
|
||||
_ => None,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user