{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.Touch
       (getClientX, getClientY, getScreenX, getScreenY, getPageX,
        getPageY, getTarget, getIdentifier, getWebkitRadiusX,
        getWebkitRadiusY, getWebkitRotationAngle, getWebkitForce,
        Touch(..), gTypeTouch)
       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

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.clientX Mozilla Touch.clientX documentation> 
getClientX :: (MonadDOM m) => Touch -> m Int
getClientX :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getClientX Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"clientX") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.clientY Mozilla Touch.clientY documentation> 
getClientY :: (MonadDOM m) => Touch -> m Int
getClientY :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getClientY Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"clientY") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.screenX Mozilla Touch.screenX documentation> 
getScreenX :: (MonadDOM m) => Touch -> m Int
getScreenX :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getScreenX Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"screenX") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.screenY Mozilla Touch.screenY documentation> 
getScreenY :: (MonadDOM m) => Touch -> m Int
getScreenY :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getScreenY Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"screenY") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.pageX Mozilla Touch.pageX documentation> 
getPageX :: (MonadDOM m) => Touch -> m Int
getPageX :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getPageX Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"pageX") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.pageY Mozilla Touch.pageY documentation> 
getPageY :: (MonadDOM m) => Touch -> m Int
getPageY :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getPageY Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"pageY") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.target Mozilla Touch.target documentation> 
getTarget :: (MonadDOM m) => Touch -> m EventTarget
getTarget :: forall (m :: * -> *). MonadDOM m => Touch -> m EventTarget
getTarget Touch
self
  = DOM EventTarget -> m EventTarget
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"target") JSM JSVal -> (JSVal -> DOM EventTarget) -> DOM EventTarget
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM EventTarget
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.identifier Mozilla Touch.identifier documentation> 
getIdentifier :: (MonadDOM m) => Touch -> m Word
getIdentifier :: forall (m :: * -> *). MonadDOM m => Touch -> m Word
getIdentifier Touch
self
  = DOM Word -> m Word
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Word
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Word) -> JSM Double -> DOM Word
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"identifier") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.webkitRadiusX Mozilla Touch.webkitRadiusX documentation> 
getWebkitRadiusX :: (MonadDOM m) => Touch -> m Int
getWebkitRadiusX :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getWebkitRadiusX Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"webkitRadiusX") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.webkitRadiusY Mozilla Touch.webkitRadiusY documentation> 
getWebkitRadiusY :: (MonadDOM m) => Touch -> m Int
getWebkitRadiusY :: forall (m :: * -> *). MonadDOM m => Touch -> m Int
getWebkitRadiusY Touch
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"webkitRadiusY") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.webkitRotationAngle Mozilla Touch.webkitRotationAngle documentation> 
getWebkitRotationAngle :: (MonadDOM m) => Touch -> m Float
getWebkitRotationAngle :: forall (m :: * -> *). MonadDOM m => Touch -> m Float
getWebkitRotationAngle Touch
self
  = DOM Float -> m Float
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Double -> Float) -> JSM Double -> DOM Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"webkitRotationAngle") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.webkitForce Mozilla Touch.webkitForce documentation> 
getWebkitForce :: (MonadDOM m) => Touch -> m Float
getWebkitForce :: forall (m :: * -> *). MonadDOM m => Touch -> m Float
getWebkitForce Touch
self
  = DOM Float -> m Float
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Double -> Float) -> JSM Double -> DOM Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Touch
self Touch -> Getting (JSM JSVal) Touch (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter Touch (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"webkitForce") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))