Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17749] iOS: Map cannot pan / zoom after applying camera

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-10-14T15:20:53.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.4.2, Release 3.5.0, Release 4.0.0
ComponentsiOS
LabelsTCSupportTriage, camera, ios, map, module_map, pan, qe-manualtest, supportTeam, zoom
ReporterEd
AssigneeJon Alter
Created2014-09-12T07:14:09.000+0000
Updated2014-11-26T05:02:47.000+0000

Description

Problem Description

After a map view is loaded, and a camera is applied to the map one cannot pan or zoom on the map (touch is lost). The view get's "locked" in position. Removing the camera by applying a pitch of zero, does not restore it. The sample code below shows this problem. To test; Load the code. Pan and zoom the map. Then tap the "3D Camera ON" button to apply the camera. Now when you try to pan or zoom, is not possible. Tap the button again to set pitch to 0 and restore the map. Pan and zoom still don't work. I should note that the click event is also lost as well if you have any annotations on the map.

Steps to reproduce

1. CReate a new mobile project (classic titanium) 2. Add this to app.js app.js:
Titanium.UI.setBackgroundColor('#fff');

var camOn = false;

var Map = require('ti.map');

var win = Titanium.UI.createWindow();

var map = Map.createView({
	 mapType: Map.NORMAL_TYPE
	,animate: false
	,regionFit: true
	,pitchEnabled: true
	,showsBuildings: true
	,showsPointsOfInterest: true
	,rotateEnabled: true
	,region: {
		latitude: 51.507222, 
		longitude:  -0.1275,
		latitudeDelta: 0.01, 
		longitudeDelta: 0.01
	 }
	,userLocation: false
});

var bCam = Ti.UI.createButton({
	title: '3D Camera ON',
	color: '#000',
	backgroundColor: '#cdcdcd',
	width: 150,
	bottom: 30
});

bCam.addEventListener('click', function(e) {
	
	var cam = Map.createCamera({
	    altitude: 2000, 
	    centerCoordinate: {
	        latitude: 51.507222,
	        longitude: -0.1275
	    }, 
	    heading: 0,
	    pitch: (camOn ? 0 : 60)
	});
	
	map.animateCamera({
		camera: cam,
		curve: Ti.UI.ANIMATION_CURVE_EASE_IN,
		duration: 500
	});
	
	camOn = !camOn;
	
	bCam.title = (camOn ? '3D Camera OFF' : '3D Camera ON');
	
});


win.add(map);
win.add(bCam);
win.open();
3. Run it in a device

Comments

  1. Jon Alter 2014-10-13

    This is also broken with ti.map v2.0.4 so not a regression with the current v2.0.5
  2. Jon Alter 2014-10-13

    PR master: https://github.com/appcelerator-modules/ti.map/pull/64 PR stable: https://github.com/appcelerator-modules/ti.map/pull/65 Need PRs for titanium_mobile after these are merged
  3. Muhammad Dadu 2014-10-13

    Tested on iOS 8 and iOS 7.1 simulators. Map can pan / zoom after applying camera. Tested using the example code and the code in this ticket.
  4. Jon Alter 2014-10-14

    titanium_mobile PR master: https://github.com/appcelerator/titanium_mobile/pull/6214 PR 3_4_X: https://github.com/appcelerator/titanium_mobile/pull/6215 titanium_releases updated master: https://github.com/appcelerator/titanium_releases/commit/70500f9d2292d539f40b915cafbc267774575361 updated 3_4_X: https://github.com/appcelerator/titanium_releases/commit/1d768577b64804590914061cb140ee2bada29c0c
  5. Kajenthiran Velummaylum 2014-11-26

    Verified the fix. Closing the ticket Test Environment: Titanium SDK: 3.5.0.v20141125154115 Appc-Studio: 3.4.1 GA Titanium CLI: 3.4.1 GA Alloy : 1.5.1 GA Xcode : 6.1 OS: OSX 10.10.1 Device : iPhone 6plus (iOS 8.1)

JSON Source