using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace BlackRoad.Worldbuilder.Desktop
{
///
/// Simple draggable, closable window for the "desktop" UI.
/// Attach to the root Panel of a window and wire up title + close button.
///
public class DesktopWindow : MonoBehaviour, IPointerDownHandler, IBeginDragHandler, IDragHandler
{
[Header("UI")]
[SerializeField] private RectTransform headerArea;
[SerializeField] private Button closeButton;
[SerializeField] private Text titleText;
private RectTransform _rect;
private Canvas _canvas;
private Vector2 _dragOffset;
public string Title
{
get => titleText != null ? titleText.text : name;
set { if (titleText != null) titleText.text = value; }
}
private void Awake()
{
_rect = GetComponent();
_canvas = GetComponentInParent