{ "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,

\n

I've outlined the issue on Q&A: \nhttp://developer.appcelerator.com/question/26471/mapview-click-even....

\n

Calling mapview.removeAnnotations seems to break the mapview\n'click' event listener.

\n

The 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
{html}", "attachment": [], "flagged": false, "summary": "Removing annotations from MapView breaks map evens", "creator": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124460", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:15.000+0000", "updated": "2011-04-15T02:40:15.000+0000" }, { "id": "124461", "author": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I've rechecked checked this on SDK 1.3.0 on my dev machine and\nthe issue is present.

\n

I'm going to install a clean titanium on another mac and try\nthere. I'll keep you posted.

{html}", "updateAuthor": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:15.000+0000", "updated": "2011-04-15T02:40:15.000+0000" }, { "id": "124462", "author": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I've just confirmed the bug in 1.3.0 on a clean install of\nTitanium.

\n

Just to be clear, here is what I'm seeing:

\n

On 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.

{html}", "updateAuthor": { "name": "gavinjoyce", "key": "gavinjoyce", "displayName": "Gavin Joyce", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:15.000+0000", "updated": "2011-04-15T02:40:15.000+0000" }, { "id": "124463", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [3328be99875f5468f4c6fae0dd9a4358d63ac0bb])\nCloses #957: Annotations now need refresh on creation.\n\nhttp://github.com/appcelerator/titanium_mobile/commit/3328be99875f5...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:15.000+0000", "updated": "2011-04-15T02:40:15.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }