2D Toolkit Forum

2D Toolkit => Support => Topic started by: dustinbahr on July 02, 2015, 10:43:47 pm

Title: Dragging an instantiated item
Post by: dustinbahr 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?
Title: Re: Dragging an instantiated item
Post by: dustinbahr on July 02, 2015, 10:46:00 pm
We are using 2.4.0.