Ejemplo n.º 1
0
        private void EndDrag(InputEventType evtType)
        {
            IsDragging = false;

            if (currentDragEvent == null)
            {
                return;
            }

            currentDragEvent.MousePosition = MousePosition;
            currentDragEvent.Modifiers     = m_KeyboardState.modifiersThisFrame;

            bool isOriginElementThisFrame = false;

            for (int i = 0; i < m_ElementsThisFrame.Count; i++)
            {
                if (m_ElementsThisFrame[i].id == currentDragEvent.origin.id)
                {
                    isOriginElementThisFrame = true;
                    break;
                }
            }

            if (!isOriginElementThisFrame)
            {
                m_ElementsThisFrame.Add(currentDragEvent.origin);
            }

            if (evtType == InputEventType.DragCancel)
            {
                RunDragEvent(m_ElementsThisFrame, InputEventType.DragCancel);
                currentDragEvent.Cancel();
            }
            else if (evtType == InputEventType.DragDrop)
            {
                RunDragEvent(m_ElementsThisFrame, InputEventType.DragDrop);
                currentDragEvent.Drop(true);
            }

            currentDragEvent.OnComplete();
            currentDragEvent = null;
        }