This repository has been archived by the owner on Oct 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"use strict"; | ||
|
||
exports.identifier = function (t) { | ||
return t.identifier; | ||
}; | ||
|
||
exports.screenX = function (t) { | ||
return t.screenX; | ||
}; | ||
|
||
exports.screenY = function (t) { | ||
return t.screenY; | ||
}; | ||
|
||
exports.clientX = function (t) { | ||
return t.clientX; | ||
}; | ||
|
||
exports.clientY = function (t) { | ||
return t.clientY; | ||
}; | ||
|
||
exports.pageX = function (t) { | ||
return t.pageX; | ||
}; | ||
|
||
exports.pageY = function (t) { | ||
return t.pageY; | ||
}; | ||
|
||
exports.target = function (t) { | ||
return t.target; | ||
}; | ||
|
||
exports.length = function (l) { | ||
return l.length; | ||
}; | ||
|
||
exports._item = function (i) { | ||
return function(l) { | ||
return l.item(i); | ||
}; | ||
}; | ||
|
||
exports.touches = function (e) { | ||
return e.touches; | ||
}; | ||
|
||
exports.targetTouches = function (e) { | ||
return e.targetTouches; | ||
}; | ||
|
||
exports.changedTouches = function (e) { | ||
return e.changedTouches; | ||
}; | ||
|
||
exports.altKey = function (e) { | ||
return e.altKey; | ||
}; | ||
|
||
exports.metaKey = function (e) { | ||
return e.metaKey; | ||
}; | ||
|
||
exports.ctrlKey = function (e) { | ||
return e.ctrlKey; | ||
}; | ||
|
||
exports.shiftKey = function (e) { | ||
return e.shiftKey; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
module DOM.Event.TouchEvent | ||
( module T | ||
, Touch | ||
, TouchList | ||
, eventToTouchEvent | ||
, screenX | ||
, screenY | ||
, clientX | ||
, clientY | ||
, pageX | ||
, pageY | ||
, target | ||
, length | ||
, item | ||
, touches | ||
, targetTouches | ||
, changedTouches | ||
, altKey | ||
, metaKey | ||
, ctrlKey | ||
, shiftKey | ||
) where | ||
|
||
import Prelude | ||
import DOM.Event.Types (Event, EventTarget, TouchEvent, readTouchEvent) | ||
import DOM.Event.Types (TouchEvent, touchEventToEvent, readTouchEvent) as T | ||
import Data.Foreign (F, toForeign) | ||
import Data.Maybe (Maybe) | ||
import Data.Nullable (Nullable, toMaybe) | ||
|
||
foreign import data Touch :: Type | ||
|
||
foreign import identifier :: Touch -> Int | ||
|
||
foreign import screenX :: Touch -> Int | ||
|
||
foreign import screenY :: Touch -> Int | ||
|
||
foreign import clientX :: Touch -> Int | ||
|
||
foreign import clientY :: Touch -> Int | ||
|
||
foreign import pageX :: Touch -> Int | ||
|
||
foreign import pageY :: Touch -> Int | ||
|
||
foreign import target :: Touch -> EventTarget | ||
|
||
|
||
foreign import data TouchList :: Type | ||
|
||
foreign import length :: TouchList -> Int | ||
|
||
foreign import _item :: Int -> TouchList -> Nullable Touch | ||
|
||
item :: Int -> TouchList -> Maybe Touch | ||
item i = toMaybe <<< _item i | ||
|
||
eventToTouchEvent :: Event -> F TouchEvent | ||
eventToTouchEvent = readTouchEvent <<< toForeign | ||
|
||
foreign import touches :: TouchEvent -> TouchList | ||
|
||
foreign import targetTouches :: TouchEvent -> TouchList | ||
|
||
foreign import changedTouches :: TouchEvent -> TouchList | ||
|
||
foreign import altKey :: TouchEvent -> Boolean | ||
|
||
foreign import metaKey :: TouchEvent -> Boolean | ||
|
||
foreign import ctrlKey :: TouchEvent -> Boolean | ||
|
||
foreign import shiftKey :: TouchEvent -> Boolean |