// WPFMA-SDK needs Unity 2022.3 (VRChat's version); on older Unity this file is skipped and WPFMAUnityVersionNotice explains why.
#if UNITY_2022_3_OR_NEWER
using UnityEditor;
using UnityEditor.Overlays;
using UnityEngine;

namespace WPFMA
{
    /// <summary>
    /// The Placement tools as a small panel in the Scene view, like the Particle System's: it shows while something
    /// in the scene is selected in a world project, and goes away otherwise. It can be turned off in Placement tools.
    /// </summary>
    [Overlay(typeof(SceneView), "wpfma-placement", "WPFMA Placement", true)]
    public sealed class WPFMAPlacementOverlay : IMGUIOverlay, ITransientOverlay
    {
        public bool visible
        {
            get
            {
                return WPFMAToolDefaults.WorldPlacementOverlay && !WPFMAToolSection.AvatarProject &&
                       Selection.activeGameObject != null && !EditorUtility.IsPersistent(Selection.activeGameObject);
            }
        }

        public override void OnGUI()
        {
            using (new GUILayout.VerticalScope(GUILayout.Width(230f)))
                WPFMAPlacementSection.DrawCompact();
        }
    }
}
#endif
