Removed timing code.
When used correctly, the 1/2 second delay is uncessary and may yield undesireable results. modified: plugin/leap/leap.js
This commit is contained in:
parent
0e7bc4091e
commit
a06c84e42a
|
@ -22,21 +22,14 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a<b||b===void 0)re
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var controller = new Leap.Controller({enableGestures: true}),
|
var controller = new Leap.Controller({enableGestures: true}),
|
||||||
lastGesture = 0,
|
|
||||||
config = Reveal.getConfig().leap ||
|
config = Reveal.getConfig().leap ||
|
||||||
{
|
{
|
||||||
naturalSwipe: true
|
naturalSwipe: true
|
||||||
},
|
};
|
||||||
now;
|
|
||||||
|
|
||||||
controller.on('frame', function (frame) {
|
controller.on('frame', function (frame) {
|
||||||
now = new Date().getTime();
|
|
||||||
|
|
||||||
if( lastGesture === 0 ) {
|
if ( frame.gestures.length > 0 ) {
|
||||||
lastGesture = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (now - lastGesture) > 500 && frame.gestures.length > 0 ) {
|
|
||||||
var gesture = frame.gestures[0],
|
var gesture = frame.gestures[0],
|
||||||
x = gesture.direction[0],
|
x = gesture.direction[0],
|
||||||
y = gesture.direction[1];
|
y = gesture.direction[1];
|
||||||
|
@ -50,8 +43,6 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a<b||b===void 0)re
|
||||||
} else {
|
} else {
|
||||||
config.naturalSwipe ? Reveal.right() : Reveal.left();
|
config.naturalSwipe ? Reveal.right() : Reveal.left();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastGesture = now;
|
|
||||||
} else {
|
} else {
|
||||||
if ( y > 0 ) {
|
if ( y > 0 ) {
|
||||||
config.naturalSwipe ? Reveal.down() : Reveal.up();
|
config.naturalSwipe ? Reveal.down() : Reveal.up();
|
||||||
|
@ -59,14 +50,10 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a<b||b===void 0)re
|
||||||
config.naturalSwipe ? Reveal.up() : Reveal.down();
|
config.naturalSwipe ? Reveal.up() : Reveal.down();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastGesture = now;
|
|
||||||
} else if( frame.hands.length == 2 ) {
|
} else if( frame.hands.length == 2 ) {
|
||||||
if ( y > 0 ) {
|
if ( y > 0 ) {
|
||||||
Reveal.toggleOverview();
|
Reveal.toggleOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastGesture = now;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user