{ "id": "92760", "key": "TIMOB-9357", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13400", "description": "Sprint 2012-12 Mobile Web", "name": "Sprint 2012-12 MW", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-06-05T12:30:44.000+0000", "created": "2012-06-04T09:22:23.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "parity" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-06-26T15:25:19.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": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "h1. Problem\r\nThe coordinates provided in touch events are inconsistent with our other platforms.\r\n\r\nIn particular:\r\n- The local point (evt.x) is the absolute position. It should be relative to the containing view.\r\n- I cannot tell what the global point is in reference to. It seems miscalculated, but that is only an observation.\r\n\r\nh2. Reproduction\r\nThe following creates a vertical scroll view with a series of boxes in it. Drag one of the boxes to the right, and it will move faster than your finger as the global point is miscalculated. There are several console logs to illuminate the disparity in the platforms.\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar scroll = Ti.UI.createScrollView({\r\n scrollType: 'vertical',\r\n contentHeight: 3010,\r\n canCancelEvents: false,\r\n bottom: 60\r\n});\r\nvar width = 150, height = 90;\r\nfor (var i = 0; i < 30; i++) {\r\n scroll.add(Ti.UI.createLabel({\r\n draggable: true,\r\n text: 'Drag Me Horizontally ' + (i + 1), textAlign: 'center',\r\n color: '#000',\r\n top: i * 100 + 10,\r\n width: width, height: height,\r\n left: 0,\r\n backgroundColor: '#eee'\r\n }));\r\n}\r\nscroll.addEventListener('touchstart', curry('Touch Start'));\r\nscroll.addEventListener('touchmove', curry('Touch Move'));\r\nscroll.addEventListener('touchcancel', curry('Touch Cancel'));\r\nscroll.addEventListener('touchend', curry('Touch End'));\r\nwin.add(scroll);\r\nwin.open();\r\n\r\nfunction curry(eventName) {\r\n return function (evt) {\r\n if (evt.source && evt.source.draggable) {\r\n var global = evt.source.convertPointToView({ x: evt.x, y: evt.y }, scroll);\r\n console.log(eventName + ' evt.x: ' + evt.x);\r\n console.log(eventName + ' global.x: ' + global.x);\r\n evt.source.left = global.x - width / 2;\r\n }\r\n }\r\n}\r\n{code}", "attachment": [ { "id": "28151", "filename": "app.js", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-04T14:31:25.000+0000", "size": 608, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "MobileWeb: View Touch Event Coordinates Parity, Global and Local", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": "Google Chrome 19.0.1084.53\r\nversion=2.1.0, timestamp=06/02/12 01:02, githash=7b8aeb3", "comment": { "comments": [ { "id": "196999", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Note that you can workaround the defect in the demo by replacing global.x with evt.x in the evt.source.left assignment. That doesn't really address the core issue, though, which is the disparity between MW and iOS+Android.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2012-06-04T09:25:45.000+0000", "updated": "2012-06-04T09:25:45.000+0000" }, { "id": "197134", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2317\r\n\r\nNote: convertPointToView worked just fine...it was just being fed false information. The global point itself wasn't miscalculated, it just didn't start with the correct info.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-04T14:31:03.000+0000", "updated": "2012-06-04T14:31:03.000+0000" }, { "id": "200425", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the issue on the environment below & found it to be working as expected.\r\nThe local point (evt.x) is not the absolute position now its relative to the containing view.\r\nDragging the box to the right does not move it faster than your finger.\r\n\r\nTitanium Studio : 2.1.0.201206251749\r\nSDK version : 2.1.0.v20120626104306\r\nChrome : 19.0.1084.56", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-06-26T15:25:19.000+0000", "updated": "2012-06-26T15:25:19.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }