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:
jkol 2014-07-14 18:23:11 -05:00
parent 6b0846c68f
commit 64df00fa13

View File

@ -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