This is the only (slightly hacky) way I could come up with to simulate iOS scrolling, WITHOUT changing the core NGUI library. There is currently one flaw which I am unable to solve due to the access level of the underlying momentum.
Known issues: (This would be GREAT if an update gave better access to allow mods like this, or simply built it in)
1) iOS dampens "momentum" down to half of whatever it was at the point of impact. This is currently not possible without modifying the core NGUI library.
Instructions:
1) Add this component to any game object that has a UIDraggablePanel attached to it, and it will magically make your draggable lists more like iOS.
Code:
using UnityEngine;
using System.Collections;
public class UIDraggablePanelDamper : MonoBehaviour {
public float dampeningFactor = 0.5f;
UIPanel mPanel;
UIDraggablePanel draggablePanel;
Vector3 originalScale;
void Start () {
draggablePanel = GetComponent<UIDraggablePanel>();
mPanel = GetComponent<UIPanel>();
originalScale = draggablePanel.scale;
}
void Update () {
Vector3 constraint = mPanel.CalculateConstrainOffset(draggablePanel.bounds.min, draggablePanel.bounds.max);
bool outOfBounds = constraint.magnitude > 0.001f;
draggablePanel.scale = outOfBounds ? originalScale * dampeningFactor : originalScale;
}
}