I would rather try and fix the touchstart than have to add a bunch of gestures in Java on this. This feels like we're taking something away from the Javascript developer, which is a bad thing IMO. This might be cool as a plugin, but I don't know if we should add it as a core feature of Cordova.
On Thu, Apr 18, 2013 at 10:08 AM, jbo...@openmv.com <jbo...@openmv.com> wrote: > On the short them, it would help solve 'Android fragmentation' problems: > https://github.com/android/platform_frameworks_base/blob/android-cts-4.0.3_r2/core/java/android/webkit/WebView.java#L6044 > > https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L5824 > > Android doesn't exactly pass the touchstart etc.. events to webkit the same > way and more importantly with the same delays. Not to mention, some versions > have bugs (missing touchend, touchmove events). > If coding a pure HTML/javascript app, you can avoid the 'native' onTouch() > processing and pass events faster to your app. > > It's an educated guess at the moment, but I'm quite sure performance / > response time for the user on all platforms will be better if the gesture > detection is done on the native side. > > On the long term, I don't see how JavaScript libraries would allow (within > reasonable ms) for more complex 'gesture' detection. I would rather do > something like: > webView.addGesture('swipe'); > webView.addGesture('handgrab'); > onTouch/Gesture: > // do gesture detection in native code > webView.sendJavascript("cordova.fireEvent('handgrab', {node, ...}"); > > > -----Original Message----- > From: Filip Maj [mailto:f...@adobe.com] > Sent: Wednesday, April 17, 2013 12:47 PM > To: dev@cordova.apache.org > Subject: Re: Standardized gestures > > I'm not convinced you need any additional code here. > > Touch events are already fired by the web view containers. You could build up > gesture detection in JavaScript by listening to these events. > > There are libraries out there that do this for you already: > > - http://eightmedia.github.io/hammer.js/ > - http://quojs.tapquo.com/ > - https://github.com/plainview/Jester > - jquery ui plugin: http://touchpunch.furf.com/ > - jquery plugin: http://labs.rampinteractive.co.uk/touchSwipe/demos/ > - moar jquery: https://github.com/HotStudio/touchy > > On 4/17/13 9:42 AM, "jbo...@openmv.com" <jbo...@openmv.com> wrote: > >>I'm experimenting with Cordova on Android, iOS and Windows 8. >> >>Has there been a discussion around trying to implement to set of >>'standard' gesture recognizers: >>http://msdn.microsoft.com/library/windows/apps/BR241937 >>http://developer.apple.com/library/ios/#documentation/EventHandling/Con >>cep >>tual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_b >>asi >>cs.html >>http://developer.android.com/reference/android/view/GestureDetector.htm >>l >> >>The idea would be that the native side executes JavaScript like: >>javascript:cordova.fireEvent('tap', {node: >>document.elementFromPoint(400, 300), x: 400, y:300 }); >>javascript:cordova.fireEvent('slide', {node: >>document.elementFromPoint(400, 300), x: 400, y:300}); >> >>This function could use document.createEvent to initiate events on the >>DOM node: >>https://developer.mozilla.org/en-US/docs/DOM/document.createEvent >> >>The purpose of this would be to have a consistent set of gesture >>recognition across different devices instead of having javascript code >>in the 'WebView' trying to do gesture detection. >> >>Thoughts? >> > > >