Author Topic: How to detect Change in ScrollView's CenterOnChild  (Read 2069 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
How to detect Change in ScrollView's CenterOnChild
« 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.
« Last Edit: May 19, 2014, 01:23:46 AM by wallabie »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to detect Change in ScrollView's CenterOnChild
« Reply #1 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.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: How to detect Change in ScrollView's CenterOnChild
« Reply #2 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.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to detect Change in ScrollView's CenterOnChild
« Reply #3 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.