diff --git a/CHANGELOG.md b/CHANGELOG.md index 522e284..3db6ddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Changed types of width and height from Number to Int. The API guarantees that these values are integers as is, and even silently rounds non-integers if given. New features: - Added `imageSmoothingEnabled` to toggle the image smoothing of a `Context2D`. diff --git a/src/Graphics/Canvas.purs b/src/Graphics/Canvas.purs index 8e55bc4..36bed07 100644 --- a/src/Graphics/Canvas.purs +++ b/src/Graphics/Canvas.purs @@ -172,19 +172,19 @@ getCanvasElementById elId = runFn3 getCanvasElementByIdImpl elId Just Nothing foreign import getContext2D :: CanvasElement -> Effect Context2D -- | Get the canvas width in pixels. -foreign import getCanvasWidth :: CanvasElement -> Effect Number +foreign import getCanvasWidth :: CanvasElement -> Effect Int -- | Get the canvas height in pixels. -foreign import getCanvasHeight :: CanvasElement -> Effect Number +foreign import getCanvasHeight :: CanvasElement -> Effect Int -- | Set the canvas width in pixels. -foreign import setCanvasWidth :: CanvasElement -> Number -> Effect Unit +foreign import setCanvasWidth :: CanvasElement -> Int -> Effect Unit -- | Set the canvas height in pixels. -foreign import setCanvasHeight :: CanvasElement -> Number -> Effect Unit +foreign import setCanvasHeight :: CanvasElement -> Int -> Effect Unit -- | Canvas dimensions (width and height) in pixels. -type Dimensions = { width :: Number, height :: Number } +type Dimensions = { width :: Int, height :: Int } -- | Get the canvas dimensions in pixels. getCanvasDimensions :: CanvasElement -> Effect Dimensions