2Elm.Native.Mouse.make = function(elm) {
4 elm.Native = elm.Native || {};
5 elm.Native.Mouse = elm.Native.Mouse || {};
6 if (elm.Native.Mouse.values) return elm.Native.Mouse.values;
8 var Signal = Elm.Signal.make(elm);
9 var Utils = Elm.Native.Utils.make(elm);
11 var position = Signal.constant(Utils.Tuple2(0,0));
12 position.defaultNumberOfKids = 2;
14 // do not move x and y into Elm. By setting their default number
15 // of kids, it is possible to detatch the mouse listeners if
16 // they are not needed.
17 var x = A2( Signal.lift, function(p){return p._0}, position);
18 x.defaultNumberOfKids = 0;
19 var y = A2( Signal.lift, function(p){return p._1}, position);
20 y.defaultNumberOfKids = 0;
22 var isDown = Signal.constant(false);
23 var clicks = Signal.constant(Utils.Tuple0);
25 var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;
27 elm.addListener([clicks.id], node, 'click', function click() {
28 elm.notify(clicks.id, Utils.Tuple0);
30 elm.addListener([isDown.id], node, 'mousedown', function down() {
31 elm.notify(isDown.id, true);
33 elm.addListener([isDown.id], node, 'mouseup', function up() {
34 elm.notify(isDown.id, false);
36 elm.addListener([position.id], node, 'mousemove', function move(e) {
37 elm.notify(position.id, Utils.getXY(e));
40 return elm.Native.Mouse.values = {
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list