using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Theriapolis.Game.CodexUI.Core;
namespace Theriapolis.Game.CodexUI.Drag;
///
/// Screen-level coordinator for click-drag interactions. Source widgets call
/// on left-mouse-down within their bounds and supply
/// (a) an arbitrary payload object — game-specific state, e.g. StatPoolPayload —
/// and (b) a ghost callback that paints a small follow-the-cursor visual.
///
/// Drop targets register via ; on left-mouse-up
/// the controller hit-tests in registration order and fires
/// with the matching target's id. Pressing mid-drag
/// cancels and fires .
///
/// One-controller-per-screen; concrete screens own the instance and pass it
/// down to widgets that participate in drag-drop.
///
public sealed class DragDropController
{
public bool IsDragging => _payload is not null;
public object? Payload => _payload;
public Point CursorPosition { get; private set; }
private object? _payload;
private System.Action? _ghost;
private readonly System.Collections.Generic.List _targets = new();
public event System.Action