{ "id": "61589", "key": "TIMOB-957", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:47.000+0000", "created": "2011-04-15T02:40:14.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "annotations", "maps", "mapview" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:47.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
Hi,
\nI've outlined the issue on Q&A: \nhttp://developer.appcelerator.com/question/26471/mapview-click-even....
\nCalling mapview.removeAnnotations seems to break the mapview\n'click' event listener.
\nThe following reproduces the issue:
\n\n//create two sets of pins\nvar pins1 = [\n Titanium.Map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:\"pins1: A\" }),\n Titanium.Map.createAnnotation({ latitude:37.74511, longitude:-84.38993, title:\"pins1: B\" }),\n];\n \nvar pins2 = [\n Titanium.Map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:\"pins2: A\" }),\n Titanium.Map.createAnnotation({ latitude:37.74511, longitude:-84.38993, title:\"pins2: B\" }),\n];\n \nvar mapview = Titanium.Map.createView({\n mapType: Titanium.Map.STANDARD_TYPE,\n animate:true,\n userLocation:false,\n annotations:pins1 //the initial setup, both pins will handle click events correctly\n});\nmapview.addEventListener('click', function(e) {\n Ti.API.log('- mapview click event : ' + e.clicksource);\n});\nTi.UI.currentWindow.add(mapview);\n \n \n//add a button to change the pins\nvar changePins = Titanium.UI.createButton({\n title:'change pins',\n style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED\n});\n \nchangePins.addEventListener('click',function() {\n //removing the initial pins and adding the seconds set - the second pind does not fire the clicked event \n mapview.removeAnnotations(pins1);\n mapview.addAnnotations(pins2);\n});\n \nTi.UI.currentWindow.setToolbar([changePins]);
\n
Works for me. I'll need confirmation from a second source to\nmark the bug as invalid - either this was fixed in 1.3.0 or as part\nof another event handling bug.
I've rechecked checked this on SDK 1.3.0 on my dev machine and\nthe issue is present.
\nI'm going to install a clean titanium on another mac and try\nthere. I'll keep you posted.
I've just confirmed the bug in 1.3.0 on a clean install of\nTitanium.
\nJust to be clear, here is what I'm seeing:
\nOn initial load, clicking the first pin results in two click\nevents. Clicking on subsequent pins results in single click events.\nAfter clicking the 'change pins' button, only one pin raises click\nevents. The second pin doesn't raise any events.
(from [3328be99875f5468f4c6fae0dd9a4358d63ac0bb])\nCloses #957: Annotations now need refresh on creation.\n\nhttp://github.com/appcelerator/titanium_mobile/commit/3328be99875f5...