{ "id": "176274", "key": "TIMOB-28527", "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": "21201", "description": "", "name": "Release 10.1.0", "archived": false, "released": true, "releaseDate": "2021-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-09-01T00:53:05.000+0000", "created": "2021-08-21T10:06:38.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "polyline", "ti.map", "touch" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-09-01T00:53:05.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": "Weird one. Check the following test case and click on the polyline:\r\n\r\n{code:js}\r\nvar Map = require('ti.map');\r\n\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar polyline1 = Map.createPolyline({\r\n points: [{\r\n latitude: -33.884717,\r\n longitude: 151.187993\r\n },\r\n [151.203099, -33.882152], // Remove this line and it won't work anymore\r\n {\r\n latitude: -33.886783,\r\n longitude: 151.218033\r\n }\r\n ],\r\n strokeColor: '#FF0000',\r\n strokeWidth: 4\r\n});\r\n\r\nvar map = Map.createView({\r\n region: {\r\n latitude: -33.87365,\r\n longitude: 151.20689,\r\n latitudeDelta: 0.05,\r\n longitudeDelta: 0.05\r\n }\r\n});\r\n\r\nmap.addPolyline(polyline1);\r\n\r\nwin.add(map);\r\n\r\nmap.addEventListener('click', function(e) {\r\n Ti.API.info('Click Event: ' + JSON.stringify(e));\r\n});\r\n\r\nwin.open();\r\n{code}\r\nIt works great! Now remove the second coordinate point ({{\\[151.203099, -33.882152\\]}}) and try again: The {{click}} event is not fired anymore. And even with the three points, it only fires when tapped into certain regions, which is also very odd.", "attachment": [ { "id": "67980", "filename": "MapPolylineTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-31T19:58:53.000+0000", "size": 917, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "iOS: \"ti.map\" polyline click events not working if it only has 2 points", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "459011", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hknoechel], what's happening is the polyline is being converted into a shape on iOS (which requires at least 3 or more points) and the touch will only work if it happens within that shape's bounds. So, in your test code, pretend it is a triangle where the start and end points are connected, which is why tapping the bottom gap fires an event, but tapping the top-left and top-right gaps do not fire an event.\r\n_(I'm not saying this is right. I'm just explaining how it currently works.)_", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-27T03:10:25.000+0000", "updated": "2021-08-27T03:10:25.000+0000" }, { "id": "459012", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "That's super interesting to know, thanks! Curious how the native world solves the touch handling then. The example I saw use the point conversion as well.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-08-27T15:07:28.000+0000", "updated": "2021-08-27T15:07:28.000+0000" }, { "id": "459014", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've been trying different things out.\r\n\r\nMy first attempt was to do the math myself (which isn't hard) to calculate the distance of the touch point from the line... but my current code has precision issues with huge distances, such as Sydney to San Francisco. (I was calculating it in miles, but I should probably be calculating in latitude/longitude units instead.)\r\n\r\nI'm also going to try using the polyline's built-in {{intersectMapRect}} method where we could make the rectangle represent the touch point.\r\nhttps://developer.apple.com/documentation/mapkit/mkoverlay/1452138-intersectsmaprect\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-27T17:43:14.000+0000", "updated": "2021-08-27T17:43:14.000+0000" }, { "id": "459015", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (ti.map): https://github.com/appcelerator-modules/ti.map/pull/476", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-28T02:27:32.000+0000", "updated": "2021-08-28T02:27:32.000+0000" }, { "id": "459016", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hknoechel], would you mind giving the above PR a go? It works for me.\r\n\r\n*Side Note:* I couldn't figure out how to make Apple's {{intersectMapRect}} work. So, I did the math myself.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-28T02:31:21.000+0000", "updated": "2021-08-28T02:31:21.000+0000" }, { "id": "459023", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Works great! But it may become slow with more complex polylines / more points. In any case, it's way better than the original solution, so we should merge this!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-08-31T20:08:07.000+0000", "updated": "2021-08-31T20:08:07.000+0000" }, { "id": "459024", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I think one optimization that could be made is to skip hit testing on line segments that are off-screen. But I'm going to roll with what we've got since it seems to perform fine for your app which has lots of line segments.\r\n\r\nThanks for bringing this up [~hknoechel].", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-08-31T20:16:13.000+0000", "updated": "2021-08-31T20:16:13.000+0000" }, { "id": "459028", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-09-01T00:53:02.000+0000", "updated": "2021-09-01T00:53:02.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }