{ "id": "63406", "key": "TIMOB-2774", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "11237", "name": "Release 1.6.0 M04", "archived": true, "released": true, "releaseDate": "2011-01-10" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:00:03.000+0000", "created": "2011-04-15T03:29:11.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "enterprise", "feature", "release-1.6.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:00:03.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": "{html}

See attached video for comparison demo.

\n
\nvar win = Ti.UI.createWindow({\n    navBarHidden:true,\n    exitOnClose:true,\n    backgroundColor: '#fff'\n});\n\nvar view = Ti.UI.createView({\n    // initial setting of of a small box view that is centered\n    width: 10,\n    height: 10,\n    center: {\n        x: Ti.Platform.displayCaps.platformWidth / 2,\n        y: Ti.Platform.displayCaps.platformHeight / 2\n    },\n    backgroundColor: '#f00'\n});\n\nvar openBtn = Ti.UI.createButton({\n    left: 10,\n    right: 10,\n    height: 50,\n    title: 'Open'\n});\n\nopenBtn.addEventListener('click', function(e) {\n    var closeBtn = Ti.UI.createButton({\n        left: 10,\n        right: 10,\n        height: 50,\n        title: 'Close'\n    });\n\n    closeBtn.addEventListener('click', function(e) {\n        view.remove(closeBtn);\n\n        view.animate({\n            center: {\n                x: Ti.Platform.displayCaps.platformWidth / 2,\n                y: Ti.Platform.displayCaps.platformHeight / 2\n            },\n            width: 10,\n            height: 10,\n            duration: 300\n        },\n        function(e) {\n            win.remove(view);\n            Ti.API.info('This is going to be called multiple times.');\n        });\n    });\n\n    win.add(view);\n\n    // animate small, centered box\n    view.animate({\n        center: {\n            x: Ti.Platform.displayCaps.platformWidth / 2,\n            y: Ti.Platform.displayCaps.platformHeight / 2\n        },\n        width: Ti.Platform.displayCaps.platformWidth,\n        height: Ti.Platform.displayCaps.platformHeight,\n        duration: 300\n    },\n    function(e) {\n        view.add(closeBtn);\n        Ti.API.info('This is going to be called multiple times.');\n    });\n});\n\nwin.add(openBtn);\nwin.open();\n
{html}", "attachment": [ { "id": "18211", "filename": "151.MOV", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:12.000+0000", "size": 1098493, "mimeType": "application/octet-stream" }, { "id": "18212", "filename": "160.MOV", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:13.000+0000", "size": 1696653, "mimeType": "application/octet-stream" }, { "id": "18210", "filename": "screen-shot-2011-01-07-at-33351-pm.png", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:12.000+0000", "size": 16065, "mimeType": "image/png" }, { "id": "18209", "filename": "screen-shot-2011-01-07-at-33846-pm.png", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:12.000+0000", "size": 104810, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Animation and Center 1.5.1 and 1.6.0 Results", "creator": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "129381", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

the \"center\" property wasn't implemented before a few days ago.\nIf you want a truly centered view shouldn't you be using center: {\nx: 0, y: 0 } ? Dividing platformHeight/platformWidth by two would\nbe good for top and left, but not center x/y?

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:13.000+0000", "updated": "2011-04-15T03:29:13.000+0000" }, { "id": "129382", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I suppose this has to do with expectation. Is the view centered\nrelative to it's parent and where is the parent's coordinate\norigin?

\n

In a layout tool, if the origin starts in the upper left (0,0),\nthen the relative position of the element positioned on top would\nbe width/2, height/2.

\n

Originally, this worked on both iOS and Android (as seen in\nvideo) as relative to the parents origin at (0,0), upper-left.

\n

Screenshot one: Where is it?
\nScreenshot two: How 0,0 works on iOS

{html}", "updateAuthor": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:13.000+0000", "updated": "2011-04-15T03:29:13.000+0000" }, { "id": "129383", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ahh.. I guess I was under the impression that \"center\" was\nrelative to the parent's center position. This never actually\n\"worked\" in Android because the center property wasn't even\nimplemented until a few days ago, so my guess is the values you had\nwere incidental with some of our default behaviors :)

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:14.000+0000", "updated": "2011-04-15T03:29:14.000+0000" }, { "id": "129384", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [eecab83e319ad70b79af913fbc3ad0d99f8265bc])\ncenter positions are parent-relative to 0,0 instead of\nparent-center relative [#2774 state:fixed-in-qa]
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/eecab83e319a...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:14.000+0000", "updated": "2011-04-15T03:29:14.000+0000" }, { "id": "129385", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

sim 2.2, G1 (1.6) [INFO] Titanium SDK version: 1.5.2\n(01/10/11 08:22 682e79e) and [INFO] Titanium SDK version: 1.6.0 (01/10/11\n08:25 3452f06)

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:15.000+0000", "updated": "2011-04-15T03:29:15.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }