[TIMOB-10956] Android: ConvertPointToView doesnt take transform in account
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-07-09T18:08:57.000+0000 |
Affected Version/s | Release 2.1.2, Release 3.1.0 |
Fix Version/s | 2013 Sprint 14, 2013 Sprint 14 API, Release 3.2.0 |
Components | Android |
Labels | exalture, module_view, parity, qe-testadded |
Reporter | Martin Guillon |
Assignee | Sunila |
Created | 2012-09-04T06:44:38.000+0000 |
Updated | 2014-06-19T12:43:55.000+0000 |
Description
a test code will explain it better!
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var label = Ti.UI.createLabel({
text: 'Touch the Button!',
verticalAlign:'top',
top: 0, right: 0, left: 0
});
win.add(label);
var view = Ti.UI.createView({
backgroundColor:'red',
// borderWidth:2,
// borderColor:'black',
top:0,
width:100,
height:100
});
view.transform = Ti.UI.create2DMatrix().translate(0,100);
win.add(view);
win.addEventListener('touchstart', function(e) {
var point = e.source.convertPointToView({x:e.x,y:e.y}, view);
label.text = point.x + ',' + point.y;
});
win.open();
Attachments
File | Date | Size |
---|---|---|
test_android.png | 2012-09-12T00:09:14.000+0000 | 12441 |
test_iphone.png | 2012-09-12T00:09:14.000+0000 | 15786 |
Hi, I tested the above sample testcase with Ti SDK 2.1.2.GA and latest CI build. It works same on both android and iOS. Could you please provide me a screenshot of your device and please explain the problem?
Look at the screen shots. The value on iphone corresponds to where the pointer is. On android it s not the case, it says 110 as if the square where not transformed. Remember that the value i print is relative to the red square ios 5.1 android 4.0 titanium 2.2.0 (master)
The issue can reproduced with release 3.0.2 and latest master version 3.1.0 . Tested on: Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.1.0 (23/02/2013) Titanium SDK version: 3.0.2 (23/02/2013) Device: Samsung galaxy s duos Android version: 4.0.4 The displayed values are not relative to the red square.
Remove translation effect from the point if there is a transformation https://github.com/appcelerator/titanium_mobile/pull/4375
Test Environment - Appc Studio - 3.2.0.201310230601 SDK - 3.2.0.v20131023171643 acs - 1.0.7 alloy - 1.2.2 titanium - 3.2.0 titanium-code-processor - 1.0.3 Xcode - 5.0 Devices - iPhone5(v7.0.2), Nexus7(v4.3), Android Emulator 2.3.3 Result - Now it works correctly on both Android as well as iOS. Hence closing this issue.