Author Topic: UIScrollView OnDragStarted Event  (Read 4227 times)

HeavensSword

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
UIScrollView OnDragStarted Event
« on: July 30, 2014, 08:39:04 AM »
Just had a quick question; I was trying to subscribe to the OnDragStarted event since I need to know when the user is dragging or scrolling through my UIWrapContent.

When testing it, the function was not being called and I found that the event is only thrown if smoothDragStart is true. Was wondering if that is intended. My expectation would be the event would be thrown regardless of being set to smooth or precise.

Thanks in advanced.

Code snippet for reference:

  1. public void Drag ()
  2. {
  3.         if (enabled && NGUITools.GetActive(gameObject) && mShouldMove)
  4.         {
  5.                 if (mDragID == -10) mDragID = UICamera.currentTouchID;
  6.                 UICamera.currentTouch.clickNotification = UICamera.ClickNotification.BasedOnDelta;
  7.  
  8.                 // Prevents the drag "jump". Contributed by 'mixd' from the Tasharen forums.
  9.                 if (smoothDragStart && !mDragStarted)
  10.                 {
  11.                         mDragStarted = true;
  12.                         mDragStartOffset = UICamera.currentTouch.totalDelta;
  13.                         if (onDragStarted != null) onDragStarted();
  14.                 }
  15. ...
  16.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView OnDragStarted Event
« Reply #1 on: July 30, 2014, 10:48:34 AM »
The code you posted is from a while back. You're not on the latest version.

HeavensSword

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UIScrollView OnDragStarted Event
« Reply #2 on: July 30, 2014, 01:02:04 PM »
I should be on 3.6.8, though it's quite possible the package wasn't updated properly. I'll look into it, thanks.