Author Topic: Drag from scrollview; Creating a copy of selected item  (Read 2174 times)

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Drag from scrollview; Creating a copy of selected item
« 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?

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Drag from scrollview; Creating a copy of selected item
« Reply #1 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
« Last Edit: October 08, 2013, 12:54:10 PM by Zophiel »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag from scrollview; Creating a copy of selected item
« Reply #2 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.