Reactor.Graphics.CoordinateSystem
- Package
- purescript-grid-reactors
- Repository
- Eugleo/purescript-grid-reactors
This module provies a wrapper that signalizes whether the wrapped contents (usually points in space) should be taken relative to the rendering canvas (i.e. they are in 'pts') or relative to the grid (i.e. they are in 'cells').
#CoordinateSystem Source
#wrt Source
wrt :: forall a b. a -> (a -> CoordinateSystem b) -> CoordinateSystem bWith respect to. Used to wrap things in a coordinate system in a more pleasant way than what would be possible with the constructors. For example
{ x: 1, y: 1 } `wrt` grid == RelativeToGrid { x: toNumber 1, y: toNumber 1}
#canvas Source
canvas :: forall a. a -> CoordinateSystem aTo be used with wrt, usually { some record }wrt` canvas.
#grid Source
grid :: forall a b. HMap (Int -> Number) a b => a -> CoordinateSystem bTo be used with wrt, usually { some record }wrtgrid. Automatically converts
the numbers in{ some record }fromInttoNumber`.
#relativeToGrid Source
relativeToGrid :: forall a b. HMap (Number -> Int) a b => Number -> CoordinateSystem a -> bMostly for internal use.
#withCoords Source
withCoords :: forall a b. CoordinateSystem a -> (a -> b) -> bUnwrap the wrapped thing and pass it to a function.
#moveUp Source
moveUp :: CoordinateSystem Point -> CoordinateSystem PointA simple helper functions that subtracts 1 from the y coordinate.
#moveDown Source
moveDown :: CoordinateSystem Point -> CoordinateSystem PointA simple helper functions that adds 1 to the y coordinate.
#moveLeft Source
moveLeft :: CoordinateSystem Point -> CoordinateSystem PointA simple helper functions that subtracts 1 from the x coordinate.
#moveRight Source
moveRight :: CoordinateSystem Point -> CoordinateSystem PointA simple helper functions that adds 1 to the x coordinate.