61 lines
1.3 KiB
C#
61 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class CustomScrollRect : ScrollRect, IBeginDragHandler, IEndDragHandler, IScrollHandler
|
|
{
|
|
public bool is_Draging;
|
|
public bool is_Scrolling;
|
|
|
|
protected override void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
}
|
|
|
|
protected override void OnDisable()
|
|
{
|
|
base.OnDisable();
|
|
is_Draging = false;
|
|
is_Scrolling = false;
|
|
}
|
|
|
|
protected override void LateUpdate()
|
|
{
|
|
base.LateUpdate();
|
|
is_Scrolling = false;
|
|
}
|
|
|
|
public override void OnBeginDrag(PointerEventData eventData)
|
|
{
|
|
base.OnBeginDrag(eventData);
|
|
is_Draging = true;
|
|
}
|
|
|
|
public override void OnDrag(PointerEventData eventData)
|
|
{
|
|
base.OnDrag(eventData);
|
|
}
|
|
|
|
public override void OnInitializePotentialDrag(PointerEventData eventData)
|
|
{
|
|
base.OnInitializePotentialDrag(eventData);
|
|
}
|
|
|
|
public override void OnScroll(PointerEventData data)
|
|
{
|
|
base.OnScroll(data);
|
|
if (!IsActive())
|
|
return;
|
|
if (data.IsScrolling())
|
|
is_Scrolling = true;
|
|
}
|
|
|
|
public override void OnEndDrag(PointerEventData eventData)
|
|
{
|
|
base.OnEndDrag(eventData);
|
|
is_Draging = false;
|
|
}
|
|
}
|