[TIMOB-6304] Android: Button click event not working for transformation, due to handler acting on original rather than transformed location
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2013-07-03T15:10:52.000+0000 |
Affected Version/s | Release 1.7.3, Release 3.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | api |
Reporter | David Riggleman |
Assignee | Ingo Muschenetz |
Created | 2011-10-25T21:03:30.000+0000 |
Updated | 2017-03-20T22:10:19.000+0000 |
Description
The problem is that when creating a transformation associated with a button, the event handler does not appear to work correctly. Apparently, the reason is because the event listener is being handled at the original location rather than the transformed location (see http://developer.appcelerator.com/question/127368/transform-problems-in-android#comment-101881). Below is a test case that causes the problem.
var win = Titanium.UI.createWindow({backgroundColor: 'white'});
win.open();
var viewPlace = Ti.UI.createButton({
title: 'click to rotate',
width: 200
});
viewPlace.addEventListener("click", function(e) {
alert("clicked");
viewPlace.transform = Ti.UI.create2DMatrix().rotate(90);
});
win.add(viewPlace);
win.open();
native Android controls don't support this feature. Won't be able to fix until they do.
The controls actually transform and change position, but their touch events still respond to their original locations, not the new location. So the controls transforming, but not handling events properly, is the expected behavior?
Still not fixed in 3.1.0.. Will this ever be fixed/looked at?
FYI, this is not supported (in Android) in pre-Honeycomb. It is supported in Honeycomb and later, and Titanium will support it for Honeycomb and later (there is a pull request for it already.)
Resolving as duplicate of linked issue. Please follow along there.