Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14023] iOS & Android: Adding view to Table View Row object does not provide proper x, y co-ordinates in window touchstart event.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-02-11T21:43:53.000+0000
Affected Version/sRelease 3.1.0, Release 3.1.1
Fix Version/sRelease 3.2.0
ComponentsAndroid, iOS
Labelsandroid, ios, mobilesdk, qe-closed-3.2.3, titanium
ReporterAshish Nigam
AssigneeIngo Muschenetz
Created2013-05-30T11:26:55.000+0000
Updated2014-06-19T12:43:02.000+0000

Description

Adding a view object to tableViewRow object, does not provide proper touch co-ordinates in window touchstart event. **Another way to say the same is:** Adding a view object to tableViewRow object, does not allow to get absolute co-ordinates over window to find where touch happened.
var win = Ti.UI.createWindow({
	backgroundColor : 'gray'
});

var data = [];

var tbView = Ti.UI.createTableView({
bubbleParent:true
});

var view1 = Ti.UI.createView({
height:"100dp",
width:"100dp",
backgroundColor:"blue",
zIndex:10,
visible:false
});

for (var i = 0; i < 4; i++) {

	var rowview1 = Ti.UI.createView({
		height : "30dp",
		width : "320dp",
		backgroundColor : "yellow",
	});
	
	var rowview1lable = Ti.UI.createLabel({
		text:"row : " + i,
		backgroundColor : "yellow",
	});
	
	rowview1.add(rowview1lable);
	
	var row = Ti.UI.createTableViewRow({
		height:"60dp",
		width:"320dp",
		title : "row : "+i,
		bubbleParent : true
	});

	row.add(rowview1); // commenting this will work the way it should, window touch start will get correct x, y co-ordinates.
	
	data.push(row);
}

tbView.data = data;

win.add(tbView);

win.addEventListener("touchstart", function(e) {
	view1.top = e.y;
	view1.left = e.x;

	view1.visible = true;
	win.add(view1);
	setTimeout(function() {
		view1.visible = false;
		win.remove(view1);

	}, 2000);
});

win.open(); 

Comments

  1. Ashish Nigam 2013-06-12

    Tested the sample again with convertPointToView method as discussed in escalation meeting, and issue is no more valid as this method is working as expected and i get the destination (required view co-ordinates).
  2. Shak Hossain 2014-02-11

    Resolving as per Ashish's comment on 12/Jun/13
  3. Pragya Rastogi 2014-04-18

    Verified the fix: OSX: 10.9.2 Xcode: 5.1 Appcelerator Studio: 3.2.3.201404151910 SDK: 3.2.3.v20140414150917 acs:1.0.14 alloy:1.3.1 npm:1.3.2 titanium:3.2.3-alpha3 titanium-code-processor:1.1.1-alpha Device: Iphone 5 (7.1) & Galaxy Nexus 4.1.1

JSON Source