From 94adc85f78edf65a632b3d783ef93424edbf91fe Mon Sep 17 00:00:00 2001 From: Randall Britten Date: Thu, 26 Feb 2015 01:08:44 +1300 Subject: [PATCH] Convert Double to Int to get past compile error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of error was: `src/Engine.hs:87:5:` Couldn't match type ‘Double’ with ‘Int’ Expected type: IO (Int, Int) Actual type: IO (Double, Double) `elementGetOffsetLeft` "returns" a Double. Note that docs [1] say it's units are pixels, so Int should suffice. Note: once compiled, game is broken: card dragging does not seem to be working. --- webkit-sodium/src/Engine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webkit-sodium/src/Engine.hs b/webkit-sodium/src/Engine.hs index d1ab173..da873db 100644 --- a/webkit-sodium/src/Engine.hs +++ b/webkit-sodium/src/Engine.hs @@ -94,7 +94,7 @@ elementPageXY doc elt = do ox <- elementGetOffsetLeft elt oy <- elementGetOffsetTop elt Just parent <- elementGetOffsetParent elt - traverse body parent (x + ox, y + oy) + traverse body parent (x + truncate ox, y + truncate oy) -- The game logic expects alternating down-up-down-up, but the browser can produce -- bad sequences like down-up-down-down-up. So we sanitize the input.