// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.UI.BoundsControlTypes;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.UI.BoundsControl
{
///
/// Configuration for used in
/// This class provides all data members needed to create scale handles for
///
[CreateAssetMenu(fileName = "ScaleHandlesConfiguration", menuName = "Mixed Reality/Toolkit/Bounds Control/Scale Handles Configuration")]
public class ScaleHandlesConfiguration : HandlesBaseConfiguration
{
#region serialized fields
[SerializeField]
[Tooltip("Prefab used to display handles for 2D slate. If not set, default box shape will be used")]
GameObject handleSlatePrefab = null;
///
/// Prefab used to display handles for 2D slate. If not set, default box shape will be used
///
public GameObject HandleSlatePrefab
{
get { return handleSlatePrefab; }
set
{
if (handleSlatePrefab != value)
{
handleSlatePrefab = value;
handlesChanged.Invoke(HandlesChangedEventType.Prefab);
}
}
}
[SerializeField]
[Tooltip("Check to show scale handles")]
private bool showScaleHandles = true;
///
/// Public property to Set the visibility of the corner cube Scaling handles.
///
public bool ShowScaleHandles
{
get
{
return showScaleHandles;
}
set
{
if (showScaleHandles != value)
{
showScaleHandles = value;
handlesChanged.Invoke(HandlesChangedEventType.Visibility);
}
}
}
[SerializeField]
[Tooltip("Scale mode that is applied when interacting with scale handles - default is uniform scaling. Non uniform mode scales the control according to hand / controller movement in space.")]
private HandleScaleMode scaleBehavior = HandleScaleMode.Uniform;
///
/// Scale behavior that is applied when interacting with scale handles - default is uniform scaling. Non uniform mode scales the control according to hand / controller movement in space.
///
public HandleScaleMode ScaleBehavior
{
get
{
return scaleBehavior;
}
set
{
if (scaleBehavior != value)
{
scaleBehavior = value;
}
}
}
#endregion serialized fields
///
/// Fabricates an instance of ScaleHandles, applying
/// this config to it whilst creating it.
///
/// New TranslationHandles
internal virtual ScaleHandles ConstructInstance()
{
// Return a new ScaleHandles, using this config as the active config.
return new ScaleHandles(this);
}
}
}