{ "id": "81181", "key": "TIMOB-5455", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2012-08-27T14:27:13.000+0000", "created": "2011-10-05T21:45:02.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "core" ], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" }, { "id": "13572", "description": "Release 2.1.1", "name": "Release 2.1.1", "archived": true, "released": true, "releaseDate": "2012-07-31" } ], "issuelinks": [ { "id": "20268", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "91104", "key": "TIMOB-8937", "fields": { "summary": "iOS: Feature to add the scroll enable/disable property to a scrollview", "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": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T20:37:45.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": "In this drag and drop example, when you click and drag the blue box, the parentView(scrollView) gains focus and the touchmove event in the middle of the childView(view) touchmove event. It only happens when dragging left and right, not up and down. \r\n\r\nRepro:\r\n1. run app\r\n2. click and drag blue box to the right\r\n3. watch as scrollView takes focus and starts to scroll\r\n\r\n{code:title = app.js}\r\nvar mainWin = Titanium.UI.createWindow({ backgroundColor:'#fff' });\r\n\r\nvar parentView = Ti.UI.createScrollView({ top:100, left:10, width:200, height:100, borderColor:'black', borderWidth:3 });\r\n\r\nparentView.contentWidth = 400;\r\n\r\nvar reference = Ti.UI.createLabel({text:'reference reference reference', top:0, left:0, width:400, height:20});\r\nparentView.add(reference);\r\n\r\nvar childView = Ti.UI.createView({ center:{x:0, y:0}, width:50, height:50, backgroundColor:'blue' });\r\n\r\nparentView.add(childView);\r\nmainWin.add(parentView);\r\n\r\nvar touchHandler = function(e) {\r\n\tvar x, y;\r\n\tswitch (e.type) {\r\n\t\tcase 'touchstart':\r\n\t\t\tTi.API.info('Start moving.');\r\n\t\t\tparentView.fireEvent('scrollEnd', {});\r\n\t\t\tparentView.touchEnabled = false;\r\n\t\t\tchildView.center = e.globalPoint;\r\n\t\t\tmainWin.add(childView);\r\n\t\t\tchildView.moving = true;\t\t\t\r\n\t\t\tbreak;\r\n\t\tcase 'touchmove':\r\n\t\t\tif (childView.moving) {\r\n\t\t\t\tchildView.center = e.globalPoint;\r\n\t\t\t\tTi.API.info('Moving to ('+childView.center.x+','+childView.center.y+').');\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 'touchend':\r\n\t\tcase 'touchcancel':\r\n\t\t\tif (childView.moving) {\r\n\t\t\t\tif (e.type === 'touchcancel') {\r\n\t\t\t\t\tTi.API.info('Ignoring touchcancel.');\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tparentView.add(childView);\r\n\t\t\t\tx = childView.center.x - parentView.left - childView.width/2;\r\n\t\t\t\ty = childView.center.y - parentView.top - childView.height/2;\r\n\t\t\t\tif (x<0) { x = 0; }\r\n\t\t\t\tif (y<0) { y = 0; }\r\n\t\t\t\tif (x>parentView.width) { x = parentView.width; }\r\n\t\t\t\tif (y>parentView.height) { y = parentView.height; }\r\n\t\t\t\tchildView.center = {\r\n\t\t\t\t\tx: x,\r\n\t\t\t\t\ty: y\r\n\t\t\t\t}\r\n\t\t\t\tTi.API.info('Completing move at ('+childView.center.x+','+childView.center.y+').');\r\n\t\t\t\tchildView.moving = false;\r\n\t\t\t\tparentView.touchEnabled = true;\r\n\t\t\t} else {\r\n\t\t\t\tTi.API.info('Move canceled.');\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nvar touchListeners = {\r\n\t'touchcancel': touchHandler,\r\n\t'touchend': touchHandler,\r\n\t'touchmove': touchHandler,\r\n\t'touchstart': touchHandler\r\n};\r\n\r\nfor(var e in touchListeners) {\r\n\tchildView.addEventListener(e, touchListeners[e]);\r\n}\r\nmainWin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: View loses focus during touchmove event", "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 4.3 Simulator", "comment": { "comments": [ { "id": "216196", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This may be due to scrollEnabled not being set (That is, the test code may need fixing and finding the bug invalid.) Note to self: Verify that scrollEnabled does the job.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-27T10:24:31.000+0000", "updated": "2012-08-27T10:24:31.000+0000" }, { "id": "216299", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{code}\r\n\r\nvar mainWin = Titanium.UI.createWindow({ backgroundColor:'#fff' });\r\n \r\nvar parentView = Ti.UI.createScrollView({ top:100, left:10, width:200, height:100, borderColor:'black', borderWidth:3 });\r\n \r\nparentView.contentWidth = 400;\r\n \r\nvar reference = Ti.UI.createLabel({text:'reference reference reference', top:0, left:0, width:400, height:20});\r\nparentView.add(reference);\r\n \r\nvar childView = Ti.UI.createView({ center:{x:0, y:0}, width:50, height:50, backgroundColor:'blue' });\r\n \r\nparentView.add(childView);\r\nmainWin.add(parentView);\r\n \r\nvar touchHandler = function(e) {\r\n    var x, y;\r\n    switch (e.type) {\r\n        case 'touchstart':\r\n            Ti.API.info('Start moving.');\r\n            parentView.scrollingEnabled = false;\r\n            childView.center = e.globalPoint;\r\n            mainWin.add(childView);\r\n            childView.moving = true;            \r\n            break;\r\n        case 'touchmove':\r\n            if (childView.moving) {\r\n                childView.center = e.globalPoint;\r\n                Ti.API.info('Moving to ('+childView.center.x+','+childView.center.y+').');\r\n            }\r\n            break;\r\n        case 'touchend':\r\n        case 'touchcancel':\r\n            if (childView.moving) {\r\n                if (e.type === 'touchcancel') {\r\n                    Ti.API.info('Ignoring touchcancel.');\r\n                    return;\r\n                }\r\n                parentView.add(childView);\r\n                x = childView.center.x - parentView.left - childView.width/2;\r\n                y = childView.center.y - parentView.top - childView.height/2;\r\n                if (x<0) { x = 0; }\r\n                if (y<0) { y = 0; }\r\n                if (x>parentView.width) { x = parentView.width; }\r\n                if (y>parentView.height) { y = parentView.height; }\r\n                childView.center = {\r\n                    x: x,\r\n                    y: y\r\n                }\r\n                Ti.API.info('Completing move at ('+childView.center.x+','+childView.center.y+').');\r\n                childView.moving = false;\r\n                parentView.scrollingEnabled = true;\r\n            } else {\r\n                Ti.API.info('Move canceled.');\r\n            }\r\n            break;\r\n    }\r\n};\r\n \r\nvar touchListeners = {\r\n    'touchcancel': touchHandler,\r\n    'touchend': touchHandler,\r\n    'touchmove': touchHandler,\r\n    'touchstart': touchHandler\r\n};\r\n \r\nfor(var e in touchListeners) {\r\n    childView.addEventListener(e, touchListeners[e]);\r\n}\r\nmainWin.open();\r\n{code}\r\n\r\nOkay, if you use the scrollingEnabled boolean, all is well. Marking as dupe of the bug where scrollingEnabled was implemented. This is for 2.2 and is already fixed.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-27T14:24:44.000+0000", "updated": "2012-08-27T14:24:44.000+0000" }, { "id": "414896", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate of the ticket that is mentioned above and has since been closed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T20:37:45.000+0000", "updated": "2017-03-22T20:37:45.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }