{ "id": "87939", "key": "TIMOB-7999", "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": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2013-01-30T01:49:41.000+0000", "created": "2012-03-14T11:59:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "api" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [ { "id": "25316", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "79679", "key": "TIMOB-5118", "fields": { "summary": "iOS: Deprecate globalpoint member", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "26044", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "110099", "key": "TIMOB-12842", "fields": { "summary": "2D image transforms are inconsistent between iOS and Android", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T21:34:17.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": "*Code*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'white'\r\n});\r\n\r\nvar view = Ti.UI.createView({\r\n\twidth: 100,\r\n\theight: 100,\r\n\ttop: 0,\r\n\tleft: 0,\r\n\tbackgroundColor: 'red',\r\n\ttransform: Ti.UI.create2DMatrix()\r\n});\r\n\r\nview.addEventListener('touchmove', function(e)\r\n{\r\n\tvar point = view.convertPointToView({x: e.x, y: e.y}, win);\r\n\tTi.API.info('x: ' + point.x + ' | y: ' + point.y);\r\n\tview.transform = Ti.UI.create2DMatrix().translate(point.x - (view.width / 2), point.y - (view.height / 2));\r\n\t\r\n\t//Ti.API.info('x: ' + e.globalPoint.x + ' | y: ' + e.globalPoint.y);\r\n\t//view.transform = Ti.UI.create2DMatrix().translate(e.globalPoint.x - (view.width / 2), e.globalPoint.y - (view.height / 2));\r\n});\r\n\r\nwin.add(view);\r\nwin.open();\r\n\r\n{code}\r\n\r\n\r\n*Expected result*\r\nThe red view should move nice and smoothly, without any lag/jumps.\r\n\r\n*Actual result*\r\nWhen you move the view around, it actually seems to jump around. Instead of slowly and fluidly moving to where the finger is at, it sometimes jumps and shoots outside the Ti.UI.Window. \r\n\r\n*Notes*\r\n-You might have to keep moving the red view around in circles/into different corners to be able to reproduce it. Also try moving at different speeds, it seems to behave differently sometimes when you move your finger faster/slower.\r\n-If you uncomment the two lines, and comment out the three lines above it, it seems to be work perfectly fine.\r\n-This problem only occurs on the device itself, the simulator doesn't seem to have this issue.\r\n-I have only tested this on an iPhone 3GS running iOS 5.0.1.", "attachment": [], "flagged": false, "summary": "iOS: convertPointToView doesn't work as well as globalPoint", "creator": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "environment": "Titanium SDK version: 1.8.2\r\nDevice Details: iPhone 3GS - iOS 5.0.1\r\nHost Operating System: OSX 10.7.2\r\nTitanium Studio version: 1.0.9.201202141208", "comment": { "comments": [ { "id": "214385", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Out of curiosity, why are they animating in this fashion? This looks very inefficient.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-14T11:46:26.000+0000", "updated": "2012-08-14T11:46:26.000+0000" }, { "id": "214398", "author": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "body": "I would assume it's because they want to have objects that you can move around on the screen and reposition. If you do this just by adjusting the pixels (ie changing the left/right and top/bottom property), it looks laggy and jumps, it moves the object pixel by pixel.\r\n\r\nIf you do it this way, it actually seems to make it look a lot smoother, without that lag. It's as if it moves the view by something less than a pixel and more accurately, resulting into a much nice experience for the end user.", "updateAuthor": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "created": "2012-08-14T12:21:22.000+0000", "updated": "2012-08-14T12:21:22.000+0000" }, { "id": "215513", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Note to self:\r\n\r\nFUNCTION Checkpoint 1: 0.000002\r\nFUNCTION Checkpoint 1.1: 0.000094\r\nFUNCTION Checkpoint 1.5: 0.000316\r\nCALL Checkpoint 1: 0.000002\r\nCALL Checkpoint 2: 0.000099\r\nCheckpoint 1: 0.000002\r\nCheckpoint 2: 0.000053\r\nCheckpoint 3: 0.000388\r\nCheckpoint 4: 0.000478\r\nCheckpoint 5: 0.000703\r\nCALL Checkpoint 3: 0.000919\r\nFUNCTION Checkpoint 1.6: 0.001317\r\nFUNCTION Checkpoint 2: 0.001360\r\nFUNCTION Checkpoint 3: 0.001633\r\n\r\nThis might be just a case where we should optimize function calls and the like. The difference is that globalPoint was never really global, but it doesn't require checking on the views. convertToPoint has to call back to the main thread.\r\n\r\nIn the mean time, may I suggest this optimization? Reducing bridge calls?\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n    backgroundColor: 'white'\r\n});\r\n\r\nvar viewHeight = 100;\r\nvar viewWidth = 100;\r\nvar unitMatrix = Ti.UI.create2DMatrix();\r\n\r\nvar view = Ti.UI.createView({\r\n    width: viewWidth,\r\n    height: viewHeight,\r\n    top: 0,\r\n    left: 0,\r\n    backgroundColor: 'red',\r\n    transform: unitMatrix\r\n});\r\n \r\nview.addEventListener('touchmove', function(e)\r\n{\r\n    var point = view.convertPointToView({x: e.x, y: e.y}, win);\r\n    Ti.API.info('x: ' + point.x + ' | y: ' + point.y);\r\n    view.transform = unitMatrix.translate(point.x - (viewWidth / 2), point.y - (viewHeight / 2));\r\n     \r\n    //Ti.API.info('x: ' + e.globalPoint.x + ' | y: ' + e.globalPoint.y);\r\n    //view.transform = Ti.UI.create2DMatrix().translate(e.globalPoint.x - (view.width / 2), e.globalPoint.y - (view.height / 2));\r\n});\r\n \r\nwin.add(view);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-21T18:56:43.000+0000", "updated": "2012-08-21T18:56:43.000+0000" }, { "id": "224983", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "For those interested in dragging views around in Titanium, I have created a native module that works for Android and iPhone, the purpose was to overcome this performance issue. The module is free and open source and can be found here: https://github.com/pec1985/TiDraggable\n\nNOTE: This module is not Appcelerator supported, for bugs and/or features, please open an _issue_ in the github repository.", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-25T20:39:57.000+0000", "updated": "2012-10-25T20:39:57.000+0000" }, { "id": "236547", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In retrospect, neither convertPointToView nor globalPoint (which wasn't truly global, or when it was, it was TOO global) are needed.\n\n{code:javascript}\nvar win = Ti.UI.createWindow({backgroundColor: 'white'});\n \nvar viewHeight = 100;\nvar viewWidth = 100;\nvar offsetMatrix = Ti.UI.create2DMatrix();\n\nvar view = Ti.UI.createView({\n width: viewWidth,\n height: viewHeight,\n top: 0,\n left: 0,\n backgroundColor: 'red',\n transform: offsetMatrix\n});\n\nvar ex, why;\n\nview.addEventListener('touchstart',function(e){\n\tex = e.x; why = e.y;\n})\n\nview.addEventListener('touchmove', function(e)\n{\n\toffsetMatrix = offsetMatrix.translate(e.x-ex,e.y-why);\n view.transform = offsetMatrix;\n});\n\nwin.add(view);\nwin.open();\n{code}\n\nIn tracking the delta of the touch relative to where it started, no conversion is needed, and furthermore, less math is needed. It also gives an advantage over the original code in that the drag does not jump the red box to be centered around the touch.\n\nMoving to mark as 'won't fix'", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-30T01:47:58.000+0000", "updated": "2013-01-30T01:47:58.000+0000" }, { "id": "236548", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test does not actually need convertPointToView. While globalPoint does not require a bridge traversal, its fundamental concept was flawed and thus it was deprecated and removed.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-30T01:49:41.000+0000", "updated": "2013-01-30T01:49:41.000+0000" }, { "id": "415014", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as \"Won't Fix\".", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T21:34:17.000+0000", "updated": "2017-03-22T21:34:17.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }