createGenericGestureArray()

in src/core/GestureFeature.js [477:516]


  createGenericGestureArray(layers) {
    const genericGestures = [];
    layers = layers || Object.keys(this._managedLayers);

    layers.forEach(layerName => {
      const layer = this._managedLayers[layerName];

      // Make sure the layer is managed
      if (!layer) {
        return;
      }

      Object.entries(layer.animations).forEach(
        ([
          animationName,
          { holdTime, minimumInterval, words, transitionTime },
        ]) => {
          // Only store gestures that don't have any associated words
          if (!words.length) {
            const options = {
              ...(holdTime && { holdTime }),
              ...(minimumInterval && { minimumInterval }),
              ...(transitionTime && { transitionTime }),
            };
            const key = JSON.stringify({
              feature: this.constructor.name,
              method: 'playGesture',
              args: [layerName, animationName, options],
            });

            if (!genericGestures.includes(key)) {
              genericGestures.push(key);
            }
          }
        }
      );
    });

    return genericGestures;
  }