Esempio n. 1
0
        void ITopWindowEventRoot.RootMouseUp(int x, int y, UIMouseButtons button)
        {
            int xdiff = x - _prevLogicalMouseX;
            int ydiff = y - _prevLogicalMouseY;

            _prevLogicalMouseX = x;
            _prevLogicalMouseY = y;
            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, button, 0);

            e.SetDiff(xdiff, ydiff);
            //----------------------------------
            e.IsDragging = _isDragging;
            _isMouseDown = _isDragging = false;
            DateTime snapMouseUpTime = DateTime.Now;
            TimeSpan timediff        = snapMouseUpTime - _lastTimeMouseUp;

            _lastTimeMouseUp = snapMouseUpTime;

            if (_isDragging)
            {
                if (_draggingElement != null)
                {
                    //send this to dragging element first
                    _draggingElement.GetGlobalLocation(out int d_GlobalX, out int d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = _localMouseDownX;
                    e.CapturedMouseY = _localMouseDownY;
                    var iportal = _draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseUp(e);
                        if (!e.IsCanceled)
                        {
                            _draggingElement.ListenMouseUp(e);
                        }
                    }
                    else
                    {
                        _draggingElement.ListenMouseUp(e);
                    }
                }
            }
            else
            {
                e.IsAlsoDoubleClick = timediff.Milliseconds < _dblClickSense;
                if (e.IsAlsoDoubleClick)
                {
                }
                _iTopBoxEventPortal.PortalMouseUp(e);
            }


            _localMouseDownX  = _localMouseDownY = 0;
            _mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }
Esempio n. 2
0
        void ITopWindowEventRoot.RootMouseUp(int x, int y, int button)
        {
            int xdiff = x - prevLogicalMouseX;
            int ydiff = y - prevLogicalMouseY;

            this.prevLogicalMouseX = x;
            this.prevLogicalMouseY = y;


            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, 0, button);
            e.SetDiff(xdiff, ydiff);
            //----------------------------------
            e.IsDragging = isDragging;

            this.isMouseDown = this.isDragging = false;

            DateTime snapMouseUpTime = DateTime.Now;
            TimeSpan timediff        = snapMouseUpTime - lastTimeMouseUp;

            this.lastTimeMouseUp = snapMouseUpTime;

            if (this.isDragging)
            {
                if (draggingElement != null)
                {
                    //send this to dragging element first
                    int d_GlobalX, d_globalY;
                    draggingElement.GetGlobalLocation(out d_GlobalX, out d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = this.localMouseDownX;
                    e.CapturedMouseY = this.localMouseDownY;
                    var iportal = draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseUp(e);
                        if (!e.IsCanceled)
                        {
                            draggingElement.ListenMouseUp(e);
                        }
                    }
                    else
                    {
                        draggingElement.ListenMouseUp(e);
                    }
                }
            }
            else
            {
                e.IsAlsoDoubleClick = timediff.Milliseconds < dblClickSense;
                iTopBoxEventPortal.PortalMouseUp(e);
            }

            this.localMouseDownX  = this.localMouseDownY = 0;
            this.mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }