Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: wallabie on May 19, 2014, 01:08:07 AM

Title: How to detect Change in ScrollView's CenterOnChild
Post by: wallabie on May 19, 2014, 01:08:07 AM
The use case:

I'm using UICenterOnChild on a Grid.  As the user is scrolling through the scrollView, is there an event that can be subscribed to to know when the Centered Child item has changed ?

Essentially, need events that tracks the entire cycle of : DragStart, Dragging, DragEnd .  Did notice that scrollView does have a OnDragFinished.
Title: Re: How to detect Change in ScrollView's CenterOnChild
Post by: Nicki on May 19, 2014, 03:59:16 AM
The UIScrollView has a isDragging and onDragFinished. The colliders you're using will have OnDrag right now.

There isn't a OnDragStarted event on the scrollview, although there might as well be.
Title: Re: How to detect Change in ScrollView's CenterOnChild
Post by: wallabie on May 19, 2014, 04:08:33 AM
It makes sense to have the component issue the entire cycle of dragStart,Dragging,DragEnd to be consistent.  This way one doesn't have to go different places for each of these events.  Also, isDragging is only a bool which means we have to query this in an update(), kinda waste of resources.
Title: Re: How to detect Change in ScrollView's CenterOnChild
Post by: Nicki on May 20, 2014, 04:36:24 PM
Yeah I'm inclined I'd agree with you on that one. Maybe you wouldn't need the Dragging since UIPanel already has an OnMove you can attach to, but it definitely makes sense to have DragStart and DragEnd.