Author Topic: Item dropped over UIDrag Drop Container  (Read 3470 times)

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Item dropped over UIDrag Drop Container
« on: December 23, 2013, 02:56:27 AM »
I have a scroll view with items that can be dragged outside of it. Another screen segment has a sprite with a collider and UIDrag Drop Container component. I can drag an item from the scrollview grid and drop it over the container and it stays there, which is great.

However I cannot find a way of start dragging it again - the item doesn't seem to react to mouse click once it's been dropped over the container...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #1 on: December 23, 2013, 01:40:08 PM »
Turn on debugging on the UICamera to see what the mouse is hovering over and what's intercepting events. Drag&drop logic is handled inside UIDragDropItem.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #2 on: December 23, 2013, 02:57:21 PM »
Excellent, thanks

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #3 on: December 23, 2013, 02:59:38 PM »
Oh and while I'm here just a little offtopic thing - I noticed that RMB context menus aren't available when the handles are turned off. Is this intentional? I've spent quite some time figuring out why it didn't show up for me :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #4 on: December 23, 2013, 03:15:46 PM »
Without handles there is no area to right click on, so no context menus. There is really no reason to ever have them turned off.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #5 on: December 23, 2013, 03:25:11 PM »
Hm, I see. I thought that NGUI was simply detecting the topmost NGUI object's collider under the cursor and the context menu was based on that. Thanks for clearing that up for me.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Item dropped over UIDrag Drop Container
« Reply #6 on: December 25, 2013, 04:02:08 AM »
Update:

So I used the debug option to see what's going on and the results are quite strange. After I drop and item over drag drop container, mouse touch detects the container's collider over item's one so  thats the reason why the item can't be picked. I moved the item so that it is far above the container collider - but touch still registers container's collider.

So I tried to turn (while still in playmode) containers collider off and (immediately) on - and suddenly the the item's collider is detected as it should - even though no collider position changed place... I wonder why this could be happening... Is there any chance of NGUI somehow storing colliders information for speed reasons and me turning one off and on somehow refreshing the list?

Obviously turning off and on a certain collider from script is not a problem - I'm just wondering why this is happening...

EDIT: turning collider off/on has to be performed after OnDragDropRelease has been called...
« Last Edit: December 25, 2013, 08:15:59 AM by Alessaint »