| License | BSD3-style (see the file LICENSE) |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Flow.Utils.Dom
Description
Port of utils/dom.ts from @xyflow/system. These functions need a
live DOM, so unlike the rest of Miso.Flow.Utils they run in IO
(call them from update effects, not from view).
Synopsis
- getDimensions :: DOMRef -> IO Dimensions
- getBoundingRect :: DOMRef -> IO Rect
- getHostForElement :: DOMRef -> IO JSVal
- isInputDOMNode :: JSVal -> IO Bool
- isMouseEvent :: JSVal -> IO Bool
- getEventPosition :: JSVal -> Maybe Rect -> IO XYPosition
- data PointerPosition = PointerPosition {}
- getPointerPosition :: JSVal -> Transform -> Bool -> Maybe SnapGrid -> Maybe Rect -> IO PointerPosition
- getHandleBounds :: HandleType -> DOMRef -> Rect -> Double -> NodeId -> IO (Maybe [Handle])
Documentation
getDimensions :: DOMRef -> IO Dimensions Source #
offsetWidth / offsetHeight of an element.
getHostForElement :: DOMRef -> IO JSVal Source #
Root node (document or shadow root) hosting the element.
isInputDOMNode :: JSVal -> IO Bool Source #
True when the (keyboard) event targets an input-like element or an
element inside .nokey.
getEventPosition :: JSVal -> Maybe Rect -> IO XYPosition Source #
Client position of a mouse or touch event, optionally relative to the given bounds.
data PointerPosition Source #
Pointer position in flow coordinates, with the snapped variant used to skip no-movement drag events.
Constructors
| PointerPosition | |
Fields
| |
Instances
| Show PointerPosition Source # | |
Defined in Miso.Flow.Utils.Dom Methods showsPrec :: Int -> PointerPosition -> ShowS # show :: PointerPosition -> String # showList :: [PointerPosition] -> ShowS # | |
| Eq PointerPosition Source # | |
Defined in Miso.Flow.Utils.Dom Methods (==) :: PointerPosition -> PointerPosition -> Bool # (/=) :: PointerPosition -> PointerPosition -> Bool # | |