{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.WheelEvent
(newWheelEvent, initWebKitWheelEvent, pattern DOM_DELTA_PIXEL,
pattern DOM_DELTA_LINE, pattern DOM_DELTA_PAGE, getDeltaX,
getDeltaY, getDeltaZ, getDeltaMode, getWheelDeltaX, getWheelDeltaY,
getWheelDelta, getWebkitDirectionInvertedFromDevice,
WheelEvent(..), gTypeWheelEvent)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newWheelEvent ::
(MonadDOM m, ToJSString type') =>
type' -> Maybe WheelEventInit -> m WheelEvent
newWheelEvent type' eventInitDict
= liftDOM
(WheelEvent <$>
new (jsg "WheelEvent") [toJSVal type', toJSVal eventInitDict])
initWebKitWheelEvent ::
(MonadDOM m) =>
WheelEvent ->
Maybe Int ->
Maybe Int ->
Maybe Window ->
Maybe Int ->
Maybe Int ->
Maybe Int -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> m ()
initWebKitWheelEvent self wheelDeltaX wheelDeltaY view screenX
screenY clientX clientY ctrlKey altKey shiftKey metaKey
= liftDOM
(void
(self ^. jsf "initWebKitWheelEvent"
[toJSVal wheelDeltaX, toJSVal wheelDeltaY, toJSVal view,
toJSVal screenX, toJSVal screenY, toJSVal clientX, toJSVal clientY,
toJSVal ctrlKey, toJSVal altKey, toJSVal shiftKey,
toJSVal metaKey]))
pattern DOM_DELTA_PIXEL = 0
pattern DOM_DELTA_LINE = 1
pattern DOM_DELTA_PAGE = 2
getDeltaX :: (MonadDOM m) => WheelEvent -> m Double
getDeltaX self = liftDOM ((self ^. js "deltaX") >>= valToNumber)
getDeltaY :: (MonadDOM m) => WheelEvent -> m Double
getDeltaY self = liftDOM ((self ^. js "deltaY") >>= valToNumber)
getDeltaZ :: (MonadDOM m) => WheelEvent -> m Double
getDeltaZ self = liftDOM ((self ^. js "deltaZ") >>= valToNumber)
getDeltaMode :: (MonadDOM m) => WheelEvent -> m Word
getDeltaMode self
= liftDOM (round <$> ((self ^. js "deltaMode") >>= valToNumber))
getWheelDeltaX :: (MonadDOM m) => WheelEvent -> m Int
getWheelDeltaX self
= liftDOM (round <$> ((self ^. js "wheelDeltaX") >>= valToNumber))
getWheelDeltaY :: (MonadDOM m) => WheelEvent -> m Int
getWheelDeltaY self
= liftDOM (round <$> ((self ^. js "wheelDeltaY") >>= valToNumber))
getWheelDelta :: (MonadDOM m) => WheelEvent -> m Int
getWheelDelta self
= liftDOM (round <$> ((self ^. js "wheelDelta") >>= valToNumber))
getWebkitDirectionInvertedFromDevice ::
(MonadDOM m) => WheelEvent -> m Bool
getWebkitDirectionInvertedFromDevice self
= liftDOM
((self ^. js "webkitDirectionInvertedFromDevice") >>= valToBool)