Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15888] Android: WebView cannot pinch zoom on map

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-04-08T21:21:31.000+0000
Affected Version/sRelease 3.1.3
Fix Version/s2014 Sprint 07, 2014 Sprint 07 SDK, Release 3.3.0
ComponentsAndroid
LabelsSupportTeam, dev-investigate, module_webview, qe-closed-3.3.0, qe-testadded, triage
ReporterStephan Jensen
AssigneeSunila
Created2013-11-21T12:20:08.000+0000
Updated2014-04-28T08:09:18.000+0000

Description

Problem Description

The WebView is unable to zoom in on maps using pinch gestures. The issue seems to go away if the user pinch zooms another part of the page or on a previous page, before pinch zooming the map. Android API level is set to 11 in the tiapp.xml manifest.

Extra info

Example pages where pinch zooming doesn't work: http://leafletjs.com/examples/mobile-example.html https://maps.google.com/ Viewport metatag is being used on the page to correctly scale the html on the device Q&A about the issue: http://developer.appcelerator.com/question/158749/titanium-webview-leafletgmaps-pinch-zoom-not-working-properly

Testcase

var win = Ti.UI.createWindow({
	top: '20dp',
	width: Ti.UI.FILL,
	height: Ti.UI.FILL
});

win.add(Ti.UI.createWebView({
	width: Ti.UI.FILL,
	height: Ti.UI.FILL,
	url: 'http://leafletjs.com/examples/mobile-example.html'
	//url: 'https://maps.google.com'
}));

win.open();

Comments

  1. Stephan Jensen 2013-11-26

    I was looking through the TiMapView source, and the following method caught my attention
               @Override
               protected boolean allowRegisterForTouch()
               {
                       // Skip TiUIView registration. 
                       // Handled inside the LocalMapView as it is not working in the TiUIView
                       return false;
               }
       
    I then created a new module, added a native webview, and added the above method. Pinch zooming seems to be working perfectly after adding the above.
  2. Biju pm 2013-12-16

    The issue cannot reproduce with the release master 3.2.0 Tested with: Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.2.0 Tested on Device: Samsung galaxy s duos Android version: 4.0.4
  3. Stephan Jensen 2013-12-23

    The issue still persists in version 3.2.0.GA Tested with: Titanium Studio, build: 3.2.0.201312191547 Titanium SDK version: 3.2.0.GA Tested on Nexus 5 (4.4.2) Samsung galaxy S4 (4.3) Samsung galaxy S2 (4.2)
  4. Stephan Jensen 2014-02-06

    Any updates on the issue, or have you forgot all about it?
  5. Sunila 2014-02-11

    Use scaleDetector only if PINCH event needs to be handled as it interfere with the WebView pinch zoom. Issue is more visible with google map https://github.com/appcelerator/titanium_mobile/pull/5345
  6. Martin N 2014-03-18

    Is there a workaround for this issue until 3.3.0 is released ?
  7. Pragya Rastogi 2014-04-28

    Verified the fix using: OSX: 10.9.2 Xcode: 5.1.1 Studio - 3.3.0.201404251359 SDK - 3.3.0.v20140425191906 acs-1.0.14 alloy-1.4.0-dev npm-1.3.2 titanium-3.3.0-dev titanium-code-processor-1.1.1-beta1 Device: LG-P970 (4.0.4) As expected Pinch zoom works fine on the map.

JSON Source