Esempio n. 1
0
        private void UpdateDrag(bool firstFrame = false)
        {
            if (currentDragEvent == null)
            {
                return;
            }

            if (currentDragEvent.lockCursor && currentDragEvent.cursor != null)
            {
                Cursor.SetCursor(currentDragEvent.cursor.texture, currentDragEvent.cursor.hotSpot, CursorMode.Auto);
                currentCursor = currentDragEvent.cursor;
            }

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

            if (firstFrame)
            {
                RunDragEvent(m_ElementsThisFrame, InputEventType.DragEnter);
                currentDragEvent.Update();
            }
            else
            {
                RunDragEvent(m_ExitedElements, InputEventType.DragExit);
                RunDragEvent(m_EnteredElements, InputEventType.DragEnter);
                currentDragEvent.Update();
                RunDragEvent(m_ElementsThisFrame,
                             mouseState.DidMove ? InputEventType.DragMove : InputEventType.DragHover);
            }

            if (currentDragEvent.IsCanceled)
            {
                EndDrag(InputEventType.DragCancel);
            }

            if (currentDragEvent.IsDropped)
            {
                EndDrag(InputEventType.DragDrop);
            }
        }