// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Utilities;
namespace Microsoft.MixedReality.Toolkit
{
///
/// type method extensions.
///
public static class HandednessExtensions
{
///
/// Gets the opposite "hand" flag for the current Handedness value.
///
///
/// If current = Left, returns Right.
/// If current = Right, returns Left.
/// Otherwise, returns None
///
public static Handedness GetOppositeHandedness(this Handedness current)
{
if (current == Handedness.Left)
{
return Handedness.Right;
}
else if (current == Handedness.Right)
{
return Handedness.Left;
}
else
{
return Handedness.None;
}
}
///
/// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise
///
public static bool IsRight(this Handedness current)
{
return current == Handedness.Right;
}
///
/// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise
///
public static bool IsLeft(this Handedness current)
{
return current == Handedness.Left;
}
///
/// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise
///
public static bool IsNone(this Handedness current)
{
return current == Handedness.None;
}
///
/// Returns true if the current Handedness flags are a match with the comparison Handedness flags, false otherwise
///
public static bool IsMatch(this Handedness current, Handedness compare)
{
return (current & compare) != 0;
}
}
}