void OnDragFinished()
{
isMoving = true;
StartCoroutine(CheckIfPanelStandsStill());
}
private IEnumerator CheckIfPanelStandsStill ()
{
while (isMoving)
{
// the current drag momentum
float currentDragMomentum = panel.clipRange.y;
// wait some time
yield return new WaitForSeconds
(0
.1f
);
// the drag momentum after some time
float dragMomentumAfterSomeTime = panel.clipRange.y;
// this means that our panel stands still
if (currentDragMomentum == dragMomentumAfterSomeTime)
{
CheckListElements();
isMoving = false;
}
}
}