on c19ccfe help sign in
elk/libraries/Touch.elm
20 lines 789 B history raw
1-- This is an early version of the touch library. It will likely grow to
2-- include gestures that would be useful for both games and web-pages.
3module Touch where
5import Native.Touch as T
7-- Every `Touch` has `xy` coordinates. It also has an identifier `id` to
8-- distinguish one touch from another.
9--
10-- A touch also keeps info about the intial point and time of contact:
11-- `x0`, `y0`, and `t0`. This helps compute more complicated gestures
12-- like taps, drags, and swipes which need to know about timing or direction.
13type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
15-- A list of ongoing touches.
16touches : Signal [Touch]
18-- The last position that was tapped. Default value is `{x=0,y=0}`.
19-- Updates whenever the user taps the screen.
20taps : Signal { x:Int, y:Int }