Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12870] mapsv2 Module: Setting "user location" map property to "true" after map creation sometimes requires two clicks on the "locate" button to change to user location

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.0.2
Fix Version/sn/a
ComponentsAndroid
Labelsqe-mapv2
ReporterEric Merriman
AssigneeUnknown
Created2013-02-26T20:06:10.000+0000
Updated2018-02-28T20:04:25.000+0000

Description

While using the map test app, I toggled the "user location" property on an existing map which caused the user location button and the user location indicator to appear on the map. The first click of this button did nothing. The second click took me to the user location.
var win = Ti.UI.createWindow({fullscreen: false, backGroundColor: 'white'});

// make the map 
var map = MapModule.createView({
    mapType: MapModule.NORMAL_TYPE,
    animate:true,
    region: {latitude: 37.389569, longitude: -122.050212, latitudeDelta: 0.2, longitudeDelta: 0.2}
    
});

//make a bunch of control buttons
var button = Ti.UI.createButton({top: 0, left: 0, title: "Normal"});
button.addEventListener('click', function(e) {
		map.setMapType(MapModule.NORMAL_TYPE);
	});

var button1 = Ti.UI.createButton({top: 45, left: 0, title: "Terrain"});
	button1.addEventListener('click', function(e) {
		map.setMapType(MapModule.TERRAIN_TYPE);
	});

// a button to cycle the color of the route
var button2 = Ti.UI.createButton({top: 90, left: 0, title: "Hybrid"});
button2.addEventListener('click', function(e) {
		map.setMapType(MapModule.HYBRID_TYPE);
	});

var button3 = Ti.UI.createButton({top: 135, left: 0, title: "Satellite"});
	button3.addEventListener('click', function(e) {
		map.setMapType(MapModule.SATELLITE_TYPE);		
	});
	
var button4 = Ti.UI.createButton({top: 180, left: 0, title: "Toggle User"});
	button4.addEventListener('click', function(e) {
		map.userLocation=!map.userLocation; 	
	});
	
var button5 = Ti.UI.createButton({top: 225, left: 0, title: "Toggle Animate"});
	button5.addEventListener('click', function(e) {
		map.animate=!map.animate; 	
		Ti.API.info("=====> Animate set to: "+map.animate);
	});

// set variables for location
var location ="mv";

var button6 = Ti.UI.createButton({top: 270, left: 0, title: "Change Location"});
	button6.addEventListener('click', function(){
	if (location==="noida") {
		map.region={latitude: 37.390665, longitude: -122.050210, latitudeDelta: 0.05, longitudeDelta: 0.05 };
		location="mv";
	} else {
		map.region={latitude: 28.605924, longitude: 77.361817, latitudeDelta: 0.05, longitudeDelta: 0.05 };
		location="noida";
	}
});

var button7 = Ti.UI.createButton({top: 315, left: 0, title: "Toggle Traffic"});
	button7.addEventListener('click', function(e) {
		map.traffic=!map.traffic; 
		
	});
	

	
win.add(map);
win.add(button);
win.add(button1);
win.add(button2);
win.add(button3);
win.add(button4);
win.add(button5);
win.add(button6);
win.add(button7);
win.open();
Steps to reproduce: 1) Incorporate test code into your existing app with google maps api v2 key 2) Launch test app 3) If your location is on the map, move to another location 4) Click "toggle user" 5) Click the "User location" target button in the upper-right portion of the screen Result: Nothing happens. A second click will take you to the location. In some cases, the first click will work. Expected: The user location button works on the first click. Note: I expect this may be an unusual use-case, with the more prevalent option being setting the property during map creation.

Comments

No comments

JSON Source