Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Zophiel on October 08, 2013, 10:20:50 AM

Title: Drag from scrollview; Creating a copy of selected item
Post by: Zophiel on October 08, 2013, 10:20:50 AM
Hello,

I have a scrollview with a bunch of buttons you can press. What i want to do is if you press a button and drag off of it, a copy should be attached to the mouse that you are able to drop on some area.

I create the copy fine but two things happen. It doesn't react to OnPress( false ) when i release the mouse. And the scroll view keeps moving when i move the mouse up and down.

What would be a solution to fix the scroll view and let the object react to the mouse event sent?
Title: Re: Drag from scrollview; Creating a copy of selected item
Post by: Zophiel on October 08, 2013, 12:45:38 PM
I did some more googling and came across this post: http://www.tasharen.com/forum/index.php?topic=62.0

ArenMook suggests what i currently do, although instead of instantiating a copy i create a whole new gameobject set up the way i want for what ever purpose. But it's not receiving an mouse events it seems.

[Edit]
Seems the collider was being set to 1,1,1 in size : /
However the following issue is left. If i try to drag the scroll view, the button I drag on makes a copy as i use OnDrag in the button to create a copy for dragging.

Requirements:
Drag a copy of an item off of the list without the scrollview following mouse movement
Still be able to scroll the view since it use OnPress to init dragging
Title: Re: Drag from scrollview; Creating a copy of selected item
Post by: ArenMook on October 09, 2013, 08:53:37 AM
You need to set the pressed object on the UICamera.currentTouch to your new one, and likely update other relevant properties as well.