hgeometry:svg
Safe HaskellNone
LanguageGHC2021

HGeometry.Miso.Svg.Canvas

Synopsis

Documentation

data Canvas r Source #

Svg Canvas that has a "proper" Coordinate system whose origin is in the bottom left.

Instances

Instances details
Show r => Show (Canvas r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

Methods

showsPrec :: Int -> Canvas r -> ShowS #

show :: Canvas r -> String #

showList :: [Canvas r] -> ShowS #

Eq r => Eq (Canvas r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

Methods

(==) :: Canvas r -> Canvas r -> Bool #

(/=) :: Canvas r -> Canvas r -> Bool #

HasMousePosition (Canvas r) (Maybe (Point 2 Int)) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

HasDimensions (Canvas r) (Vector 2 Int) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

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

Methods

dimensions :: Lens' s a Source #

Lens to access the Dimensions field

Instances

Instances details
HasDimensions (Canvas r) (Vector 2 Int) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

HasDimensions (StaticCanvas r) (Vector 2 Int) Source # 
Instance details

Defined in HGeometry.Miso.Svg.StaticCanvas

class HasMousePosition s a | s -> a where Source #

Class for types that have a mouse position

Methods

mousePosition :: Lens' s a Source #

Lens to access the raw mouse position

Instances

Instances details
HasMousePosition (Canvas r) (Maybe (Point 2 Int)) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Canvas

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.

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