Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Andrey Postelzhuk on April 17, 2017, 08:15:02 AM

Title: UIScrollView.onDragFinished is not called when centerOnChild exists
Post by: Andrey Postelzhuk on April 17, 2017, 08:15:02 AM
'onDragFinished' callback is never called when UIScrollView has centerOnChild object.
  1. else if (centerOnChild)
  2. {
  3.         centerOnChild.Recenter();
  4. }
  5. else
  6. {
  7.         if (mDragStarted && restrictWithinPanel && mPanel.clipping != UIDrawCall.Clipping.None)
  8.                 RestrictWithinBounds(dragEffect == DragEffect.None, canMoveHorizontally, canMoveVertically);
  9.  
  10.         if (mDragStarted && onDragFinished != null) onDragFinished();
  11.         if (!mShouldMove && onStoppedMoving != null)
  12.                 onStoppedMoving();
  13. }
  14.  
Title: Re: UIScrollView.onDragFinished is not called when centerOnChild exists
Post by: ArenMook on April 22, 2017, 11:21:38 AM
Recenter() continues the move operation to smoothly animate the scroll view to the target position, so calling "finished moving" when in fact it's still moving might be odd. Still, you can just add it and see if it causes any issues:
  1.                         else if (centerOnChild)
  2.                         {
  3.                                 if (mDragStarted && onDragFinished != null) onDragFinished();
  4.                                 centerOnChild.Recenter();
  5.                         }