From 977a1f355e3f1a60774ee7f23b48181f08f78737 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Wed, 29 Dec 2021 20:07:11 -0500 Subject: [PATCH] Fix window sizing issue --- Graphics/Display.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Graphics/Display.hs b/Graphics/Display.hs index 8a5f6a3..3e853cd 100644 --- a/Graphics/Display.hs +++ b/Graphics/Display.hs @@ -31,6 +31,9 @@ drawCells xs size = -- | 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 (w, h) c xs = - let size = fromIntegral $ if w > h then h `div` sizey @f else w `div` sizex @f - in translate (fromIntegral $ -w `div` 2) (fromIntegral $ -h `div` 2) $ - color c $ pictures $ drawCells xs size \ No newline at end of file + let size = + if w < h + 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 \ No newline at end of file