Closed mark-bradshaw closed 10 years ago
BTW, I've noticed similar open issues on other swipe capable javascript libraries...
For instance, I also tried Zepto to see if it was broken. It was. Here's someone else reporting a similar issue on Zepto (https://github.com/madrobby/zepto/issues/823). I'll be reporting there as well.
I finally started developing my web app I've been planning on for a long time. And I decided to go with LungoJS and QuoJS. But I can't get the swiping to work. I have a Nexus 4, Nexus 5, Nexus 7(2012) and Nexus 7(2013), all running Android 4.4. The tapping works on all of them, but it's impossible to get the swiping to work.
I really hope this is able to fix, because now I don't know what to do. I don't have enough skills to be digging in the QuoJS-code, and I can't contribute to this project either.
Really hope that someone will find the problem and be able to fix it!
One possible solution here: https://code.google.com/p/android/issues/detail?id=19827
Based on that info, for my android device I "fixed" the problem with two things. First I patched the _onTouchMove function. About mid-way down is this:
if (is_swipe) {
GESTURE.prevSwipe = true;
}
I changed that to:
if (is_swipe) {
GESTURE.prevSwipe = true;
event.preventDefault();
}
But on my Nexus 4 is_swipe was never getting set to true. The horizontal swipe distance was a bit too high under the current webview. I went down to the next function, _isSwipe, and changed the horizontal swipe distance check from 30 down to 10. 15 seemed to be right on the edge of too high, but 10 seemed fine. Once quo detected a swipe the preventdefault kicked in ans we were happy again.
I can't speak for all the other gestures still being good. I'm afraid I don't have time to thoroughly test for you and track down the problem, but this is what works for me.
I'm using the latest version and swipe is still broken on Android 4.4
Fixed for different pixel densities and kitkat cancel/end confusion: quo.gestures.swipe.js change
GAP = 20;
// toGAP = window.devicePixelRatio >= 2 ? 15 : 20;
// and changeend = function(target, data) { if (_last) { _check(false); return _last = null; } };
// tocancel = end = function(target, data) { if (_last) { _check(false); return _last = null; } };
http://developer.android.com/guide/webapps/migrating.html#TouchCancel
FIXED :)
I updated my test device, a Nexus 4, to Android 4.4 and suddenly my Quo based swiping events in two Cordova based apps are no longer working. But this doesn't appear to be a cordova issue.
I have duplicated the basic setup on a CodePen for your review at http://cdpn.io/ncDfv. In my mac chrome browser I get the normal swipe events. On IOS devices I get the normal swipe events. I don't have an older android device to test on, but the swipe events all used to work fine. But on Android 4.4, no.
I did some digging inside Quo and when I start swiping I get a touchstart event, and then a touchmove event. Sometimes if I'm lucky I get a second touchmove. And then nothing. I don't get a touchend.
If you look at the codepen it's a VERY simple setup. I don't think I've screwed anything up. I'm pulling quo 2.3.1 on the codepen (http://cdpn.io/ncDfv), but in my local testing I've also pulled latest from git. I have tried the 3.0 branch.