Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12838] Mapsv2 Module: Map with animate property set to false still animates when changing regions via the user location button

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-02-25T21:58:06.000+0000
Affected Version/sRelease 3.0.2
Fix Version/sRelease 3.1.0, 2013 Sprint 05 API, 2013 Sprint 05
ComponentsAndroid
Labelsapi, qe-mapv2
ReporterEric Merriman
AssigneeHieu Pham
Created2013-02-24T08:48:48.000+0000
Updated2014-06-19T12:44:12.000+0000

Description

When a map is created and the animate property set to false, the initial region set of the map does not animate, but changing the location via the user location button animates regardless of the animate setting.
var win = Ti.UI.createWindow({fullscreen: false, backGroundColor: 'white'});

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

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

var button5 = Ti.UI.createButton({top: 0, left: 0, title: "Toggle Animate"});
	button5.addEventListener('click', function() {
		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: 45, 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";
	}
});


win.add(map);
win.add(button5);
win.add(button6);

win.open();
Steps to reproduce: 1) Use sample code above in your pre-configured app with Google map API v2 key 2) Run the app 3) Click the user location icon in the upper-right of the map Result: Map animates as region changes Expected: No animation during region change

Comments

  1. Hieu Pham 2013-02-25

    That is correct behavior. The user-location button is supported by native Android, hence our 'animate' property would not affect it. According to the documentation, clicking this button will animate to focus on user location: https://developers.google.com/maps/documentation/android/interactivity#my_location_button.
  2. Hieu Pham 2013-02-25

    Documentation will be updated to clarify behavior.
  3. Hieu Pham 2013-02-25

    PR: https://github.com/appcelerator/titanium_modules/pull/84
  4. Eric Merriman 2013-02-25

    Verified documentation fix with commit 79ecd69911a94b0193d4dec21fc17ad17bfe8239. Closing.

JSON Source