Skip to main content
Tweeted twitter.com/StackSalesforce/status/1085144718319726593
Question Protected by CommunityBot
added 4 characters in body
Source Link
Tushar Sharma
  • 29.7k
  • 7
  • 38
  • 60

In the past I did access coordinates from touch events like this

myCompElement.addEventListener("touchstart", function(event) {
    var touchObj = event.changedTouches[0];
    var startX = parseInt(touchObj.clientX);
});

but the LockerService prevents accessing event.touchesevent.touches and event.changedTouchesevent.changedTouches on any touch event object.

Is there any workaround accessing coordinates from touch events? What is the recommended way by Salesforce doing this?

In the past I did access coordinates from touch events like this

myCompElement.addEventListener("touchstart", function(event) {
    var touchObj = event.changedTouches[0];
    var startX = parseInt(touchObj.clientX);
});

but the LockerService prevents accessing event.touches and event.changedTouches on any touch event object.

Is there any workaround accessing coordinates from touch events? What is the recommended way by Salesforce doing this?

In the past I did access coordinates from touch events like this

myCompElement.addEventListener("touchstart", function(event) {
    var touchObj = event.changedTouches[0];
    var startX = parseInt(touchObj.clientX);
});

but the LockerService prevents accessing event.touches and event.changedTouches on any touch event object.

Is there any workaround accessing coordinates from touch events? What is the recommended way by Salesforce doing this?

Source Link

LockerService, touch events and coordinates

In the past I did access coordinates from touch events like this

myCompElement.addEventListener("touchstart", function(event) {
    var touchObj = event.changedTouches[0];
    var startX = parseInt(touchObj.clientX);
});

but the LockerService prevents accessing event.touches and event.changedTouches on any touch event object.

Is there any workaround accessing coordinates from touch events? What is the recommended way by Salesforce doing this?