Jazz
Jazz

Reputation: 5917

touchmove event not always triggered on Chrome for Android

I am trying to make this map work on a touchscreen (WebGL must be enabled).

With Firefox on Android it works fine. But with Chrome, initially, if I touch the screen it works, but if I release the screen and touch it again quickly (less than 1 or 2 seconds after I released the screen), no touchmoveevent is triggered. If I wait long enough, I receive the touchmoveevent correctly.

Here is some relevant code (sorry, I cannot provide the complete source code):

canvas.on('touchstart', function() {
    //init drag
    e.preventDefault();
    return false;
});
canvas.on('touchmove', function() {
    //move the map
    e.preventDefault();
    return false;
});
canvas.on('touchend', function() {
    //stop drag
    e.preventDefault();
    return false;
});

I tried with and without preventDefaultor return false, with no success. What did I miss ?

You can reproduce this issue with Chrome for Android, enabling WebGL first (go to chrome://flags and enable WebGL), here or here for a more beautiful view.

Upvotes: 2

Views: 2720

Answers (1)

adriendenat
adriendenat

Reputation: 3485

It feels like your app is blocking on touchEnd. The touchmove works again right after the address bar is updated why new coordinates. Could it be something wrong with the window.location.replace ? I experienced a similar blocking on a website using hardware accelerated features during a window.location.replace.

Upvotes: 3

Related Questions