Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10956] Android: ConvertPointToView doesnt take transform in account

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-09T18:08:57.000+0000
Affected Version/sRelease 2.1.2, Release 3.1.0
Fix Version/s2013 Sprint 14, 2013 Sprint 14 API, Release 3.2.0
ComponentsAndroid
Labelsexalture, module_view, parity, qe-testadded
ReporterMartin Guillon
AssigneeSunila
Created2012-09-04T06:44:38.000+0000
Updated2014-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

FileDateSize
test_android.png2012-09-12T00:09:14.000+000012441
test_iphone.png2012-09-12T00:09:14.000+000015786

Comments

  1. Nikhil Sharma 2012-09-11

    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?
  2. Martin Guillon 2012-09-12

    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)
  3. Shameer Jan 2013-02-23

    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.
  4. Sunila 2013-06-11

    Remove translation effect from the point if there is a transformation https://github.com/appcelerator/titanium_mobile/pull/4375
  5. Dhirendra Jha 2013-10-24

    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.

JSON Source