using Pursuit.Code.ExtensionMethods;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Pursuit.UI
{
    public class ScrollRectSnapper : MonoBehaviour, ISelectHandler
    {
        public void OnSelect(BaseEventData eventData)
        {
            // trying to reject the mouse cursor here, since TMP_Dropdown
            // selects things that we hover over!!

            if (eventData.GetType() == typeof(BaseEventData))
                return;

            GetComponentInParent<ScrollRect>().SnapTo(transform as RectTransform);
        }
    }
}