From 64031f60c13742f68d165d1d9b4ff78a57c5e402 Mon Sep 17 00:00:00 2001 From: wabbit Date: Thu, 28 Jun 2012 14:46:16 +0300 Subject: [PATCH] Added the 'Align' feature to the image fit option. now when you set an image to fit inside a container, you can make it center or right align (left is default, so needs no aligning) --- lib/mixins/images.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mixins/images.coffee b/lib/mixins/images.coffee index 7137f32..418f8a7 100644 --- a/lib/mixins/images.coffee +++ b/lib/mixins/images.coffee @@ -49,6 +49,12 @@ module.exports = else h = bh w = bh * ip + + if options.align + if 'center' == options.align + x = x + bw / 2 - w / 2 + else if 'right' == options.align + x = x + bw - w # Set the current y position to below the image if it is in the document flow @y += h if @y is y