naturalatlas/image-layout

Calculating the needed rows with weight

metalmatze opened this issue · 0 comments

Sometimes images are 2x higher than the idealElementHeight.
I don't really like the fact, because some images are really too big and pixelated.

I've been looking into the source and found the calculation for the number of needed rows.
https://github.com/naturalatlas/image-layout/blob/master/layouts/fixed-partition.js#L43

I've played with the calculation by changing it to:

var rowsNeeded = Math.round(summedWidth / containerWidth * 0.75)

Images can't now be that big anymore and they can be a little smaller, but that's perfect.

It could be an addition to the option object that defaults to 1.
I'm just not sure how to name it, weight seems to broad.

Thanks.