{ "id": "170685", "key": "TIMOB-25632", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "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": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-01-04T07:44:30.000+0000", "created": "2017-12-27T16:07:41.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-06T17:34:49.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": "Hello,\r\n\r\nUnable to get x,y coordinates with respect to the screen size on iOS. But android its showing the value. We are able to achieve this in the Android using the “e.source.rect.x” and “e.source.rect.y” properties on click of the image view. But considering iOS, we are not seeing any rect property within the “e”.\r\n\r\n*Test Environment:*\r\nAppcelerator Command-Line Interface, version 7.0.0 and 7.0.1\r\nSDK: 7.0.0.GA and 7.0.1.GA\r\niOS simulator\r\n*Test Code:*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : \"#fff\",\r\n});\r\nvar mainScrollView = Ti.UI.createScrollView({\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\tlayout : 'vertical'\r\n});\r\nvar toolTipYPosition,\r\n scrollViewHeight,\r\n scrollViewWidth;\r\nvar toolTipViewHeight = 200,\r\n toolTipViewWidth = 300;\r\nvar addBelow = false;\r\nfunction addToolTipView() {\r\n\r\n\tvar mainView = Ti.UI.createView({\r\n\t\theight : Ti.UI.FILL,\r\n\t\twidth : Ti.UI.FILL,\r\n\t\tbackgroundColor : '#9ffffff'\r\n\t\t//layout : 'vertical'\r\n\t});\r\n\tvar toolTipView = Ti.UI.createView({\r\n\t\theight : toolTipViewHeight,\r\n\t\twidth : Ti.UI.FILL,\r\n\t\tbackgroundColor : 'grey',\r\n\t\tcenter : {\r\n\t\t\t// x : toolTipXPosition,\r\n\t\t\ty : addBelow ? toolTipYPosition + 100 : toolTipYPosition - 116\r\n\t\t},\r\n\t\tborderColor : 'red',\r\n\t\tborderRadius : 1,\r\n\t\tborderWidth : 1,\r\n\t\tlayout : 'vertical'\r\n\t});\r\n\tTi.API.info('toolTipYPosition.....=' + toolTipYPosition + 'scrollViewHeight....' + scrollViewHeight + 'scrollViewWidth....' + scrollViewWidth);\r\n\tvar tableviewRows = [];\r\n\tvar row1,\r\n\t row2,\r\n\t row3;\r\n\tvar tableView = Ti.UI.createTableView({\r\n\t\twidth : Ti.UI.FILL,\r\n\t\theight : 150\r\n\t\t//backgroundColor : '#9ffffff',\r\n\r\n\t});\r\n\trow1 = Ti.UI.createTableViewRow({\r\n\t\twidth : Ti.UI.SIZE,\r\n\t\trowIndex : 'unSubmitted',\r\n\t\theight : Ti.UI.SIZE,\r\n\t\tcolor : '#000000',\r\n\t\ttitle : \"View Unsubmitted Claims\"\r\n\t});\r\n\trow2 = Ti.UI.createTableViewRow({\r\n\t\twidth : Ti.UI.SIZE,\r\n\t\theight : Ti.UI.SIZE,\r\n\t\trowIndex : 'Submitted',\r\n\t\tcolor : '#000000',\r\n\t\ttitle : \"View Claims in Process\"\r\n\t});\r\n\trow3 = Ti.UI.createTableViewRow({\r\n\t\twidth : Ti.UI.SIZE,\r\n\t\theight : Ti.UI.SIZE,\r\n\t\trowIndex : 'inProcess',\r\n\t\tcolor : '#000000',\r\n\t\ttitle : \"View Completed Claims\"\r\n\t});\r\n\ttableviewRows.push(row1);\r\n\ttableviewRows.push(row2);\r\n\ttableviewRows.push(row3);\r\n\ttableView.data = tableviewRows;\r\n\ttableView.addEventListener('click', function(e) {\r\n\t\tTi.API.info('tableView.addEventListener.....' + JSON.stringify(e));\r\n\t});\r\n\tvar arrowImage = Ti.UI.createImageView({\r\n\t\twidth : Ti.UI.SIZE,\r\n\t\theight : Ti.UI.SIZE,\r\n\t\timage : addBelow ? '/images/up-arrow-triangle-outline.png' : '/images/down-arrow-triangle-outline.png',\r\n\t\tright : 10\r\n\t});\r\n\tif (addBelow) {\r\n\t\ttoolTipView.add(arrowImage);\r\n\t\ttoolTipView.add(tableView);\r\n\t} else {\r\n\t\ttoolTipView.add(tableView);\r\n\t\ttoolTipView.add(arrowImage);\r\n\t}\r\n\r\n\tmainView.add(toolTipView);\r\n\taddBelow = false;\r\n\tmainView.addEventListener('click', function(e) {\r\n\t\tmainView.height = 0;\r\n\t});\r\n\r\n\treturn mainView;\r\n\r\n}\r\n\r\nfor (var i = 0; i < 10; i++) {\r\n\tvar mainView = Ti.UI.createView({\r\n\t\twidth : Ti.UI.FILL,\r\n\t\theight : 300,\r\n\t\tborderColor : 'red',\r\n\t\tborderRadius : 2,\r\n\t\tborderWidth : 2,\r\n\t\tlayout : 'vertical',\r\n\t\ttop : 10\r\n\t});\r\n\tvar titleView = Ti.UI.createView({\r\n\t\twidth : Ti.UI.FILL,\r\n\t\theight : Ti.UI.SIZE\r\n\t\t//layout : 'horizontal'\r\n\t});\r\n\tvar titleLabel = Ti.UI.createLabel({\r\n\t\twidth : '70%',\r\n\t\theight : Ti.UI.SIZE,\r\n\t\tleft : 10,\r\n\t\ttext : \"My Submitted Eclaims\",\r\n\t\tcolor : 'black'\r\n\t});\r\n\ttitleView.add(titleLabel);\r\n\tdiscoveryImage = Ti.UI.createImageView({\r\n\t\twidth : Ti.UI.SIZE,\r\n\t\theight : Ti.UI.SIZE,\r\n\t\timage : '/images/more.png',\r\n\t\tright : 10,\r\n\t\tborderColor : 'green',\r\n\t\tborderWidth : 1,\r\n\t});\r\n\ttitleView.add(discoveryImage);\r\n\tdiscoveryImage.addEventListener('click', function(e) {\r\n\t\tTi.API.info('.....' + JSON.stringify(e));\r\n\t\ttoolTipYPosition = e.source.rect.y;\r\n\t\tif (toolTipYPosition < scrollViewHeight / 2) {\r\n\t\t\taddBelow = true;\r\n\t\t}\r\n\t\twin.add(addToolTipView());\r\n\t});\r\n\tmainView.add(titleView);\r\n\tmainScrollView.add(mainView);\r\n}\r\n\r\nwin.add(mainScrollView);\r\n\r\nmainScrollView.addEventListener('postlayout', function(e) {\r\n\tTi.API.info('mainScrollView rect: ' + mainScrollView.rect.width + ',' + mainScrollView.rect.height);\r\n\tscrollViewHeight = mainScrollView.rect.height;\r\n\tscrollViewWidth = mainScrollView.rect.width;\r\n});\r\nwin.open();\r\n{code}\r\n\r\n*Steps to reproduce :*\r\n1) Create a sample project \r\n2) Copy the above code app.js file. \r\n3) Place the attached images in the resources/iphone/images/ folder. \r\n4) Click on any imageview. \r\n\r\n*iOS out comes:*\r\n{code}\r\n[INFO] : .....{\"y\":42.5,\"force\":0,\"timestamp\":13640.100374778001,\"altitudeAngle\":1.5707963705062866,\"x\":16.5,\"maximumPossibleForce\":6.666666507720947,\"bubbles\":true,\"type\":\"click\",\"source\":{\"animating\":false,\"paused\":false,\"reverse\":false,\"stopped\":true,\"autorotate\":true,\"duration\":200,\"horizontalWrap\":true,\"visible\":true,\"touchEnabled\":true,\"width\":\"SIZE\",\"height\":\"SIZE\",\"right\":10,\"borderColor\":\"green\",\"borderWidth\":1,\"image\":\"/images/more.png\"},\"cancelBubble\":false}\r\n[INFO] : toolTipYPosition.....=0 scrollViewHeight....667scrollViewWidth....375\r\n{code}\r\n\r\n*Android Output:*\r\n{code}\r\n[INFO] : .....{\"type\":\"click\",\"source\":{\"image\":\"/images/more.png\",\"animating\":false,\"reverse\":false,\"paused\":false,\"tintColor\":0,\"hiddenBehavior\":4,\"enabled\":true,\"visible\":true,\"touchEnabled\":true,\"right\":10,\"borderWidth\":1,\"borderColor\":\"green\",\"backgroundRepeat\":false,\"height\":\"size\",\"width\":\"size\",\"keepScreenOn\":false,\"children\":[],\"size\":{\"height\":43,\"width\":43,\"y\":0,\"x\":0},\"rect\":{\"height\":43,\"width\":43,\"y\":340,\"x\":307},\"apiName\":\"Ti.UI.ImageView\",\"bubbleParent\":true,\"soundEffectsEnabled\":true,\"horizontalWrap\":true,\"_events\":{\"click\":{}}},\"y\":26.9931640625,\"size\":0,\"force\":0,\"x\":21,\"bubbles\":true,\"cancelBubble\":false}\r\n[INFO] : toolTipYPosition.....=340 scrollViewHeight....560scrollViewWidth....360\r\n{code}\r\nThanks", "attachment": [ { "id": "63855", "filename": "sampleCodeAndAssets.zip", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-12-27T16:11:58.000+0000", "size": 5351, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Unable to get x,y coordinates with respect to screen size", "creator": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "iOS, x,y coordinates", "closedSprints": [ { "id": 985, "state": "closed", "name": "2018 Sprint 01 SDK", "startDate": "2017-12-31T16:58:54.631Z", "endDate": "2018-01-14T16:58:00.000Z", "completeDate": "2018-01-17T22:44:27.028Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "432579", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi, In iOS relative position can be calculated as -\r\nvar convertedPoint = titleView.convertPointToView({x:this.rect.x, y:this.rect.y}, mainScrollView);\r\n\r\nIn given code if I modify for loop as below, it will work for both iOS and android -\r\n\r\n{code:java}\r\nfor (var i = 0; i < 10; i++) {\r\n (function () {\r\n var mainView1 = Ti.UI.createView({\r\n width : Ti.UI.FILL,\r\n height : 300,\r\n borderColor : 'red',\r\n borderRadius : 2,\r\n borderWidth : 2,\r\n layout : 'vertical',\r\n top : 10\r\n });\r\n var titleView = Ti.UI.createView({\r\n width : Ti.UI.FILL,\r\n height : Ti.UI.SIZE\r\n //layout : 'horizontal'\r\n });\r\n var titleLabel = Ti.UI.createLabel({\r\n width : '70%',\r\n height : Ti.UI.SIZE,\r\n left : 10,\r\n text : \"My Submitted Eclaims\",\r\n color : 'black'\r\n });\r\n titleView.add(titleLabel);\r\n var discoveryImage = Ti.UI.createImageView({\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE,\r\n image : 'more.png',\r\n right : 10,\r\n borderColor : 'green',\r\n borderWidth : 1,\r\n });\r\n titleView.add(discoveryImage);\r\n discoveryImage.addEventListener('click', function(e) {\r\n Ti.API.info('.....' + JSON.stringify(e));\r\n \r\n if (Ti.Platform.osname === 'android') {\r\n toolTipYPosition = e.source.rect.y;\r\n } else {\r\n var convertedPoint = titleView.convertPointToView({x:this.rect.x, y:this.rect.y}, mainScrollView);\r\n Ti.API.info('.....converted point is' + convertedPoint.x + ' ' + convertedPoint.y);\r\n toolTipYPosition = convertedPoint.y;\r\n }\r\n\r\n if (toolTipYPosition < scrollViewHeight / 2) {\r\n addBelow = true;\r\n }\r\n win.add(addToolTipView());\r\n });\r\n mainView1.add(titleView);\r\n mainScrollView.add(mainView1);\r\n }());\r\n}\r\n{code}\r\n\r\n[~mrahman] Can you check with client, if it works for them? Thanks", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-12-28T11:23:03.000+0000", "updated": "2017-12-28T11:23:03.000+0000" }, { "id": "432580", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Modified code of attached code, which is working good in both iOS and android -\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : \"#fff\",\r\n});\r\nvar mainScrollView = Ti.UI.createScrollView({\r\n height : Ti.UI.SIZE,\r\n width : Ti.UI.SIZE,\r\n layout : 'vertical'\r\n});\r\nvar toolTipYPosition,\r\n scrollViewHeight,\r\n scrollViewWidth;\r\nvar toolTipViewHeight = 200,\r\n toolTipViewWidth = 300;\r\nvar addBelow = false;\r\nfunction addToolTipView() {\r\n \r\n var mainView = Ti.UI.createView({\r\n height : Ti.UI.FILL,\r\n width : Ti.UI.FILL,\r\n // backgroundColor : '#9ffffff'\r\n //layout : 'vertical'\r\n });\r\n var toolTipView = Ti.UI.createView({\r\n height : toolTipViewHeight,\r\n width : Ti.UI.FILL,\r\n backgroundColor : 'gray',\r\n center : {\r\n // x : toolTipXPosition,\r\n y : addBelow ? toolTipYPosition + 100 : toolTipYPosition - 116\r\n },\r\n borderColor : 'red',\r\n borderRadius : 1,\r\n borderWidth : 1,\r\n layout : 'vertical'\r\n });\r\n Ti.API.info('toolTipYPosition.....=' + toolTipYPosition + 'scrollViewHeight....' + scrollViewHeight + 'scrollViewWidth....' + scrollViewWidth);\r\n var tableviewRows = [];\r\n var row1,\r\n row2,\r\n row3;\r\n var tableView = Ti.UI.createTableView({\r\n width : Ti.UI.FILL,\r\n height : 150,\r\n backgroundColor :'gray'\r\n });\r\n row1 = Ti.UI.createTableViewRow({\r\n width : Ti.UI.SIZE,\r\n rowIndex : 'unSubmitted',\r\n height : Ti.UI.SIZE,\r\n color : '#000000',\r\n title : \"View Unsubmitted Claims\",\r\n backgroundColor:'gray'\r\n });\r\n row2 = Ti.UI.createTableViewRow({\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE,\r\n rowIndex : 'Submitted',\r\n color : '#000000',\r\n title : \"View Claims in Process\",\r\n backgroundColor:'gray'\r\n\r\n });\r\n row3 = Ti.UI.createTableViewRow({\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE,\r\n rowIndex : 'inProcess',\r\n color : '#000000',\r\n title : \"View Completed Claims\",\r\n backgroundColor:'gray'\r\n\r\n });\r\n tableviewRows.push(row1);\r\n tableviewRows.push(row2);\r\n tableviewRows.push(row3);\r\n tableView.data = tableviewRows;\r\n tableView.addEventListener('click', function(e) {\r\n Ti.API.info('tableView.addEventListener.....' + JSON.stringify(e));\r\n });\r\n var arrowImage = Ti.UI.createImageView({\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE,\r\n image : addBelow ? 'up-arrow-triangle-outline.png' : 'down-arrow-triangle-outline.png',\r\n right : 10\r\n });\r\n if (addBelow) {\r\n toolTipView.add(arrowImage);\r\n toolTipView.add(tableView);\r\n } else {\r\n toolTipView.add(tableView);\r\n toolTipView.add(arrowImage);\r\n }\r\n \r\n mainView.add(toolTipView);\r\n addBelow = false;\r\n mainView.addEventListener('click', function(e) {\r\n mainView.height = 0;\r\n });\r\n \r\n return mainView;\r\n \r\n}\r\n \r\nfor (var i = 0; i < 10; i++) {\r\n (function () {\r\n var mainView1 = Ti.UI.createView({\r\n width : Ti.UI.FILL,\r\n height : 300,\r\n borderColor : 'red',\r\n borderRadius : 2,\r\n borderWidth : 2,\r\n layout : 'vertical',\r\n top : 10\r\n });\r\n var titleView = Ti.UI.createView({\r\n width : Ti.UI.FILL,\r\n height : Ti.UI.SIZE\r\n //layout : 'horizontal'\r\n });\r\n var titleLabel = Ti.UI.createLabel({\r\n width : '70%',\r\n height : Ti.UI.SIZE,\r\n left : 10,\r\n text : \"My Submitted Eclaims\",\r\n color : 'black'\r\n });\r\n titleView.add(titleLabel);\r\n var discoveryImage = Ti.UI.createImageView({\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE,\r\n image : 'more.png',\r\n right : 10,\r\n borderColor : 'green',\r\n borderWidth : 1,\r\n });\r\n titleView.add(discoveryImage);\r\n discoveryImage.addEventListener('click', function(e) {\r\n Ti.API.info('.....' + JSON.stringify(e));\r\n \r\n if (Ti.Platform.osname === 'android') {\r\n toolTipYPosition = e.source.rect.y;\r\n } else {\r\n var convertedPoint = titleView.convertPointToView({x:this.rect.x, y:this.rect.y}, mainScrollView);\r\n Ti.API.info('.....converted point is' + convertedPoint.x + ' ' + convertedPoint.y);\r\n toolTipYPosition = convertedPoint.y;\r\n }\r\n\r\n if (toolTipYPosition < scrollViewHeight / 2) {\r\n addBelow = true;\r\n }\r\n win.add(addToolTipView());\r\n });\r\n mainView1.add(titleView);\r\n mainScrollView.add(mainView1);\r\n }());\r\n}\r\n \r\nwin.add(mainScrollView);\r\n \r\nmainScrollView.addEventListener('postlayout', function(e) {\r\n Ti.API.info('mainScrollView rect: ' + mainScrollView.rect.width + ',' + mainScrollView.rect.height);\r\n scrollViewHeight = mainScrollView.rect.height;\r\n scrollViewWidth = mainScrollView.rect.width;\r\n});\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-12-28T11:24:36.000+0000", "updated": "2017-12-28T11:24:36.000+0000" }, { "id": "432581", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~vijaysingh], Yes, I can see the modified code is working fine for iOS and also sending to the customer. Thanks", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-12-28T12:21:11.000+0000", "updated": "2017-12-28T12:21:11.000+0000" }, { "id": "439853", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closed as completed. If this is in error, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:34:49.000+0000", "updated": "2018-08-06T17:34:49.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }