@@ -5,12 +5,12 @@ Elm.Native.Mouse = function(elm) {
5 if (elm.Native.Mouse) return elm.Native.Mouse;
5 if (elm.Native.Mouse) return elm.Native.Mouse;
7 var Signal = Elm.Signal(elm);
7 var Signal = Elm.Signal(elm);
8− var Misc = Elm.Native.Misc(elm);
8+ var Utils = Elm.Native.Utils(elm);
10− var position = Signal.constant(Misc.Tuple(0,0));
10+ var position = Signal.constant(Utils.Tuple2(0,0));
11 position.defaultNumberOfKids = 2;
11 position.defaultNumberOfKids = 2;
13− // do not get rid of x and y. By setting their default number
13+ // do not move x and y into Elm. By setting their default number
14 // of kids, it is possible to detatch the mouse listeners if
14 // of kids, it is possible to detatch the mouse listeners if
15 // they are not needed.
15 // they are not needed.
16 var x = A2( Signal.lift, function(p){return p._0}, position);
16 var x = A2( Signal.lift, function(p){return p._0}, position);
@@ -20,7 +20,7 @@ Elm.Native.Mouse = function(elm) {
21 var isDown = Signal.constant(false);
21 var isDown = Signal.constant(false);
22 var isClicked = Signal.constant(false);
22 var isClicked = Signal.constant(false);
23− var clicks = Signal.constant(Misc.Tuple0);
23+ var clicks = Signal.constant(Utils.Tuple0);
25 function getXY(e) {
25 function getXY(e) {
26 var posx = 0;
26 var posx = 0;
@@ -35,36 +35,36 @@ Elm.Native.Mouse = function(elm) {
35 posy = e.clientY + document.body.scrollTop +
35 posy = e.clientY + document.body.scrollTop +
36 document.documentElement.scrollTop;
36 document.documentElement.scrollTop;
38− return Misc.Tuple2(posx, posy);
38+ return Utils.Tuple2(posx, posy);
41 function click(e) {
41 function click(e) {
42 var hasListener1 = elm.notify(isClicked.id, true);
42 var hasListener1 = elm.notify(isClicked.id, true);
43− var hasListener2 = elm.notify(clicks.id, Misc.Tuple0);
43+ var hasListener2 = elm.notify(clicks.id, Utils.Tuple0);
44 elm.notify(isClicked.id, false);
44 elm.notify(isClicked.id, false);
45 if (!hasListener1 && !hasListener2)
45 if (!hasListener1 && !hasListener2)
46− this.removeEventListener('click',arguments.callee,false);
46+ elm.node.removeEventListener('click', click);
49 function down(e) {
49 function down(e) {
50 var hasListener = elm.notify(isDown.id, true);
50 var hasListener = elm.notify(isDown.id, true);
51− if (!hasListener) this.removeEventListener('mousedown',arguments.callee,false);
51+ if (!hasListener) elm.node.removeEventListener('mousedown', down);
54 function up(e) {
54 function up(e) {
55 var hasListener = elm.notify(isDown.id, false);
55 var hasListener = elm.notify(isDown.id, false);
56− if (!hasListener) this.removeEventListener('mouseup',arguments.callee,false);
56+ if (!hasListener) elm.node.removeEventListener('mouseup', up);
59 function move(e) {
59 function move(e) {
60 var hasListener = elm.notify(position.id, getXY(e));
60 var hasListener = elm.notify(position.id, getXY(e));
61− if (!hasListener) this.removeEventListener('mousemove',arguments.callee,false);
61+ if (!hasListener) elm.node.removeEventListener('mousemove', move);
64− Misc.addListener(elm.node, 'click' , click);
64+ elm.node.addEventListener('click' , click);
65− Misc.addListener(elm.node, 'mousedown', down);
65+ elm.node.addEventListener('mousedown', down);
66− Misc.addListener(elm.node, 'mouseup' , up);
66+ elm.node.addEventListener('mouseup' , up);
67− Misc.addListener(elm.node, 'mousemove', move);
67+ elm.node.addEventListener('mousemove', move);
69 return elm.Native.Mouse = {
69 return elm.Native.Mouse = {
70 position: position,
70 position: position,