Hi
I'm on a web projet with LEAPSTRAP and a LEAPMOTION.
This project is destined for the public.
There is only 2 gesture ( select with 1 finger (and click) & swipe left/right ) to interact with the website.
Users can only use the leapmotion to navigate through it ( no mouse / keyboard ).
Gesture 1 is fully managed by the leapstrap framework ( 1 finger only )
The problem ? I reach to override the swipe gesture, but the way i'm detecting it is not adapted to what i want. I got too many interferences.
Here is the init code ( before the end tag on the page.html )
<script src="../../public/js/leapstrap.js"></script>
<script>
LeapManager.init({
enableMetaGestures: false,
enableDefaultMetaGestureActions: false,
maxCursors:1,
enableHoverTap: true,
enablePressDown: false,
enableScrollbarScrolling: false,
});
</script>
<script src="../../public/js/swipe.js"></script>
The way i'm overriding swipe gesture ( swipe.js )
var controllerOptions = {enableGestures: true};
Leap.loop(controllerOptions, function(frame) {
if (frame.gestures.length > 0) {
for (var i = 0; i < frame.gestures.length; i++) {
var gesture = frame.gestures[i];
if(gesture.direction[0] < 0){
console.log("right");
if(gesture.state == "stop"){
NextStep();
}
} else {
console.log("left");
if(gesture.state == "stop"){
PreviousStep();
}
}
}
}
})
I want to perfect the detection of the swipe gesture, the user should be able to swipe with the whole hand rather than with only 1 finger. There should be no inteference ( unwanted gesture interpreted by the system ) ( actually when i swipe whith the whole hand, 3-4 gesture would be interpreted, also when the user naturally do the inverted gesture just after a swipe he naturally put his hand back to the original position usually passing through the leapmotion sensor, maybe blocking the loop for 2s after a gesture? ).
I want the user to swipe the air naturally and detect it well for this project.
Someone got an idea? I think the easiest way would be to override the metafunction of the leapstrap (assuming the detection of swipe is good) to do 'NextStep()' and 'PreviousStep()' .
or improve my shitty piece of code
Thanks for your attention,
MrBadTSP.