Touch event bug == really really stupid
There is a really ridiculously ridiculous bug associated with View touch events.
Given a setup such as:
var view1 = Ti.UI.createView({
width:200, height:200
});
var view2 = Ti.UI.createView({
width:100, height:100, top:50, left:50
});
view1.add(view2);
view1.addEventListener('touchstart', function(evt){
Ti.API.info('evtX = ' + evt.x + 'evtY = ' + evt.y );
});
What happens is that if the touch event occurs inside view2, the coordinates
recorded by the event are relative to view2, and not view1, which of course is the source that actually fires the event, and is indeed recorded as the source of the event.
Am I taking crazy pills? Or should I start taking crazy pills to make this seem more logical? It is very frustrating not being able to trust the API generated values without having to incorporate a bunch of extra fluff (such as a transparent 'cover view' with greatest zIndex whose only function is to recieve touch events). Not a very happy camper in these woods.
1 Answer
-
Agreed, it'd be nice to get the coordinates relative to the view that the event was added to.