Unity3D UI, calculation for position dragging an item?
<p>These days it's incredibly easy to drag UI elements in Unity: Make a few UI items. Add Component -> Event -> <strong>Event Trigger</strong>. Drop on the script below. Click to add the four obvious triggers. You're done.</p>

<p>However.</p>

<p>I'm totally lost in the relationship between <strong>pointer coordinates</strong> and <strong>UI coordinates</strong> (as seen in RectTransform and so on).</p>

<p>In <code>DragIt</code> below: how the hell do you move a UI panel correctly under the finger?</p>

<p>Say you have one large panel, with ten UIButton sitting in the panel with <code>Dragster</code> on the buttons. What is the relationship between the RectTransform coords and the mouse pointer ...</p>

<p>in short how do you move one of the button around at DragIt() below?</p>

<pre><code>/* modern Unity drag of UI element */
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class Dragster:MonoBehaviour
    {
    public int index; // number each of your UI items
    static bool beingDragged = false;
    static int dragFrom;
    public void DragStart()
        {
        beingDragged = true; dragFrom = index;
        }
    public void DragIt()
        {
        ? ? W T F ? ?
        }
    public void DragEnd()
        {
        beingDragged = false;
        }
    public void DroppedBra()
        {
        Debig.Log("Drag: from/to " +dragFrom +" --&gt; " +index);
        }
    }
</code></pre>