Problem description
When the icon that represents an item inside a DashboardView is smaller than the "cell" size, clicking outside the icon fires the 'click' event.
Steps to reproduce
- Use the following code:
var win = Ti.UI.createWindow({
backgroundColor: '#444'
});
var dashboardData = [];
var itemData = [
{ name: 'account', badge: 10 },
{ name: 'cases', badge: 2 },
{ name: 'calls', badge: 2 },
{ name: 'contacts', badge: 5},
{ name: 'emps' },
{ name: 'leads' },
{ name: 'meetings', badge: 3 },
{ name: 'opps', badge: 126 }, // badge will be displayed as "99+"
{ name: 'tasks' }
];
for (var i=0, ilen=itemData.length; i<ilen; i++){
var item = Ti.UI.createDashboardItem({
badge: itemData[i].badge,
image: '/images/test.png',
label: itemData[i].name
});
dashboardData.push(item);
}
var dashboard = Ti.UI.createDashboardView({
data: dashboardData,
wobble: true
});
win.add(dashboard);
dashboard.addEventListener('click', function(e){
alert('Fired on ' + e.location.x + ' ' + e.location.y + '!');
});
win.open();
- Make sure the icons used are smaller than the cell size
- Run the app and click outside the icon: the click event is fired
Note
The x-y value returned in the click event is fixed for each element, no metter where the user clicks. In particular, first element is always 0-0, second 256-0, third 512-0 etc.
PR pending https://github.com/appcelerator/titanium_mobile/pull/3265
3_0_X PR https://github.com/appcelerator/titanium_mobile/pull/3271
Need backport PR for 2.1.X branch.
New PR for master https://github.com/appcelerator/titanium_mobile/pull/3272 New PR for 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3273
PR for 2_1_X https://github.com/appcelerator/titanium_mobile/pull/3315
Tested with 2.1.4.v20121030173408 on iPhone 4s 6.0
We hadn't removed the 3.0.1 FixVersion.