I have the following layout: window1 contains View1 View1 contains View2 View2 contains Button1
If I attach View1.addEventListener('touch move) - when the touch will be started on Button1, I will get x,y as relative to View2. How can I get X,Y in terms of view1, even though the touch is on Button1.
It seams that even if I attach the event of View1, the source of the event is still the button.
Tested this on iOS
Thanks
1 Answer
Accepted Answer
I agree with Anthony that posting a code can result in more quality answers but you may have other things going in the code so you probably just explained what the issue is.
Anyways, something like this should work
var finalX = view2.left + event.x; var finalY = view2.top + event.y;Again, you will have to just play with it a little bit but basically add the lefts and tops until to get to the reference point you are looking for.
If this does not help, try posting code with follow up question.
Your Answer
Think you can help? Login to answer this question!