on master help sign in
Merge pull request #254 from jsl/convert_touch_docs
9ed6420Evan Czaplicki
libraries/Touch.elm+23−12
@@ -1,24 +1,35 @@
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
1module Touch where
4
2
3+{-| This is an early version of the touch library. It will likely grow to
4+include gestures that would be useful for both games and web-pages.
5+
6+# Touches
7+@docs touches
8+
9+# Gestures
10+@docs taps
11+-}
12+
5import Signal (Signal)
13import Signal (Signal)
6import Native.Touch
14import Native.Touch
7import Time (Time)
15import Time (Time)
8
16
17+{-|
9−-- Every `Touch` has `xy` coordinates. It also has an identifier `id` to
18+Every `Touch` has `xy` coordinates. It also has an identifier `id` to
10−-- distinguish one touch from another.
19+distinguish one touch from another.
11−--
20+
12−-- A touch also keeps info about the intial point and time of contact:
21+A touch also keeps info about the initial point and time of contact:
13−-- `x0`, `y0`, and `t0`. This helps compute more complicated gestures
22+`x0`, `y0`, and `t0`. This helps compute more complicated gestures
14−-- like taps, drags, and swipes which need to know about timing or direction.
23+like taps, drags, and swipes which need to know about timing or direction.
15type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
24type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
25+-}
16
26
17−-- A list of ongoing touches.
27+{-| A list of ongoing touches. -}
18touches : Signal [Touch]
28touches : Signal [Touch]
19touches = Native.Touch.touches
29touches = Native.Touch.touches
20
30
21−-- The last position that was tapped. Default value is `{x=0,y=0}`.
31+{-| The last position that was tapped. Default value is `{x=0,y=0}`.
22−-- Updates whenever the user taps the screen.
32+Updates whenever the user taps the screen.
33+-}
23taps : Signal { x:Int, y:Int }
34taps : Signal { x:Int, y:Int }
24−taps = Native.Touch.taps
35+taps = Native.Touch.taps