The problem
"click" event produces wrong "x" and "y" coordinates.
Steps to reproduce
To see the issue, run this example:
var win = Ti.UI.createWindow({
backgroundColor: '#000',
navBarHidden: true
});
var wrapper = Ti.UI.createView({
height: 20,
backgroundColor: '#f00',
width: 200
});
var left = Ti.UI.createView({
height: 10,
width: 200,
left: 0,
backgroundColor: '#093',
width: 0
});
var right = Ti.UI.createView({
height: 10,
width: 0,
right: 0,
backgroundColor: '#039',
width: 200
});
wrapper.add(left);
wrapper.add(right);
win.add(wrapper);
wrapper.addEventListener('click', function(e) {
var x = e.x.toFixed(2);
Ti.API.info('x: ' + x);
left.width = x;
right.width = 200 - x;
});
win.open();
Click on red view from left to right.
First few clicks work fine, but after the values are wrong. That can be seen in the console output, but also visually (by width of two inner views).
The issue exists on Android and on iOS.
I have some more info regarding this issue. It seems that issue is not present when there is only one view inside "wrapper" (and that is, "left" view) and the issue is caused by "right" view. The workaround is to set "touchEnabled" to "false" to "right" view. I guess that "right" view somehow captures "click" and sends wrong coordinates to its parent view. Also, that works very strangely because numbers returned are alternating between two values when user clicks at same point.
cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Android Emulator: Android SDK version: 2.2
Closing ticket as the issue cannot be reproduced.