Project: titanium
Issue TIMOB-19215: Events on Map Annotation do not fire
There are some other tickets related to this, but since most of them show no activity, are old or cover only part of the problem, here's one ticket and test case that covers it all. The following test case shows that the only 2 times a click-event that fires is when you tap a pin to open the annotation and when you tap the map to close the annotation. Tapping on the leftButton/View, rightButton/View, title or subtitle does not fire the event. Another bug is that the {{clicksource}} when you tap the map to close the annotation is {{annotation}} and not {{map}}. Adding listeners directly to the leftView/rightView does not work either. h2. Test case {code:javascript} var map = require('ti.map'); var win = Ti.UI.createWindow(); var anOne = map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:"Appcelerator Headquarters", subtitle:'Mountain View, CA', leftButton: Ti.UI.iPhone.SystemButton.SAVE, rightButton: Ti.UI.iPhone.SystemButton.SAVE }); var lBtn = Ti.UI.createView({ backgroundColor: 'red', width: 40, height: 40 }); lBtn.addEventListener('click', function(e) { console.error(e); }); var rBtn = Ti.UI.createView({ backgroundColor: 'red', width: 40, height: 40 }); rBtn.addEventListener('click', function(e) { console.error(e); }); var anTwo = map.createAnnotation({ latitude:37.33182, longitude:-122.0311837, title:"Apple Headquarters", subtitle:'Cupertino, CA', leftView: lBtn, rightView: rBtn }); var mapview = map.createView({ region: {latitude:37.390749, longitude:-122.081651, latitudeDelta:1, longitudeDelta:1}, annotations:[anOne, anTwo], }); win.add(mapview); mapview.addEventListener('click', function(evt) { console.error(evt); }); win.open(); {code} h2. Logs {code} Jun 25 11:11:10 iPhone-Fokke LiveViewer[6105] : [ERROR] {	annotation = "[object TiMapAnnotation]";	bubbles = 1;	cancelBubble = 0;	clicksource = pin;	index = 14;	map = "[object TiMapIOS7View]";	source = "[object TiMapIOS7View]";	title = "Apple Headquarters";	type = click;	} Jun 25 11:11:11 iPhone-Fokke LiveViewer[6105] : [ERROR] {	annotation = "[object TiMapAnnotation]";	bubbles = 1;	cancelBubble = 0;	clicksource = annotation;	index = 14;	map = "[object TiMapIOS7View]";	source = "[object TiMapIOS7View]";	title = "Apple Headquarters";	type = click;	} {code}
Story points: 13