isThumbsUp property

bool get isThumbsUp

Whether the hand is doing a thumbs-up gesture (thumb extended, other fingers curled).

Implementation

bool get isThumbsUp {
  final palm = palmPosition;
  final thumb = joints[HandJoint.thumbTip];
  if (palm == null || thumb == null) return false;
  if ((thumb - palm).length < 0.055) return false;

  final otherTips = [
    HandJoint.indexTip,
    HandJoint.middleTip,
    HandJoint.ringTip,
    HandJoint.littleTip,
  ];
  for (final tip in otherTips) {
    final pos = joints[tip];
    if (pos == null || (pos - palm).length > 0.045) return false;
  }
  return true;
}