{ "id": "81250", "key": "TIMOB-5470", "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": [], "resolution": { "id": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-09T19:25:40.000+0000", "created": "2011-10-07T18:50:41.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "SupportTeam", "api" ], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" }, { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-09T19:25:40.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": "the regionChanged event is fired 4 times when you first open a mapview. See log output in example:\r\n{code:title = app.js}\r\nvar win1 = Titanium.UI.createWindow();\r\n\r\nvar mapView = Ti.Map.createView({\r\n mapType: Ti.Map.STANDARD_TYPE,\r\n region:{\r\n latitude:33.74511, longitude:-84.38993,\r\n latitudeDelta:0.5, longitudeDelta:0.5\r\n },\r\n animate:true,\r\n regionFit:true,\r\n userLocation:true\r\n});\r\n\r\nvar count = 1\r\n\r\nmapView.addEventListener('regionChanged', function(e) {\r\n var latitude = e.latitude;\r\n var longitude = e.longitude;\r\n var latitudeDelta = e.latitudeDelta;\r\n var longitudeDelta = e.longitudeDelta;\r\n Ti.API.info(count+\" latitude: \" + latitude + \" longitude: \" + longitude + \" latitudeDelta: \" + latitudeDelta + \" longitudeDelta: \" + longitudeDelta);\r\n count++;\r\n});\r\n\r\nwin1.add(mapView);\r\n\r\nwin1.open();\r\n{code}\r\n\r\nh4. Extra info\r\nAs a collateral effect of this, adding the listener significantly changes the lat/long delta that I specified (therefore, changing the specified geolocation that centers the map). \r\n\r\nh4. Community Discussion\r\n\r\nhttp://developer.appcelerator.com/question/135900/regionchanged-odd-behavior", "attachment": [], "flagged": false, "summary": "iOS: regionChanged is fired 4 times on initialization ", "creator": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS Simulator", "comment": { "comments": [ { "id": "192314", "author": { "name": "tvfoodmaps", "key": "tvfoodmaps", "displayName": "Frank Apap", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Beyond the event firing 4 times, the act of adding the regionChanged listener changes the view of the map significantly. See the log output below:\r\n\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n \r\n \r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n \r\n \r\n var lastLat = 40.6826867;\r\n var lastLng= -73.4474855;\r\n var dLat= 0.46578809902344176;\r\n var dLng=0.8684262167968768;\r\n Ti.API.info(\"Starting map location lat \"+lastLat+\" lon \"+lastLng+ \" delta lat \"+dLat + \" detla lng \"+dLng);\r\n \r\n var region = {latitude:lastLat, longitude:lastLng, \r\n latitudeDelta:dLat, longitudeDelta:dLng};\r\n \r\n var mapview = Titanium.Map.createView({\r\n mapType: Titanium.Map.STANDARD_TYPE,\r\n region: region,\r\n animate:false,\r\n regionFit:false,\r\n userLocation:false\r\n });\r\n \r\n \r\n mapview.addEventListener('regionChanged',function(e){\r\n Ti.API.info(\"regionEvent\");\r\n Titanium.API.info('New Map Location: long ' + e.longitude + ' lat ' + e.latitude + ' longDelta ' + e.longitudeDelta + ' latDelta '+e.latitudeDelta);\r\n \r\n });\r\n \r\n win1.add(mapview);\r\n \r\n \r\n win1.open();\r\n \r\n \r\n/* Log output without touching anything \r\n \r\n[INFO] Starting map location lat 40.6826867 lon -73.4474855 delta lat 0.46578809902344176 detla lng 0.8684262167968768\r\n[DEBUG] application booted in 171.029985 ms\r\n[INFO] regionEvent\r\n[INFO] New Map Location: long -73.443603515625 lat 40.680638025212914 longDelta 1.0986328125 latDelta 0.8331513920235949\r\n[INFO] regionEvent\r\n[INFO] New Map Location: long -73.443603515625 lat 40.680638025212914 longDelta 4.6142578125 latDelta 4.665321024142628\r\n[INFO] regionEvent\r\n[INFO] New Map Location: long -73.443603515625 lat 40.680638025212914 longDelta 3.515625 latDelta 3.832318306517699\r\n \r\n*/", "updateAuthor": { "name": "tvfoodmaps", "key": "tvfoodmaps", "displayName": "Frank Apap", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T16:18:57.000+0000", "updated": "2012-04-23T16:18:57.000+0000" }, { "id": "195049", "author": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "body": "Tested with 2.0.1GA2 on the iOS simulator, the event gets fired 3 times for me.", "updateAuthor": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "created": "2012-05-16T14:30:44.000+0000", "updated": "2012-05-16T14:30:44.000+0000" }, { "id": "250755", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "issue reproduces\n\nevent fired 3 times\n\nTested with\nTitanium Studio, build: 3.0.1.201212181159\nTitanium SDK version: 3.1.0\niOS iPhone Simulator: iOS SDK version: 6.0", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-08T07:09:02.000+0000", "updated": "2013-05-08T07:09:02.000+0000" }, { "id": "453566", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case.\r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-09T19:25:40.000+0000", "updated": "2020-01-09T19:25:40.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }