From 9d0e46e2d6e100ba0f58d87bae91ae7cb530d392 Mon Sep 17 00:00:00 2001 From: marcigo36 Date: Mon, 19 Oct 2020 22:00:41 +0200 Subject: [PATCH] 'fitrows': Last row item should always fit The last item in a row sometimes does not fit due to floating point inaccuracies. Related issue: https://github.com/metafizzy/isotope/issues/1563 --- js/layout-modes/fit-rows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/layout-modes/fit-rows.js b/js/layout-modes/fit-rows.js index 8278b470..da6e97bd 100644 --- a/js/layout-modes/fit-rows.js +++ b/js/layout-modes/fit-rows.js @@ -42,7 +42,7 @@ proto._getItemLayoutPosition = function( item ) { var itemWidth = item.size.outerWidth + this.gutter; // if this element cannot fit in the current row var containerWidth = this.isotope.size.innerWidth + this.gutter; - if ( this.x !== 0 && itemWidth + this.x > containerWidth ) { + if ( this.x !== 0 && itemWidth + this.x > containerWidth + 0.001 /*to prevent last item not fitting in some cases*/ ) { this.x = 0; this.y = this.maxY; }