From 7adfa8c19f71c5a919d52081d57bcfa69f33aba8 Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Tue, 27 May 2014 20:03:41 +0900 Subject: [PATCH] Touch events mostly fixed. --- .../components/stf/screen/screen-directive.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index 89c2ab91..6013bf34 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -28,9 +28,20 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo function sendTouch(type, e) { var x = e.offsetX || e.layerX || 0 - , y = e.offsetY || e.layerY || 0 - , r = scope.device.display.orientation - , scaled = scaler.coords(boundingWidth, boundingHeight, x, y, r) + var y = e.offsetY || e.layerY || 0 + var r = scope.device.display.orientation + + if (BrowserInfo.touch) { + if (e.touches && e.touches.length) { + x = e.touches[0].pageX + y = e.touches[0].pageY + } else if (e.changedTouches && e.changedTouches.length) { + x = e.changedTouches[0].pageX + y = e.changedTouches[0].pageY + } + } + + var scaled = scaler.coords(boundingWidth, boundingHeight, x, y, r) finger[0].style[cssTransform] = 'translate3d(' + x + 'px,' + y + 'px,0)'