@@ -7,7 +7,7 @@ Elm.Native.Touch.make = function(elm) {
8 var Signal = Elm.Signal.make(elm);
8 var Signal = Elm.Signal.make(elm);
9 var JS = Elm.JavaScript.make(elm);
9 var JS = Elm.JavaScript.make(elm);
10− var _ = Elm.Native.Utils.make(elm);
10+ var Utils = Elm.Native.Utils.make(elm);
12 function Dict() {
12 function Dict() {
13 this.keys = [];
13 this.keys = [];
@@ -43,10 +43,11 @@ Elm.Native.Touch.make = function(elm) {
44 function touch(t) {
44 function touch(t) {
45 var r = dict.lookup(t.identifier);
45 var r = dict.lookup(t.identifier);
46+ var point = Utils.getXY(t);
46 return {_ : {},
47 return {_ : {},
47 id: t.identifier,
48 id: t.identifier,
48− x : t.pageX - elm.node.offsetX,
49+ x : point._0,
49− y : t.pageY - elm.node.offsetY,
50+ y : point._1,
@@ -56,9 +57,10 @@ Elm.Native.Touch.make = function(elm) {
56 var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;
57 var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;
58 function start(e) {
59 function start(e) {
60+ var point = Utils.getXY(e);
59 dict.insert(e.identifier,
61 dict.insert(e.identifier,
60− {x: e.pageX - elm.node.offsetX,
62+ {x: point._0,
61− y: e.pageY - elm.node.offsetY,
63+ y: point._1,
62 t: Date.now()});
64 t: Date.now()});
64 function end(e) {
66 function end(e) {
@@ -88,10 +90,11 @@ Elm.Native.Touch.make = function(elm) {
89 var mouseID = -1;
91 var mouseID = -1;
90 function move(e) {
92 function move(e) {
93+ var point = Utils.getXY(e);
91 for (var i = root.value.length; i--; ) {
94 for (var i = root.value.length; i--; ) {
92 if (root.value[i].id === mouseID) {
95 if (root.value[i].id === mouseID) {
93− root.value[i].x = e.pageX - elm.node.offsetX;
96+ root.value[i].x = point._0;
94− root.value[i].y = e.pageY - elm.node.offsetY;
97+ root.value[i].y = point._1;
95 elm.notify(root.id, root.value);
98 elm.notify(root.id, root.value);