Esempio n. 1
0
        private static void OnMouseUp(Event e)
        {
            SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
            SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_DRAG, OnMouseDrag);
            ChangeCursorTo(CursorType.Normal);

            MouseEvent me = (MouseEvent)e;

            bool dropAccepted = null != _acceptedTarget;

            //_proxy.Visible = false;
            _overlay.Visible = false;

            var newBounds = dropAccepted
                ? Rectangle.FromPositionAndSize(me.GlobalPosition, new Point(0, 0))
                : _dragInitiator.Transform.GlobalBounds;

            DragProxyTween tween = new DragProxyTween(_proxy, _proxy.Bounds, newBounds)
            {
                Callback = delegate(IAnimation anim)
                {
                    //Debug.Log("*** Finished");
                    Component proxy = (Component)anim.Target;
                    proxy.Visible = false;
                    DragDropStage.Instance.RemoveChild(proxy);
                }
            };

            tween.Play(_proxy);

            RemoveCursor();

            if (null != _acceptedTarget)
            {
#if DEBUG
                if (DebugMode)
                {
                    Debug.Log("DragEvent.DRAG_DROP: " + _acceptedTarget.GetType().Name);
                }
#endif
                DragEvent de = BuildEvent(DragEvent.DRAG_DROP);
                _acceptedTarget.DispatchEvent(de);
            }

            DragEvent dragCompleteEvent = BuildEvent(DragEvent.DRAG_COMPLETE);
            _dragInitiator.DispatchEvent(dragCompleteEvent);

            _acceptedTarget        = null;
            _lastDragOverComponent = null;

            _dragging          = false;
            _dragInitiator     = null;
            _dragOverComponent = null;
        }
Esempio n. 2
0
        private static DragEvent BuildEvent(string type)
        {
            DragEvent dragStartEvent = new DragEvent(type)
            {
                DragSource    = _dragSource,
                DragInitiator = _dragInitiator,
                DraggedItem   = _dragImage,
                Action        = _action
            };

            return(dragStartEvent);
        }
Esempio n. 3
0
 private static DragEvent BuildEvent(string type)
 {
     DragEvent dragStartEvent = new DragEvent(type)
                                    {
                                        DragSource = _dragSource,
                                        DragInitiator = _dragInitiator,
                                        DraggedItem = _dragImage,
                                        Action = _action
                                    };
     return dragStartEvent;
 }