on master help sign in
Expose alt and meta keys, make docs nicer
commit56b54dadc4fe04cf126a2139730c5843a63af691 authorEvan Czaplicki <info@elm-lang.org> dateWed 9 Jul 2014, 14:24 (12 years ago) parent6623419
1 file changed+15−8
libraries/Keyboard.elm+15−8
libraries/Keyboard.elm+15−8
@@ -8,7 +8,10 @@ module Keyboard where
88@docs arrows, wasd, directions
99
1010# Specific Keys
11−@docs shift, enter, space, ctrl
11+The following signals are `True` when the particular key is pressed and `False`
12+otherwise.
13+
14+@docs enter, space, ctrl, shift, alt, meta
1215
1316# General Keypresses
1417@docs isDown, keysDown, lastPressed
@@ -50,19 +53,23 @@ wasd = directions 87 83 65 68
5053isDown : KeyCode -> Signal Bool
5154isDown = Native.Keyboard.isDown
5255
53−{-| Whether the shift key is pressed. -}
56+alt : Signal Bool
57+alt = Native.Keyboard.alt
58+
59+ctrl : Signal Bool
60+ctrl = isDown 17
61+
62+{-| The meta key is the Windows key on Windows and the Command key on Mac.
63+-}
64+meta : Signal Bool
65+meta = Native.Keyboard.meta
66+
5467shift : Signal Bool
5568shift = isDown 16
5669
57−{-| Whether the control key is pressed. -}
58−ctrl : Signal Bool
59−ctrl = isDown 17
60−
61−{-| Whether the space key is pressed. -}
6270space : Signal Bool
6371space = isDown 32
6472
65−{-| Whether the enter key is pressed. -}
6673enter : Signal Bool
6774enter = isDown 13
6875