Author Topic: OnDragCancel event  (Read 1640 times)

DirtyHippy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
OnDragCancel event
« on: July 09, 2012, 09:24:52 PM »
Any way you could add a drag cancel event to UICamera line 941 (code below is post-modified code):

This lets the original control who started the drag to receive an event when a drop occurs over a non-collider.  If this isn't correct, it would be great to have the correct implementation.  For now, it seems to be working fine for me.  I am using 2.08 I believe.

  1.                                 else // The button/touch was released on a different object
  2.                                 {
  3.                                         // Send a drop notification (for drag & drop)
  4.                                         if (currentTouch.current != null)
  5.                                                 currentTouch.current.SendMessage("OnDrop", currentTouch.pressed, SendMessageOptions.DontRequireReceiver);
  6.                                         // Send a drag cancel event to the control that started the drop since we are dropping on a non-collider (i.e. empty space).
  7.                                         else
  8.                                                 currentTouch.pressed.SendMessage("OnDragCancel", SendMessageOptions.DontRequireReceiver);
  9.                                 }
  10.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnDragCancel event
« Reply #1 on: July 10, 2012, 01:50:58 AM »
You don't get the OnDrop, but you will still get the OnPress(false) notification. That's what I used in the drag & drop demo as well.