Hello Guest

Author Topic: Dragging an instantiated item  (Read 3462 times)

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Dragging an instantiated item
« on: July 02, 2015, 10:43:47 pm »
We have a situation where objects with tk2dUIItems can be drug around the screen, in a multi touch environment.

We listen for OnDown, use the tk2dUIItem.Touch to update position while dragging, and stop OnRelease.

This works great. However in other cases we want to instantiate one of these objects and begin dragging it immediately.

How do we simulate the OnDown and start dragging the instantiated object?


We tried tk2dUIItem.Press(), and while this did simulate the initial touch, the touch does not continue to get updated, so dragging isn't possible.

We found a working solution that involved adding to tk2dUIManager. We added this method which we call right after tk2dUIItem.Press();

Code: [Select]
public void AddItemToList(tk2dUIItem item)
{
prevPressedUIItemList.Add(item);
}


However, it seems like this addition shouldn't be necessary. What are we missing?

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Dragging an instantiated item
« Reply #1 on: July 02, 2015, 10:46:00 pm »
We are using 2.4.0.