[TIMOB-15545] iOS7: Clicking on map view annotation does not fire event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2013-11-05T22:14:11.000+0000 |
Affected Version/s | Release 3.1.3 |
Fix Version/s | n/a |
Components | iOS |
Labels | SupportTeam, triage |
Reporter | Ian Tearle |
Assignee | Ritu Agrawal |
Created | 2013-10-15T08:30:49.000+0000 |
Updated | 2017-03-23T05:23:50.000+0000 |
Description
When adding an annotation to a map you expect to be able to click on a pin, then receive a click event for the annotation itself.
What actually is seen, clicking on a pin displays the annotation. Clicking on the annotation does nothing. With the annotation open, clicking anywhere outside of the annotation fires the clicksource of the annotation and closes the annotation.
Clicking inside the annotation should fire the event. Not the other way around.
Run this simple app.js
var win = Ti.UI.createWindow();
var mountainView = Titanium.Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor:Titanium.Map.ANNOTATION_RED,
animate:true,
leftButton: '../images/appcelerator_small.png',
myid:1 // Custom property to uniquely identify this annotation.
});
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region: {latitude:37.390749, longitude:-122.081651,
latitudeDelta:0.04, longitudeDelta:0.04},
animate:true,
regionFit:true,
userLocation:true,
annotations:[mountainView]
});
win.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {
Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
alert(evt.clicksource);
// Check for all of the possible names that clicksouce
// can report for the left button/view.
if (evt.clicksource == 'leftButton' || evt.clicksource == 'leftPane' ||
evt.clicksource == 'leftView') {
Ti.API.info("Annotation " + evt.title + ", left button clicked.");
}
});
win.open();
Are there any patches I can make in the mean time? This bug is preventing further development and subsequently delaying a release, which is awkward.
Ian, as a workaround, I attached an click event listener to the individual annotations.
Really, because I have found that doing so has the same result as above, the only event that is fired is that for leftButton/rightButton - no clicksource for title, subtitle, left/rightView.
Correct, I had to add a button instead of depending on a title/subtitle click, but was better than getting no event from the bubble.
Closing ticket as duplicate with reference to the linked issues above.