I am able to enable the predefined gestures and even a custom hold, but for the life of me I cannot get a custom linear gesture to work. I think it may be the startX, startY, endX, endY coordinates but anything I try does not seem to work.
function enableGesture()
{
//register for event
gesture.detected = 'onGesture(%json)';
// Register for a Swipe left-right
gesture.type = 'linear';
gesture.preset = 'left-right';
gesture.create();
gesture.type = 'linear';
gesture.preset = 'top-bottom';
gesture.create();
gesture.type = 'linear';
gesture.id = 'swipe-top';
gesture.startX = 300;
gesture.starty = 60;
gesture.endX = 60;
gesture.endY = 60;
gesture.create();
gesture.type='hold';
gesture.centerX=60;
gesture.centerY=60;
gesture.id="press";
gesture.create();
document.getElementById('gLog').innerHTML = "Gesture Enabled";
}
function onGesture(gObj)
{
document.getElementById('gLog').innerHTML += "<BR/>" + gObj.id;
}
In the code above I am expecting a swipe from the right to the left at the top portion of the screen (which is 480x640). All events work except the swipe-top. What am I doing wrong? I am using build 1.0.0.10
Hi Darryn
Yes it somewhat did. I was able to get a custom gesture for top of screen but could not get a diagonal from upper left to bottom right to work:
Works:
Doesn't work:
How do you use the diagnostics? I turned it on using gesture.diagnostics=true but did not see anything different.
Points: 0
You voted ‘up’
That should work, are you setting diagnostics to true before you create the gesture? You have to set it true for every gesture.
Points: 0
You voted ‘up’
Looks like you have a case-sensitive problem.
gesture.starty = 60;
should be
gesture.startY = 60;
Points: 0
You voted ‘up’
Hi Sara,
Did this solve your problem? If not you may also find the diagnostics features of gestures helpful.
Points: 1
You voted ‘up’
That did the trick. I did not realize I had to enable it per gesture. Doing it before the gesture.create() enabled the viewing of the gesture rectangles. What do the numbers next to the green line mean?
Points: 0
You voted ‘up’
Guess I should read the help file. The first number shown is the skew and the second is the deviation. Very helpful. Thanks.
Points: 0
You voted ‘up’