Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Description :
Defines functions to make sure we render the coordinate system in svg correctly, i.e. with the origin in the bottom-left instead of top-left.
Synopsis
- data Canvas r = Canvas (Vector 2 Int) (Point 2 r) r
- center :: Lens' (Canvas r) (Point 2 r)
- dimensions :: Lens' (Canvas r) (Vector 2 Int)
- zoomLevel :: Lens' (Canvas r) r
- createCanvas :: Num r => Int -> Int -> Canvas r
- renderCanvas :: RealFrac r => Canvas r -> [Attribute] -> Svg -> Svg
- text_ :: Real r => Point 2 r -> [Attribute] -> Text -> Svg
- realWorldCoordinates :: Fractional r => Canvas r -> Point 2 Int -> Point 2 r
- toAValue :: Show a => a -> AttributeValue
- toPValue :: Real r => r -> AttributeValue
- showP :: Real a => a -> Pico
Documentation
Svg Canvas that has a "proper" Coordinate system whose origin is in the bottom left.
To be used instead of the text_ combinator in Blaze
realWorldCoordinates :: Fractional r => Canvas r -> Point 2 Int -> Point 2 r Source #
Computes the mouse position in terms of real world coordinates. pre: the coordinates given lie on the canvas
toAValue :: Show a => a -> AttributeValue Source #
toPValue :: Real r => r -> AttributeValue Source #