From 69a29b105519f7e812ede82816d26ea6219c9530 Mon Sep 17 00:00:00 2001 From: Gareth Fultz Date: Wed, 14 Jul 2021 10:34:09 -0400 Subject: [PATCH] Updated hand-control to emit events that are consistent with the documentation (fixes aframevr#4883) --- src/components/hand-controls.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/hand-controls.js b/src/components/hand-controls.js index be871598c37..72f1d0a851e 100644 --- a/src/components/hand-controls.js +++ b/src/components/hand-controls.js @@ -29,8 +29,10 @@ var ANIMATIONS = { // Map animation to public events for the API. var EVENTS = {}; EVENTS[ANIMATIONS.fist] = 'grip'; -EVENTS[ANIMATIONS.thumbUp] = 'pistol'; +EVENTS[ANIMATIONS.thumbUp] = 'thumb'; EVENTS[ANIMATIONS.point] = 'pointing'; +EVENTS[ANIMATIONS.pointThumb] = 'pistol'; +EVENTS[ANIMATIONS.hold] = 'point'; /** * Hand controls component that abstracts 6DoF controls: @@ -394,16 +396,16 @@ module.exports.Component = registerComponent('hand-controls', { * @param {string} gesture * @param {boolean} active */ -function getGestureEventName (gesture, active) { + function getGestureEventName (gesture, active) { var eventName; if (!gesture) { return; } eventName = EVENTS[gesture]; if (eventName === 'grip') { - return eventName + (active ? 'close' : 'open'); + return eventName + (active ? 'down' : 'up'); } - if (eventName === 'point') { + if (eventName === 'point' || eventName === 'thumb') { return eventName + (active ? 'up' : 'down'); } if (eventName === 'pointing' || eventName === 'pistol') {