{ "id": "63473", "key": "TIMOB-2841", "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": "11239", "name": "Release 1.6.0 M06", "archived": true, "released": true, "releaseDate": "2011-01-24" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:00:13.000+0000", "created": "2011-04-15T03:30:47.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect", "enterprise", "release-1.6.0", "reported-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:13.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}

Rotation is not honored on a view. HTC Evo 2.2

\n
\nvar win = Ti.UI.createWindow({ backgroundColor:'#000' });\nvar view = Ti.UI.createView({ width:100, height:100, backgroundColor:'#f00' });\nvar overlay = Ti.UI.createView({ top:0, left:0, right:0, bottom:0 });\nvar rotateSlider = Ti.UI.createSlider({ left:10, right:10, bottom:10, height:30, min:0, max:359 });\nvar scaleSlider = Ti.UI.createSlider({ left:10, right:10, bottom:50, height:30, min:30, max:200 });\n\nvar t = Ti.UI.create2DMatrix();\n\nfunction moveView(e) {\n    view.animate({\n        transform:t,\n        center: {\n            x: e.x,\n            y: e.y\n        },\n        duration: 0\n    });\n    \n    view.center = {\n        x: e.x,\n        y: e.y\n    };\n    view.transform = t;\n}\n\n\nfunction rotateView(e) {\n    t = t.rotate(e.value);\n    \n    view.animate({ transform:t, duration:1 });\n    view.transform = t;\n}\n\nfunction scaleView(e) {\n    view.animate({\n        width:(e.value * 0.01) * 100,\n        height:(e.value * 0.01) * 100,\n        duration:0\n    });\n}\n\nrotateSlider.addEventListener('change', rotateView);\nscaleSlider.addEventListener('change', scaleView);\noverlay.addEventListener('touchmove', moveView);\n\nwin.add(view);\nwin.add(overlay);\nwin.add(rotateSlider);\nwin.add(scaleSlider);\n\nwin.open();\n
{html}", "attachment": [ { "id": "18227", "filename": "img_0408.MOV", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:30:48.000+0000", "size": 2985470, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "Android: Rotation is not honored.", "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": "129524", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [0e1d3bf52c8d2e3b1d4d46ee9de361941da3aaab])\nrefactor Ti2DMatrix and animations to make use of actual Android\nMatrices. Changing a view's
\ntransform does the right thing now, but could
\nstill use more optimization. More work will be
\nneeded for rotate and scale animations to use a
\ncorrect anchorPoint relative the view's size.
\nAdded a default \"null\" for callbacks so we don't
\ntry to construct one for APIs that use optional
\nKrollCallbacks. [#2841 state:fixed-in-qa]
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/0e1d3bf52c8d...

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

UPDATE : I've modified this example to take into\naccount the new changes to matrix and relative anchor points

\n
\n\nvar view = Ti.UI.createView({ width:100, height:100, backgroundColor:'#f00' });\nvar overlay = Ti.UI.createView({ top: 0, left: 0, right: 0, bottom: 151 });\nvar scaleSlider = Ti.UI.createSlider({ left:10, right:100, bottom:150, height:50, min:30, max:200, value:100 });\nvar scaleLabel = Ti.UI.createLabel({ right: 10, width: 80, bottom:150, height:50, text: '100%', color: 'black'});\nvar rotateSlider = Ti.UI.createSlider({ left:10, right:100, bottom:50, height:50, min:0, max:359 });\nvar rotateLabel = Ti.UI.createLabel({ right: 10, width: 80, bottom:50, height:50, text: '0d', color: 'black'});\n\nvar rotate = 0;\nvar scale = 1.0;\n\nfunction moveView(e) {\n    view.center = {\n        x: e.x,\n        y: e.y\n    };\n}\n\nfunction rotateView(e) {\n    Ti.API.debug(\"rotate: \" + e.value);\n    rotate = e.value;\n    rotateLabel.text = rotate + \"d\";\n    transformView(e);\n}\n\nfunction scaleView(e) {\n    Ti.API.debug(\"scale: \" + (e.value * 0.01));\n    scale = e.value * 0.01;\n    scaleLabel.text = e.value + \"%\";\n    transformView(e);\n}\n\nvar filter = 300; // wait 300ms between transform updates\nvar time = new Date().getTime();\nfunction transformView(e) {\n    var now = new Date().getTime();\n    if (now - time > filter)\n    {\n        view.transform = Ti.UI.create2DMatrix({ rotate: rotate, anchorPoint: { x: 0.5, y: 0.5 } }).scale(scale);\n        time = now;\n    }\n}\n\nrotateSlider.addEventListener('change', rotateView);\nscaleSlider.addEventListener('change', scaleView);\noverlay.addEventListener('touchmove', moveView);\n\nwin.add(view);\nwin.add(overlay);\nwin.add(rotateSlider);\nwin.add(rotateLabel);\nwin.add(scaleSlider);\nwin.add(scaleLabel);\n
{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:30:52.000+0000", "updated": "2011-04-15T03:30:52.000+0000" }, { "id": "129526", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [5b58229a4a9ebaf4f37a9e7e9264f94005d0a39c])\nfix for iterating back in the matrix linked list, don't even try to\ninterpolate frames when the user supplies a transform. this\nmakes
\nconstant transform application much smoother [#2841]\n[#2873]
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/5b58229a4a9e...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:30:52.000+0000", "updated": "2011-04-15T03:30:52.000+0000" }, { "id": "129527", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

Verified with test from Marshall on 2.2 emulator.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:30:53.000+0000", "updated": "2011-04-15T03:30:53.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }