Problem detecting the second touch of a pinch gesture
Posted: Mon Mar 17, 2014 4:01 am
Dearest Livecoders,
I am doing some experiments with a frontscript for detecting some usual mobile gestures. However, I am stuck on a strange oddity while dealing with pinch gestures. I have basically applied what I saw on the tutorial at http://lessons.runrev.com/s/lessons/m/4 ... nch-motion, with some differences though.
1) The very first thing my touchStart handler does is to save the touch ID in a script local array and the mouseLoc under a nested key. Like touchesArray [tID]["initialLoc"] .
2) The touchMove handler just passes the message if the array does not contain two elements. If there are two elements (i.e., two simultaneous touches), a Pitagoras function is used for calculating the initial distance of both touches (their coordinates stored in the array of touches) and the current distance between them. Then these distances are compared, other calculation is done, etc.
But apparently there is a bug in the detection of the two touches. After much testing, I found that the initial coordinates for the second touch are reported as if it happened too close to the first touch -- no matter how far the touches actually happen.
Tests done with Livecode 6.5.2 and 6.6 RC1, a Motorola Moto G with Android Kit Kat. In the preOpenStack handler, the fullscreenmode of the stack is changed to "exactFit".
Might you folks have a clue on what's going on?
Thank you very much!
Fabricio Rocha
Brasilia, Brasil
I am doing some experiments with a frontscript for detecting some usual mobile gestures. However, I am stuck on a strange oddity while dealing with pinch gestures. I have basically applied what I saw on the tutorial at http://lessons.runrev.com/s/lessons/m/4 ... nch-motion, with some differences though.
1) The very first thing my touchStart handler does is to save the touch ID in a script local array and the mouseLoc under a nested key. Like touchesArray [tID]["initialLoc"] .
2) The touchMove handler just passes the message if the array does not contain two elements. If there are two elements (i.e., two simultaneous touches), a Pitagoras function is used for calculating the initial distance of both touches (their coordinates stored in the array of touches) and the current distance between them. Then these distances are compared, other calculation is done, etc.
But apparently there is a bug in the detection of the two touches. After much testing, I found that the initial coordinates for the second touch are reported as if it happened too close to the first touch -- no matter how far the touches actually happen.
Tests done with Livecode 6.5.2 and 6.6 RC1, a Motorola Moto G with Android Kit Kat. In the preOpenStack handler, the fullscreenmode of the stack is changed to "exactFit".
Might you folks have a clue on what's going on?
Thank you very much!
Fabricio Rocha
Brasilia, Brasil