Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: dev alpha
My Carrier: Vodacom

WebView Control ignoring pinch gestures in javascript

Hi,

 

I have a webview that has javascript and html that responds to gestures. All the gestures work perfectly in the BB10 browser but for some strange reason the pinch gestures don't work in my apps webview. Swipe gestures work fine. This is driving me crazy as I'm close to finishing my app and this is very irritating. Any advice or sugestions would be greatly apprecitated.

 

example web page with pinch gestures:http://riagora.com/mobile/hammer/

 

basic test app qml:

import bb.cascades 1.0

Page {
    WebView {
        id: webView
        url: "http://riagora.com/mobile/hammer/"
    }
}

 

New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: dev alpha
My Carrier: Vodacom

Re: WebView Control ignoring pinch gestures in javascript

It actually appears that the webview control might not support multitouch. Is there a way to enable multitouch?

Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: WebView Control ignoring pinch gestures in javascript

Is your webview inside of a ScrollView?

 

This page has documentation on how to use pinch gestures in a webview, with a scrollview. I believe a scrollview is required for pinch to zoom.

 

https://developer.blackberry.com/cascades/documentation/ui/webview/loadinghtml.html

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: dev alpha
My Carrier: Vodacom

Re: WebView Control ignoring pinch gestures in javascript

Thanks for your response. I don't want to zoom. I want to manipulate my html objects with a pinch gesture using javascript.
New Contributor
Posts: 9
Registered: ‎02-28-2013
My Device: BB10
My Carrier: None

Re: WebView Control ignoring pinch gestures in javascript

Any further word on this, I'm also interested in performing certain gestures in Javascript but they don't seem to be coming through from the webview

Developer
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10
My Carrier: Rogers

Re: WebView Control ignoring pinch gestures in javascript

[ Edited ]

Curious, did you try adding a Pinchhandler?

https://developer.blackberry.com/cascades/reference/bb__cascades__pinchhandler.html

 

--Edit--

You don't have to call the pinchToZoom feature.. Just add a PinchHandler to the ScrollView..  Or at least that's what the description states in the link that Brennan provided... And just manipulate stuff with the PinchHandler properties from within Javascript..

New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: dev alpha
My Carrier: Vodacom

Re: WebView Control ignoring pinch gestures in javascript

I had to make a very ugly hack to get this to work but in the end it actually worked pretty well. I added a pinch gesture handler to the webview. In the pinch handlers event methods I made calls to my javascript using the "evaluateJavaScript" method of the webview and passed in the pinch event coords parameters.

New Contributor
Posts: 9
Registered: ‎02-28-2013
My Device: BB10
My Carrier: None

Re: WebView Control ignoring pinch gestures in javascript

Heh that's kind of what I was thinking I might need to do. Not a major issue for my application but nice work around