Ejemplo n.º 1
0
        private void BoardControl_MouseMove(object sender, MouseEventArgs e)
        {
            _currentMouseLocation = e.Location;
            _mousePressedDrawable?.MouseDrag(e.X, e.Y);

            var drawables = GetDrawablesByDepth();

            for (var i = drawables.Count - 1; i >= 0; i--)
            {
                if (drawables[i].CheckMouseOver(e.X, e.Y))
                {
                    if (_mousePressed)
                    {
                        if (_mouseOverWhilePressedDrawable == drawables[i])
                        {
                            return;
                        }

                        _mouseOverWhilePressedDrawable = drawables[i];
                        return;
                    }
                    else
                    {
                        if (_mouseOverDrawable == drawables[i])
                        {
                            return;
                        }

                        _mouseOverDrawable?.SetMouseOver(false);
                        drawables[i].SetMouseOver(true);
                        _mouseOverDrawable = drawables[i];
                        Cursor             = Cursors.Hand;
                        Refresh();
                        return;
                    }
                }
            }

            _mouseOverDrawable?.SetMouseOver(false);
            _mouseOverDrawable             = null;
            _mouseOverWhilePressedDrawable = null;
            Cursor = Cursors.Default;
            Refresh();
        }