From 64df00fa138d380cffda29591bebebc348b3350b Mon Sep 17 00:00:00 2001 From: jkol Date: Mon, 14 Jul 2014 18:23:11 -0500 Subject: [PATCH] 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. --- lib/mixins/images.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mixins/images.coffee b/lib/mixins/images.coffee index 5ef0ad9..f23becc 100644 --- a/lib/mixins/images.coffee +++ b/lib/mixins/images.coffee @@ -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