Maybe you can track the position of the touch. It should be included in the returned event. Store X and Y of the initial touchmove and check for the succeeding X and Y's of the event. Just remember that 0,0 is at the topleft corner of the image object. So when X increases therefore you probably going to the right horizontally. And when Y increases, the touch is going down vertically. And from that in mind you can even get the angle of displacement.
In the code below you can use xMove and yMove to calculate the direction the finger has moved
function OnStart()
{
var lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
var img = app.CreateImage( null, 0.8, 0.8 );
img.SetColor( "red" );
img.SetOnTouch( img_OnTouch );
lay.AddChild( img );
app.AddLayout( lay);
}
function img_OnTouch( ev )
{
if(ev.action=="Down")
{
this.data.lastX = ev.X;
this.data.lastY = ev.Y;
}
else if(ev.action=="Move")
{
// negative xMove is left
var xMove = ev.X - this.data.lastX;
// negative yMove is up
var yMove = ev.Y - this.data.lastY;
this.data.lastX = ev.X;
this.data.lastY = ev.Y;
}
}
function img_OnTouch( ev )
{
if(ev.action=="Down")
{
this.data.firstX = ev.X;
this.data.firstY = ev.Y;
}
else if(ev.action=="Move")
{
// negative xMove is left
var xMove = ev.X - this.data.lastX;
// negative yMove is up
var yMove = ev.Y - this.data.lastY;
}
else if(ev.action=="Up")
{
var xOverall = ev.X - this.data.firstX;
var yOverall = ev.Y - this.data.firstY;
var msg = "whole touch moved\nX: "+
xOverall+"\nY: "+yOverall
//app.ShowPopup( msg );