{ "id": "165831", "key": "TIMOB-24428", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-03-29T14:48:50.000+0000", "created": "2017-02-08T03:10:18.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-6.1.0" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" }, { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-04-04T14:37:20.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "i having the issue on getting the value from imageviewl.center.x or y from ti.sdk 6 and above on android project.\r\nBut when i try run my project on the ti.sdk 5 and it worked. please help.\r\n\r\n\r\n*sample code for XML*\r\n\r\n\t\r\n\t\t \r\n\t\r\n\r\n\r\n*sample code in controller*\r\n$.Fcontainer.addEventListener('open', setup);\r\n\r\nfunction setup() {\r\n\t$.croppedPhoto.width = '400';\r\n\t$.croppedPhoto.height = '400';\r\n\t$.croppedPhoto.zIndex = 0;\t\r\n\r\n\t$.previewImage.image = '/images/default_img/default_exhibitor.png';\r\n\t$.previewImage.image.quality = '1.0';\r\n\tcenterPhoto();\r\n}\r\ns\r\nfunction centerPhoto() {\r\n\tconsole.log(\"centering the photo\");\r\n\t\r\n\t$.previewImage.center = {\r\n\t\tx : $.croppedPhoto.width / 2,\r\n\t\ty : $.croppedPhoto.height / 2\r\n\t};\r\n}\r\n\r\nfunction touchStart(e){\r\n\tconsole.log(\"center.x --------------------------\"+$.previewImage.center.x );\r\n\tconsole.log(\"center.y --------------------------\"+$.previewImage.center.y );\t\r\n}", "attachment": [ { "id": "61524", "filename": "Screenshot 2017-02-09 11.08.31.png", "author": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-09T03:16:04.000+0000", "size": 45461, "mimeType": "image/png" }, { "id": "61523", "filename": "Screenshot 2017-02-09 11.11.05.png", "author": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-09T03:16:08.000+0000", "size": 17182, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Titanium.UI.View.center setter does not work", "creator": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.12.3\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 16.0GB\r\n\r\nNode.js\r\n Node.js Version = 4.6.2\r\n npm Version = 4.0.5\r\n\r\nAppcelerator CLI\r\n Installer = 4.2.8\r\n Core Package = 6.1.0\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.11\r\n node-appc Version = 0.2.39\r\n\r\nTitanium SDKs\r\n 6.0.1.GA\r\n Version = 6.0.1", "closedSprints": [ { "id": 865, "state": "closed", "name": "2017 Sprint 07 SDK", "startDate": "2017-03-26T22:01:37.741Z", "endDate": "2017-04-09T22:01:00.000Z", "completeDate": "2017-04-10T15:40:13.586Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "406611", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Please attach a sample code that we can test to reproduce the issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-02-08T19:10:45.000+0000", "updated": "2017-02-08T19:10:45.000+0000" }, { "id": "406766", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, \"This is an input property for specifying where the view should be positioned, and does not represent the view's calculated position\", http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ImageView-property-center. So, you have to define the X and Y, or else they are undefined. Take the below code as an example \r\n{code}\r\nTi.UI.backgroundColor = 'white';\r\nvar win = Ti.UI.createWindow();\r\nvar image = Ti.UI.createImageView({\r\n image : 'KS_nav_ui.png',\r\n});\r\n\r\nimage.addEventListener('click', function(e) {\r\n Ti.API.info(\"You clicked the image\");\r\n console.log(\"center.x --------------------------\" + image.center.x);\r\n console.log(\"center.y --------------------------\" + image.center.y);\r\n\r\n});\r\nwin.add(image);\r\nwin.open();\r\n{code}\r\nThis response in error as X and Y is undefined. Now, define\r\n{code}\r\ncenter : {\r\n\r\n x : '200',\r\n\r\n y : '200'\r\n\r\n }\r\n{code}\r\n in imageview and see the right response. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-02-09T20:27:32.000+0000", "updated": "2017-02-09T20:55:40.000+0000" }, { "id": "407146", "author": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Sharif AbuDarda,\r\n\r\nIn my code right, i try to assign the imageview center x and y after the imageview object is created.\r\n\r\nExample as from this tutorial\r\n[https://books.google.com.sg/books?id=7PmoCwAAQBAJ&pg=PA171&lpg=PA171&dq=appcelerator+change+image+center+x&source=bl&ots=u4xn1AtC_Q&sig=DcIIwCDF0ebNtwzKYgIG31lRnTM&hl=en&sa=X&ved=0ahUKEwi68K-m25PSAhXML48KHVUuBYcQ6AEIPTAG#v=onepage&q=appcelerator%20change%20image%20center%20x&f=false]\r\n\r\nit worked if you assign the imageview center x and y while you create the object, but it doesnt worked if you try to assign it after the object was created.\r\n\r\nwhat you can try is change the center x and y after you initlal the value ofter imageview and console out the value. \r\n\r\nThe X and Y value will not able to change after you first initial when the object was created.\r\n\r\nBut in SDK 5 is worked if i change the value after the object was created.\r\n\r\ntry to run the sample code below in SDK 5 and 6 than compare the console as show as below, then you will know that the imageview center x and y is not changeable when run in SDK 6\r\n\r\nEXAMPLE CODE\r\n// this sets the background color of the master UIView Titanium.\r\n//UI.setBackgroundColor('#fff');\r\n\r\n//\r\n//create root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({\r\n title: 'Funny Faces',\r\n backgroundColor: '#000'\r\n});\r\n\r\n//this will determine whether we load the 4 funny face\r\n//images or whether one is selected already\r\nvar imageSelected = false;\r\n\r\n//the 4 image face objects, yet to be instantiated\r\nvar image1;\r\nvar image2;\r\nvar image3;\r\nvar image4;\r\n\r\nvar imageViewMe = Titanium.UI.createImageView({\r\n image: '/assets/images/test3.png',\r\n width: device_width(),\r\n height: 'auto',\r\n zIndex: 0,\r\n left: 0,\r\n top: 0,\r\n zIndex: 0,\r\n center: {\r\n x: Ti.Platform.displayCaps.platformWidth/2,\r\n y: Ti.Platform.displayCaps.platformWidth/2\r\n }\r\n\r\n\r\n});\r\nwin1.add(imageViewMe);\r\n\r\nvar imageViewFace = Titanium.UI.createImageView({\r\n image: '/assets/images/top_Global_Knowledge_1.png',\r\n left: 0,\r\n top: 0, \r\n width: device_width(),\r\n height: device_width(),\r\n zIndex: 1\r\n});\r\n\r\nconsole.log('initial imageViewMe.center.x :'+imageViewMe.center.x);\r\nconsole.log('initial imageViewMe.center.y :'+imageViewMe.center.y);\r\n\r\n\r\n imageViewMe.center = {\r\n x:( '1'),\r\n y:( '1'),\r\n };\r\nconsole.log('change imageViewMe.center.x :'+imageViewMe.center.x);\r\nconsole.log('change imageViewMe.center.y :'+imageViewMe.center.y);\r\n\r\nwin1.add(imageViewFace);\r\n\r\nwin1.open();\r\n\r\nfunction device_height() {\r\n\tvar dWidth,\r\n\t dHeight = null;\r\n\t\tdWidth = (Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.logicalDensityFactor);\r\n\t\tdHeight = (Ti.Platform.displayCaps.platformHeight / Ti.Platform.displayCaps.logicalDensityFactor);\r\n\r\n\r\n\treturn (dWidth < dHeight) ? dHeight : dWidth;\r\n};\r\n\r\n/**GET DEVICE WIDTH**/\r\nfunction device_width() {\r\n\tvar dWidth,\r\n\t dHeight = null;\r\n\t\tdWidth = (Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.logicalDensityFactor);\r\n\t\tdHeight = (Ti.Platform.displayCaps.platformHeight / Ti.Platform.displayCaps.logicalDensityFactor);\r\n\r\n\r\n\treturn (dWidth < dHeight) ? dWidth : dHeight;\r\n};\r\n\r\n\r\n\r\n\r\nconsole.log('TI Y '+Ti.Platform.displayCaps.platformHeight);\r\nconsole.log('TI X '+Ti.Platform.displayCaps.platformWidth);\r\n\r\nimageViewFace.addEventListener('touchmove', function (e) {\r\n //console.log('e.x :' + e.x );\r\n //console.log('e.y :' + e.y ); \r\n // imageViewMe.left = e.x;\r\n // imageViewMe.top = e.y;\r\n});\r\n\r\nimageViewFace.addEventListener('touchstart', function (e) {\r\n \t\t//imageViewMe.ox = e.x - imageViewMe.center.x;\r\n\t\t//imageViewMe.oy = e.y - imageViewMe.center.y; \r\n // console.log('touchstart e.x :' + e.x );\r\n // console.log('touchstart e.y :' + e.y );\r\n // console.log('touchstart imageViewMe.center.x :'+imageViewMe.center.x);\r\n // console.log('touchstart imageViewMe.center.y :'+imageViewMe.center.y);\r\n // imageViewMe.ox = e.x - imageViewMe.center.x;\r\n // imageViewMe.oy = e.y - imageViewMe.center.y;\r\n});\r\n\r\nimageViewFace.addEventListener('touchmove', function (e) {\r\n \r\n \r\n var halfp = (Ti.Platform.displayCaps.platformWidth/2);\r\n\r\n\r\n var test = e.x - imageViewMe.center.x;\r\n console.log('< : ' + test);\r\n imageViewMe.left = e.x - imageViewMe.center.x;\r\n imageViewMe.top = e.y - imageViewMe.center.y;\r\n \r\n});\r\n\r\n\timageViewFace.addEventListener('pinch', function(e) {\r\n \t\timageViewMe.ox = e.x - imageViewMe.center.x;\r\n\t\timageViewMe.oy = e.y - imageViewMe.center.y; \r\n\t imageViewMe.height = device_width() * e.scale;\r\n\t imageViewMe.width = device_width() * e.scale;\r\n\t});\r\n\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "Yellowcube", "key": "yellowcube", "displayName": "Yellowcube", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-16T04:36:19.000+0000", "updated": "2017-02-16T04:36:19.000+0000" }, { "id": "407910", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, This is a real bug in the platform. Take a look at the below code. \r\n{code}\r\nTi.UI.backgroundColor = 'white';\r\n\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar view = Ti.UI.createView({\r\n top : 10,\r\n backgroundColor : 'red',\r\n height : \"50dp\",\r\n width : \"100dp\"\r\n});\r\n\r\nview.addEventListener('click', function(e) {\r\n\r\n Ti.API.info(\"You clicked the image\");\r\n view.center = {\r\n\r\n x : '50dp',\r\n\r\n y : '50dp'\r\n\r\n };\r\n\r\n});\r\n\r\nwin.add(view);\r\n\r\nwin.open();\r\n{code}\r\n\r\nIn SDK 6.0.x+ View property center work if you assign the view center x and y while you create the object, but it doesn't worked if you try to assign it after the object was created. This was working fine in SDK 5.5.1.GA.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-02-23T21:26:44.000+0000", "updated": "2017-02-23T21:26:44.000+0000" }, { "id": "409479", "author": { "name": "zozo4kin", "key": "zozo4kin", "displayName": "Zakhar Zhuravlev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Why this issue still isn't added to any Release? Release 6.0.3 would be great. It's annoying regression.", "updateAuthor": { "name": "zozo4kin", "key": "zozo4kin", "displayName": "Zakhar Zhuravlev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-07T09:05:23.000+0000", "updated": "2017-03-07T09:05:23.000+0000" }, { "id": "409493", "author": { "name": "zozo4kin", "key": "zozo4kin", "displayName": "Zakhar Zhuravlev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "\"In SDK 6.0.x+ View property center work if you assign the view center x and y while you create the object, but it doesn't worked if you try to assign it after the object was created.\"\r\n\r\nIt's not true! It doesn't work even if you assign center property during creating of object.", "updateAuthor": { "name": "zozo4kin", "key": "zozo4kin", "displayName": "Zakhar Zhuravlev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-07T12:24:43.000+0000", "updated": "2017-03-07T12:24:43.000+0000" }, { "id": "413631", "author": { "name": "micksolo", "key": "micksolo", "displayName": "Mick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "also happens for left and top properties for the view when using postlayout eventlistener.\r\n\r\nThis is a really bad bug guys, please fix this ASAP. ", "updateAuthor": { "name": "micksolo", "key": "micksolo", "displayName": "Mick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-18T08:09:41.000+0000", "updated": "2017-03-18T08:10:21.000+0000" }, { "id": "414739", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Since the other ticket also fixes a different issue, I made a separate PR for this.\r\n\r\nmaster: https://github.com/appcelerator/titanium_mobile/pull/8904", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T14:25:20.000+0000", "updated": "2017-03-26T23:51:01.000+0000" }, { "id": "416738", "author": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "body": "\r\n{noformat}\r\nMac OS Version : 10.12.3\r\nAppc CLI : 6.1.0\r\nAppc NPM : 4.2.9-1\r\nNode : v4.6.0\r\nDevice: Nexus 5x(6.0.1) Pixel XL(7.1.2)\r\nEmulator: (6.0), (4.4.2)\r\n{noformat}\r\n\r\nUsing above env passed FR. After merge, the changes are present in SDK {{6.1.0.v20170401095755}}.\r\n\r\n*Closing*", "updateAuthor": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "created": "2017-04-04T14:36:45.000+0000", "updated": "2017-04-04T14:36:45.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }