Beispiel #1
0
        private void DrawingArea_MouseMove(object sender, MouseEventArgs e)
        {
            if (ignoreMouse)
            {
                ignoreMouse = false;
                return;
            }
            int DragSpeed = (int)Math.Ceiling(16 * zoom);

            int xx = (int)(e.X / zoom) + ViewablePixels.X;
            int yy = (int)(e.Y / zoom) + ViewablePixels.Y;

            if (scrollingDrag)
            {
                int NewX   = e.X;
                int NewY   = e.Y;
                int XDelta = (int)((NewX - DragStartX) / zoom);
                int YDelta = (int)((NewY - DragStartY) / zoom);
                if (XDelta != 0 || YDelta != 0)
                {
                    Point NewPosition = new Point(ViewablePixels.X - XDelta, ViewablePixels.Y - YDelta);
                    if (NewPosition.X < 0)
                    {
                        NewPosition.X = 0;
                    }
                    if (NewPosition.X > hScrollBar.Maximum - hScrollBar.LargeChange)
                    {
                        NewPosition.X = hScrollBar.Maximum - hScrollBar.LargeChange;
                    }
                    if (NewPosition.Y < 0)
                    {
                        NewPosition.Y = 0;
                    }
                    if (NewPosition.Y > vScrollBar.Maximum - vScrollBar.LargeChange)
                    {
                        NewPosition.Y = vScrollBar.Maximum - vScrollBar.LargeChange;
                    }
                    DragStartX = NewX;
                    DragStartY = NewY;
                    ScrollEditorPixel(NewPosition);
                }
            }
            else if ((e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) && Ready && mode != null)
            {
                mode.MouseDrag(xx, yy);
            }
            else
            {
                mode.MouseMove(xx, yy);
            }

            if (showDSScreen)
            {
                dsScreenX = xx - 128;
                dsScreenY = yy - 96;
                repaint();
            }
        }
Beispiel #2
0
        private void DrawingArea_MouseMove(object sender, MouseEventArgs e)
        {
            if (ignoreMouse)
            {
                ignoreMouse = false;
                return;
            }
            int DragSpeed = (int)Math.Ceiling(16 * zoom);

            int xx = (int)((e.X + ViewablePixels.X * zoom) / zoom);
            int yy = (int)((e.Y + ViewablePixels.Y * zoom) / zoom);

            if (scrollingDrag)
            {
                int NewX   = e.X;
                int NewY   = e.Y;
                int XDelta = NewX - DragStartX;
                int YDelta = NewY - DragStartY;
                ScrollEditorPixel(new Point(hScrollBar.Value - XDelta, vScrollBar.Value - YDelta));
                DragStartX = NewX;
                DragStartY = NewY;
            }
            else if ((e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) && Ready && mode != null)
            {
                mode.MouseDrag(xx, yy);
            }
            else
            {
                mode.MouseMove(xx, yy);
            }

            if (showDSScreen)
            {
                dsScreenX = xx - 128;
                dsScreenY = yy - 96;
                repaint();
            }
        }