protected override void OnMouseMove(UIMouseMoveEventArgs e)
            {
                //test
                //draw on this canvas
                if (!e.IsDragging)
                {
                    return;
                }
                _lastX = e.X;
                _lastY = e.Y;
                //temp fix here -> need converter
                var p = this.Painter;

                p.Clear(PixelFarm.Drawing.Color.White);
                _pointList.Add(new Point(_lastX, _lastY));
                //clear and render again
                int j = _pointList.Count;

                for (int i = 1; i < j; ++i)
                {
                    var p0 = _pointList[i - 1];
                    var p1 = _pointList[i];
                    p.DrawLine(
                        p0.X, p0.Y,
                        p1.X, p1.Y);
                }

                this.InvalidateCanvasContent();
            }
Пример #2
0
 internal override void ListenMouseEnter(object sender, UIMouseMoveEventArgs e)
 {
     if (_ownerBeh.HasMouseEnter)
     {
         _ownerBeh.InvokeMouseEnter((S)sender, _state, e);
     }
 }
Пример #3
0
 public void MouseMove(UIMouseMoveEventArgs e)
 {
     if (!_isBinded)
     {
         return;
     }
     //----------------------------------------------------
     this.MouseMove(e, _htmlVisualRoot.RootCssBox);
 }
Пример #4
0
 protected override void OnMouseMove(UIMouseMoveEventArgs e)
 {
     if (e.IsDragging)
     {
         _canvasRenderE.InvalidateGraphics();
         _demoBase.MouseDrag(e.X, e.Y);
         _canvasRenderE.InvalidateGraphics();
     }
     base.OnMouseMove(e);
 }
Пример #5
0
 private void CornerBox_MouseDrag(object sender, UIMouseMoveEventArgs e)
 {
     //move only this box
     if (sender is Box box)
     {
         box.SetLocation(box.Left + e.XDiff, box.Top + e.YDiff);
         _quadRenderE.UpdateRectBounds();
         _cornersAreNotUpdated = true;
     }
     ShapeUpdated(this, EventArgs.Empty);
 }
Пример #6
0
 void IEventListener.ListenMouseMove(UIMouseMoveEventArgs e)
 {
     if (e.IsDragging)
     {
         MouseDrag?.Invoke(this, e);
     }
     else
     {
         MouseMove?.Invoke(this, e);
     }
 }
Пример #7
0
        protected override void OnMouseMove(UIMouseMoveEventArgs e)
        {
            if (_isMouseDown)
            {
                //dragging

                _renderElem.SetLocation(_renderElem.X + e.XDiff, _renderElem.Y + e.YDiff);
            }

            base.OnMouseMove(e);
        }
Пример #8
0
 internal override void ListenMouseMove(object sender, UIMouseMoveEventArgs e)
 {
     if (e.IsDragging)
     {
         if (_ownerBeh.HasMouseDrag)
         {
             _ownerBeh.InvokeMouseDrag((S)sender, _state, e);
         }
     }
     else
     {
         if (_ownerBeh.HasMouseMove)
         {
             _ownerBeh.InvokeMouseMove((S)sender, _state, e);
         }
     }
 }
Пример #9
0
        public TopWindowEventRoot(RootGraphic rootgfx, TopWindowRenderBox topRenderElement)
        {
            _mouseDownEventArgs = new UIMouseDownEventArgs();
            _mouseMoveEventArgs = new UIMouseMoveEventArgs();
            _mouseUpEventArgs   = new UIMouseUpEventArgs();
            _wheelEventArgs     = new UIMouseWheelEventArgs();


            _topWinBoxEventPortal = new RenderElementEventPortal(topRenderElement);
#if DEBUG
            _topWinBoxEventPortal.dbugRootGraphics = (MyRootGraphic)rootgfx;
#endif
            _iTopBoxEventPortal = _topWinBoxEventPortal;
            _rootgfx            = rootgfx;

            _hoverMonitoringTask          = new UIHoverMonitorTask();
            _hoverMonitoringTask.Interval = 100;//ms
            _hoverMonitoringTask.Enabled  = true;
            UIPlatform.RegisterTimerTask(_hoverMonitoringTask);
        }
Пример #10
0
        public virtual void HandleDrag(UIMouseMoveEventArgs e)
        {
            if (!_isDragBegin)
            {
                //dbugMouseDragBegin++;
                //first time
                _isDragBegin = true;
                _editSession.SetCaretPos(e.X, e.Y);
                _editSession.StartSelect();
                _editSession.EndSelect();
            }
            else
            {
                _editSession.StartSelectIfNoSelection();
                _editSession.SetCaretPos(e.X, e.Y);
                _editSession.EndSelect();
            }

            InvalidateGraphicOfCurrentSelectionArea();
        }
Пример #11
0
 public override void HandleDrag(UIMouseMoveEventArgs e)
 {
     SetCaretVisible(true);
     GetRoot().CaretStopBlink();
     base.HandleDrag(e);
 }
Пример #12
0
        public void MouseMove(UIMouseMoveEventArgs e, CssBox startAt)
        {
            if (!_isBinded)
            {
                return;
            }
            if (startAt == null)
            {
                return;
            }
            //-----------------------------------------
            int x = e.X;
            int y = e.Y;


            if (e.IsDragging && _latestMouseDownChain != null)
            {
                //dragging *** , if changed
                if (_mousedownX != x || _mousedownY != y)
                {
                    //handle mouse drag
                    CssBoxHitChain hitChain = GetFreeHitChain();
#if DEBUG
                    hitChain.debugEventPhase = CssBoxHitChain.dbugEventPhase.MouseMove;
#endif
                    hitChain.SetRootGlobalPosition(x, y);
                    BoxHitUtils.HitTest(startAt, x, y, hitChain);
                    SetEventOrigin(e, hitChain);
                    //---------------------------------------------------------
                    //propagate mouse drag
                    ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
                    {
                        portal.PortalMouseMove(e);
                        return(true);
                    });
                    //---------------------------------------------------------
                    if (!e.CancelBubbling)
                    {
                        ClearPreviousSelection();
                        if (_latestMouseDownChain.Count > 0 && hitChain.Count > 0)
                        {
                            if (_htmlVisualRoot.LayoutVersion != _lastDomLayoutVersion)
                            {
                                //the dom has been changed so...
                                //need to evaluate hitchain at mousedown position again
                                int lastRootGlobalX = _latestMouseDownChain.RootGlobalX;
                                int lastRootGlobalY = _latestMouseDownChain.RootGlobalY;
                                _latestMouseDownChain.Clear();
                                _latestMouseDownChain.SetRootGlobalPosition(lastRootGlobalX, lastRootGlobalY);
                                BoxHitUtils.HitTest(_mouseDownStartAt, lastRootGlobalX, lastRootGlobalY, _latestMouseDownChain);
                            }

                            //create selection range
                            var newSelectionRange = new SelectionRange(
                                _latestMouseDownChain,
                                hitChain,
                                _textService);
                            if (newSelectionRange.IsValid)
                            {
                                _htmlVisualRoot.SetSelection(newSelectionRange);
                            }
                            else
                            {
                                _htmlVisualRoot.SetSelection(null);
                            }
                        }
                        else
                        {
                            _htmlVisualRoot.SetSelection(null);
                        }

                        ForEachEventListenerBubbleUp(e, hitChain, () =>
                        {
                            e.CurrentContextElement.ListenMouseMove(e);
                            return(true);
                        });
                    }

                    //---------------------------------------------------------
                    ReleaseHitChain(hitChain);
                }
            }
            else
            {
                //mouse move
                //---------------------------------------------------------
                CssBoxHitChain hitChain = GetFreeHitChain();
#if DEBUG
                hitChain.debugEventPhase = CssBoxHitChain.dbugEventPhase.MouseMove;
#endif
                hitChain.SetRootGlobalPosition(x, y);
                BoxHitUtils.HitTest(startAt, x, y, hitChain);
                SetEventOrigin(e, hitChain);
                //---------------------------------------------------------

                ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
                {
                    portal.PortalMouseMove(e);
                    return(true);
                });
                //---------------------------------------------------------
                if (!e.CancelBubbling)
                {
                    ForEachEventListenerBubbleUp(e, hitChain, () =>
                    {
                        e.CurrentContextElement.ListenMouseMove(e);
                        return(true);
                    });
                }

                var cssbox = e.ExactHitObject as HtmlBoxes.CssBox;
                if (cssbox != null)
                {
                    switch (cssbox.CursorName)
                    {
                    case Css.CssCursorName.IBeam:
                        if (e.MouseCursorStyle != MouseCursorStyle.IBeam)
                        {
                            e.MouseCursorStyle = MouseCursorStyle.IBeam;
                        }
                        break;

                    case Css.CssCursorName.Hand:
                    case Css.CssCursorName.Pointer:
                        if (e.MouseCursorStyle != MouseCursorStyle.Pointer)
                        {
                            e.MouseCursorStyle = MouseCursorStyle.Pointer;
                        }
                        break;

                    case Css.CssCursorName.Default:
                        if (e.MouseCursorStyle != MouseCursorStyle.Default)
                        {
                            e.MouseCursorStyle = MouseCursorStyle.Default;
                        }
                        break;
                    }
                }
                else
                {
                    var cssspan = e.ExactHitObject as HtmlBoxes.CssTextRun;
                    if (cssspan != null)
                    {
                        cssbox = cssspan.OwnerBox;
                        switch (cssbox.CursorName)
                        {
                        default:
                            e.MouseCursorStyle = MouseCursorStyle.IBeam;
                            break;

                        case Css.CssCursorName.Hand:
                        case Css.CssCursorName.Pointer:
                            if (e.MouseCursorStyle != MouseCursorStyle.Pointer)
                            {
                                e.MouseCursorStyle = MouseCursorStyle.Pointer;
                            }
                            break;
                        }
                    }
                }
                ReleaseHitChain(hitChain);
            }
        }
Пример #13
0
        void IEventPortal.PortalMouseMove(UIMouseMoveEventArgs e)
        {
            HitChain hitPointChain = GetFreeHitChain();

#if DEBUG
            _dbugHitChainPhase = dbugHitChainPhase.MouseMove;
#endif
            HitTestCoreWithPrevChainHint(hitPointChain, _previousChain, e.X, e.Y);
            _previousChain.Reset();
            SetEventOrigin(e, hitPointChain);
            //-------------------------------------------------------
            ForEachOnlyEventPortalBubbleUp(e, hitPointChain, (e1, portal) =>
            {
                //please ensure=> no local var/pararmeter capture inside lambda
                portal.PortalMouseMove(e1);
                return(true);
            });
            //-------------------------------------------------------
            if (!e.CancelBubbling)
            {
                _mouseMoveFoundSomeHit         = false;
                _mouseMoveFoundLastMouseActive = false;
                ForEachEventListenerBubbleUp(e, hitPointChain, (e1, listener) =>
                {
                    //please ensure=> no local var/pararmeter capture inside lambda
                    _mouseMoveFoundSomeHit = true;

#if DEBUG
                    if (_dbugEnableDebugMark && e.Ctrl && e1.X <= 10 && e1.Y <= 10)
                    {
                        //show dbug info
                        listener.dbugDevWriteInfo();
                    }
#endif



                    bool _bubble = true; //temp fix
                    if (_latestMouseActive != listener && !_mouseMoveFoundLastMouseActive)
                    {
                        //----------
                        e1.CancelBubbling = _bubble; //temp fix
                        listener.ListenMouseEnter(e1);
                        _bubble = e1.CancelBubbling;
                        //----------

                        if (_latestMouseActive != null)
                        {
                            _mouseLeaveEventArgs.SetCurrentContextElement(_latestMouseActive);
                            UIMouseLeaveEventArgs.SetDiff(_mouseLeaveEventArgs, e1.XDiff, e1.YDiff);
                            _latestMouseActive.ListenMouseLeave(_mouseLeaveEventArgs);
                        }

                        _latestMouseActive = listener;
                    }


                    if (!e1.IsCanceled)
                    {
                        //TODO: review here
                        e1.CancelBubbling = _bubble; //temp fix
                        listener.ListenMouseMove(e1);

                        if (!_mouseMoveFoundLastMouseActive)
                        {
                            _latestMouseActive = e1.CurrentContextElement;
                        }
                    }

                    if (!e1.CancelBubbling)
                    {
                        _mouseMoveFoundLastMouseActive = true;
                    }
                    return(e1.CancelBubbling);
                });

                if (!_mouseMoveFoundSomeHit)
                {
                    if (_latestMouseActive != null)
                    {
                        _mouseLeaveEventArgs.IsDragging = e.IsDragging;
                        UIMouseLeaveEventArgs.SetDiff(_mouseLeaveEventArgs, e.XDiff, e.YDiff);
                        _mouseLeaveEventArgs.SetCurrentContextElement(_latestMouseActive);

                        _latestMouseActive.ListenMouseLeave(_mouseLeaveEventArgs);
                        _latestMouseActive = null;
                    }
                }
            }
            SwapHitChain(hitPointChain);
            e.StopPropagation();
        }
Пример #14
0
 public static void SetIsDragging(this UIMouseMoveEventArgs e, bool isDragging) => e.IsDragging = isDragging;
Пример #15
0
        void IEventPortal.PortalMouseMove(UIMouseMoveEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (e.IsDragging)
            {
                //dragging *** , if changed

                //handle mouse drag
                VgHitChain hitChain = GetFreeHitChain();
                hitChain.SetRootGlobalPosition(x, y);
                HitTestCore(this.SvgRoot.SvgDoc.Root, hitChain, e.X, e.Y);
                SetEventOrigin(e, hitChain);
                //---------------------------------------------------------
                //propagate mouse drag
                ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
                {
                    portal.PortalMouseMove(e);
                    return(true);
                });
                //---------------------------------------------------------
                if (!e.CancelBubbling)
                {
                    //clear previous svg selection
                    ClearPreviousSelection();
                    //if (hitChain.Count > 0)
                    //{
                    //    //create selection range
                    //    _htmlContainer.SetSelection(new SelectionRange(
                    //        _latestMouseDownChain,
                    //        hitChain,
                    //        this.ifonts));
                    //}
                    //else
                    //{
                    //    _htmlContainer.SetSelection(null);
                    //}


                    ForEachEventListenerBubbleUp(e, hitChain, () =>
                    {
                        e.CurrentContextElement.ListenMouseMove(e);
                        return(true);
                    });
                }


                //---------------------------------------------------------
                ReleaseHitChain(hitChain);
            }
            else
            {
                //mouse move
                //---------------------------------------------------------
                VgHitChain hitChain = GetFreeHitChain();
                hitChain.SetRootGlobalPosition(x, y);
                HitTestCore(this.SvgRoot.SvgDoc.Root, hitChain, e.X, e.Y);
                SetEventOrigin(e, hitChain);
                //---------------------------------------------------------

                ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
                {
                    portal.PortalMouseMove(e);
                    return(true);
                });
                //---------------------------------------------------------
                if (!e.CancelBubbling)
                {
                    ForEachEventListenerBubbleUp(e, hitChain, () =>
                    {
                        e.CurrentContextElement.ListenMouseMove(e);
                        return(true);
                    });
                }
                ReleaseHitChain(hitChain);
            }
        }
Пример #16
0
 void IEventListener.ListenMouseEnter(UIMouseMoveEventArgs e)
 {
     OnMouseEnter(e);
 }
Пример #17
0
 internal void InvokeMouseEnter(S sender, T state, UIMouseMoveEventArgs e) => MouseEnter.Invoke(new SenderInfo(sender, state), e);
Пример #18
0
 void IEventListener.ListenMouseEnter(UIMouseMoveEventArgs e)
 {
     MouseEnter?.Invoke(this, e);
 }
Пример #19
0
 internal abstract void ListenMouseMove(object sender, UIMouseMoveEventArgs e);
Пример #20
0
 void IEventListener.ListenMouseMove(UIMouseMoveEventArgs e)
 {
     OnMouseMove(e);
     _externalEventListener?.ListenMouseMove(e);
 }