Author Topic: 'OnDragFinished' fired on simple tap  (Read 2446 times)

Oinobareion

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
'OnDragFinished' fired on simple tap
« on: November 20, 2013, 03:58:50 AM »
Hi,

I am using the UIDraggablePanel event 'OnDragFinished' to fire events as soon as i have finished dragging the panel. Unfortunately, the event also gets fired when i simply tap the panel ( = when there has been no offset between my touches). How can I fix that? 

  1.         void Start ()
  2.         {      
  3.                 draggablePanel.onDragFinished = new UIDraggablePanel.OnDragFinished(OnDragFinished);
  4.         }
  5.        
  6.         void OnDragFinished()
  7.         {      
  8.                 // Do something
  9.         }
  10.  

Thanks for help!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 'OnDragFinished' fired on simple tap
« Reply #1 on: November 20, 2013, 03:08:22 PM »
You can open UIDraggablePanel script, go to line ~555:
  1. if (onDragFinished != null) onDragFinished();
...and wrap it in an "if" statement:
  1.                                 if (!smoothDragStart || mDragStarted)
  2.                                 {
  3.                                         if (onDragFinished != null)
  4.                                                 onDragFinished();
  5.                                 }

Oinobareion

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: 'OnDragFinished' fired on simple tap
« Reply #2 on: November 21, 2013, 03:12:10 AM »
Thanks, works fine!