mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Added "valign" option to image "fit" scaling
valign can be set to "center" or "bottom" now and when "valign" === "center" is combined with "align" === "center" any aspect ratio image can be centered into a bounding area.
This commit is contained in:
parent
6b0846c68f
commit
64df00fa13
@ -56,6 +56,10 @@ module.exports =
|
||||
x = x + bw / 2 - w / 2
|
||||
else if options.align is 'right'
|
||||
x = x + bw - w
|
||||
if options.valign is 'center'
|
||||
y = y + bh / 2 - h / 2
|
||||
else if options.valign is 'bottom'
|
||||
y = y + bh - h
|
||||
|
||||
# Set the current y position to below the image if it is in the document flow
|
||||
@y += h if @y is y
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user