Fix window sizing issue
This commit is contained in:
parent
3e056bf00c
commit
977a1f355e
|
@ -31,6 +31,9 @@ drawCells xs size =
|
||||||
-- | Draw a grid of a displayable space given the window size and cell color.
|
-- | Draw a grid of a displayable space given the window size and cell color.
|
||||||
drawGrid :: forall f. DisplayableSpace f => (Int, Int) -> Color -> f Bool -> Picture
|
drawGrid :: forall f. DisplayableSpace f => (Int, Int) -> Color -> f Bool -> Picture
|
||||||
drawGrid (w, h) c xs =
|
drawGrid (w, h) c xs =
|
||||||
let size = fromIntegral $ if w > h then h `div` sizey @f else w `div` sizex @f
|
let size =
|
||||||
in translate (fromIntegral $ -w `div` 2) (fromIntegral $ -h `div` 2) $
|
if w < h
|
||||||
color c $ pictures $ drawCells xs size
|
then fromIntegral w / fromIntegral (sizex @f)
|
||||||
|
else fromIntegral h / fromIntegral (sizey @f)
|
||||||
|
in translate (-fromIntegral w / 2) (-fromIntegral h / 2) $
|
||||||
|
color c $ pictures $ drawCells xs size
|
Loading…
Reference in a new issue