Example #1
0
        private void bufferedPanel1_MouseMove(object sender, MouseEventArgs e)
        {
            if ((e.X == _lastX) && (e.Y == _lastY))
            {
                return;
            }

            _lastX = e.X;
            _lastY = e.Y;

            int    mouseXPos = _state.WindowXToRoom(e.X);
            int    mouseYPos = _state.WindowYToRoom(e.Y);
            string xPosText  = mouseXPos.ToString();
            string yPosText  = mouseYPos.ToString();

            if ((mouseXPos < 0) || (mouseXPos >= _room.Width))
            {
                xPosText = "?";
            }
            if ((mouseYPos < 0) || (mouseYPos >= _room.Height))
            {
                yPosText = "?";
            }
            lblMousePos.Text = $"{xPosText}, {yPosText}";

            SelectCursor(e.X, e.Y, _state);
            if (_layer != null && !IsLocked(_layer))
            {
                if (_layer.MouseMove(e.X, e.Y, _state))
                {
                    bufferedPanel1.Invalidate();
                }
            }
        }
Example #2
0
        private void bufferedPanel1_MouseMove(object sender, MouseEventArgs e)
        {
            if ((e.X == _lastX) && (e.Y == _lastY))
            {
                return;
            }

            _lastX = e.X;
            _lastY = e.Y;
            _state.CurrentCursor = Cursors.Default;

            int    mouseXPos = ((e.X + _state.ScrollOffsetX) / _state.ScaleFactor);
            int    mouseYPos = ((e.Y + _state.ScrollOffsetY) / _state.ScaleFactor);
            string xPosText  = mouseXPos.ToString();
            string yPosText  = mouseYPos.ToString();

            if ((mouseXPos < 0) || (mouseXPos >= _room.Width))
            {
                xPosText = "?";
            }
            if ((mouseYPos < 0) || (mouseYPos >= _room.Height))
            {
                yPosText = "?";
            }
            lblMousePos.Text = "Mouse Position: " + xPosText + ", " + yPosText;

            if (_filter.MouseMove(e.X, e.Y, _state))
            {
                bufferedPanel1.Invalidate();
            }
            bufferedPanel1.Cursor = _state.CurrentCursor;
        }