Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data Canvas r
- theViewport :: forall r s f. Functor f => (Viewport r -> f (Viewport s)) -> Canvas r -> f (Canvas s)
- blankCanvas :: Num r => Int -> Int -> Canvas r
- class HasDimensions s a | s -> a where
- dimensions :: Lens' s a
- class HasMousePosition s a | s -> a where
- mousePosition :: Lens' s a
- mouseCoordinates :: Fractional r => Getter (Canvas r) (Maybe (Point 2 r))
- data InternalCanvasAction
- handleInternalCanvasAction :: Canvas r -> InternalCanvasAction -> Effect action (Canvas r)
- withCanvasEvents :: Map MisoString Bool -> Map MisoString Bool
- svgCanvas_ :: (RealFrac r, ToSvgCoordinate r) => Canvas r -> [Attribute action] -> [View action] -> View (Either InternalCanvasAction action)
Documentation
Svg Canvas that has a "proper" Coordinate system whose origin is in the bottom left.
theViewport :: forall r s f. Functor f => (Viewport r -> f (Viewport s)) -> Canvas r -> f (Canvas s) Source #
Lens to access the viewport
blankCanvas :: Num r => Int -> Int -> Canvas r Source #
Crate a blank canvas, that has the origin in the bottom-left.
class HasDimensions s a | s -> a where Source #
Class for types that have a dimensions
field
dimensions :: Lens' s a Source #
Lens to access the Dimensions field
Instances
HasDimensions (Canvas r) (Vector 2 Int) Source # | |
Defined in HGeometry.Miso.Svg.Canvas | |
HasDimensions (StaticCanvas r) (Vector 2 Int) Source # | |
Defined in HGeometry.Miso.Svg.StaticCanvas dimensions :: Lens' (StaticCanvas r) (Vector 2 Int) Source # |
class HasMousePosition s a | s -> a where Source #
Class for types that have a mouse position
mousePosition :: Lens' s a Source #
Lens to access the raw mouse position
mouseCoordinates :: Fractional r => Getter (Canvas r) (Maybe (Point 2 r)) Source #
Getter to access the mouse coordinates (in terms of the coordinate system as used by the canvas). Returns a Nothing if the mouse is not currently on/over the canvas.
data InternalCanvasAction Source #
Actions that CanvasAction will handle itself.
Instances
Show InternalCanvasAction Source # | |
Defined in HGeometry.Miso.Svg.Canvas showsPrec :: Int -> InternalCanvasAction -> ShowS # show :: InternalCanvasAction -> String # showList :: [InternalCanvasAction] -> ShowS # | |
Eq InternalCanvasAction Source # | |
Defined in HGeometry.Miso.Svg.Canvas (==) :: InternalCanvasAction -> InternalCanvasAction -> Bool # (/=) :: InternalCanvasAction -> InternalCanvasAction -> Bool # |
handleInternalCanvasAction :: Canvas r -> InternalCanvasAction -> Effect action (Canvas r) Source #
Handles InternalCanvas Actions
withCanvasEvents :: Map MisoString Bool -> Map MisoString Bool Source #
Events a canvas wants to listen to
svgCanvas_ :: (RealFrac r, ToSvgCoordinate r) => Canvas r -> [Attribute action] -> [View action] -> View (Either InternalCanvasAction action) Source #
Draws the actual canvas using an svg tag