if (UICamera.selectedObject != null &&
UICamera.selectedObject.GetComponent<UIWidget>() != null &&
!UICamera.selectedObject.GetComponent<UIWidget>().isVisible)
{
UIPanel panel = NGUITools.FindInParents<UIPanel>(UICamera.selectedObject);
UIScrollView sv = panel.GetComponent<UIScrollView>();
Vector3 offset = -panel.cachedTransform.InverseTransformPoint(UICamera.selectedObject.transform.position);
if (!sv.canMoveHorizontally) offset.x = panel.cachedTransform.localPosition.x;
if (!sv.canMoveVertically) offset.y = panel.cachedTransform.localPosition.y;
SpringPanel.Begin(panel.cachedGameObject, offset, 6f);
}