Module
Gesso.Canvas.Element
- Package
- purescript-gesso
- Repository
- smilack/purescript-gesso
Internal helper functions that the Canvas component uses to style and position itself and access the canvas's drawing context.
#Canvas Source
newtype Canvas
Wrapper for a Web.DOM.Element.Element
to tag elements that came from this
module.
#getCanvasByAppName Source
getCanvasByAppName :: String -> Effect (Maybe Canvas)
Wrapper for getElementById
which returns a Canvas
.
getElementById
from Web.DOM.NonElementParentNode
, which returns a
Web.DOM.Element.Element
, is different from getCanvasElementById
from
Graphics.Canvas
, which returns a Graphics.Canvas.CanvasElement
, so
they're unfortunately incompatible.
#getCanvasClientRect Source
getCanvasClientRect :: Canvas -> Effect Rect
Get the bounding client rect for a Canvas
element and convert it to a
ClientRect
value.
#getContextByAppName Source
getContextByAppName :: String -> Effect (Maybe Context2D)
Attempt to get the Context2D
for this component's canvas
element.