Fix to X.L.Grid as per issue #223; it will no longer calculate more columns than there are windows.

This commit is contained in:
L.S. Leary
2018-03-03 08:29:52 +13:00
committed by L. S. Leary
parent 9fcea6cb55
commit 90e54a9abb
2 changed files with 6 additions and 1 deletions

View File

@@ -56,7 +56,7 @@ arrange :: Double -> Rectangle -> [a] -> [(a, Rectangle)]
arrange aspectRatio (Rectangle rx ry rw rh) st = zip st rectangles
where
nwins = length st
ncols = max 1 . round . sqrt $ fromIntegral nwins * fromIntegral rw / (fromIntegral rh * aspectRatio)
ncols = max 1 . min nwins . round . sqrt $ fromIntegral nwins * fromIntegral rw / (fromIntegral rh * aspectRatio)
mincs = max 1 $ nwins `div` ncols
extrs = nwins - ncols * mincs
chop :: Int -> Dimension -> [(Position, Dimension)]