From 6ef5bdd5a7fcffefae9add37e6a62124e0a36461 Mon Sep 17 00:00:00 2001 From: Kajakske Date: Mon, 21 Sep 2015 14:58:52 +0200 Subject: [PATCH] rounding errors cause empty white space If the total available size is not dividable between the desired amount of columns, you possibly get empty space. Example: Available width: 20px Desired cols: 3. Each col width: 6.66px, current code rounds it to 7px. 7px x 3 cols cuases the last block to jump to a new line. Flooring the width results in 3 x 6px cols. --- src/mason.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mason.coffee b/src/mason.coffee index 2f042a5..732bcc9 100644 --- a/src/mason.coffee +++ b/src/mason.coffee @@ -136,12 +136,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Set the element block height # - elements.block.height = Math.round(parseFloat(($self.width() / columnSize()) / settings.ratio)).toFixed(2) + elements.block.height = Math.floor(parseFloat(($self.width() / columnSize()) / settings.ratio)).toFixed(2) # # Set the element block width # - elements.block.width = Math.round(parseFloat(($self.width() / columnSize()))).toFixed(2) + elements.block.width = Math.floor(parseFloat(($self.width() / columnSize()))).toFixed(2) # # Set Start Width