19 lines
684 B
C#
19 lines
684 B
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace AIGame.Review
|
|
{
|
|
public sealed class AnimationLabSeekBar : MonoBehaviour, IPointerDownHandler, IDragHandler
|
|
{
|
|
public CharacterAnimationLab viewer;
|
|
public void OnPointerDown(PointerEventData e) => Apply(e);
|
|
public void OnDrag(PointerEventData e) => Apply(e);
|
|
void Apply(PointerEventData e)
|
|
{
|
|
var rect = (RectTransform)transform;
|
|
if (viewer && RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, e.position, e.pressEventCamera, out var p))
|
|
viewer.Seek(Mathf.InverseLerp(rect.rect.xMin, rect.rect.xMax, p.x));
|
|
}
|
|
}
|
|
}
|