Пример #1
0
 public CommandMove(CanvasShape shape, Point initialPos, MainWindow mainWindow)
 {
     this.mainWindow = mainWindow;
     this.shape      = shape;
     oldPos.X        = (int)MathF.Round((float)Canvas.GetLeft(shape.GetShape()));
     oldPos.Y        = (int)MathF.Round((float)Canvas.GetTop(shape.GetShape()));
     offset.X        = initialPos.X - Canvas.GetLeft(shape.GetShape());
     offset.Y        = initialPos.Y - Canvas.GetTop(shape.GetShape());
 }
Пример #2
0
        public void Execute()
        {
            Point absolutePos = CurrMouseEventArgs.GetPosition(mainWindow.canvas);

            int x = Convert.ToInt32(absolutePos.X - offset.X);
            int y = Convert.ToInt32(absolutePos.Y - offset.Y);

            System.Drawing.Point newPoint = new System.Drawing.Point(x, y);

            mainWindow.SetCanvasOffset(newPoint, shape.GetShape());
            shape.decorator?.Draw();
        }
Пример #3
0
        public void Execute()
        {
            double factor = wheelDelta;

            if (Math.Sign(factor) != -1)
            {
                shape.GetShape().Width  *= factor * Multiplier; // * multiplier;
                shape.GetShape().Height *= factor * Multiplier; // * multiplier;
            }
            else
            {
                shape.GetShape().Width  /= Math.Abs(factor) * Multiplier; // * multiplier;
                shape.GetShape().Height /= Math.Abs(factor) * Multiplier; // * multiplier;
            }
        }
Пример #4
0
        public void VisitCanvasShape(CanvasShape e)
        {
            string postLine;
            string type   = e.GetName().Split(' ')[1];;
            string indent = "";
            double x      = Canvas.GetLeft(e.GetShape());
            double y      = Canvas.GetTop(e.GetShape());
            double h      = e.GetShape().Width;
            double w      = e.GetShape().Height;

            postLine = " " + x + " " + y + " " + h + " " + w;
            for (int i = 0; i < e.GetDepth(); i++)
            {
                indent += "    ";
            }

            string line = indent + type + postLine;

            buffer.Add(line);
        }