예제 #1
0
        public void OnClick(ref Context context)
        {
            ShapeList selectedShapes = new ShapeList(context.shapes.Get().FindAll(shape => shape.IsSelected));

            if (selectedShapes.IsNotEmpty())
            {
                ICommand c = new AddGroup(selectedShapes);
                context.undoStack.Push(c);
                context.redoStack.Clear();
                c.Execute(ref context);
            }
        }
예제 #2
0
        public void handleMouseUp(ref Context context, MouseEventArgs e)
        {
            context.drawPanel.Cursor = Cursors.Arrow;
            endPoint = new Point(e.X, e.Y);
            if (endPoint.X == initPoint.X && endPoint.Y == initPoint.Y)
            {
                return;
            }
            ShapeList shapes = new ShapeList(context.shapes.Get().FindAll(shape => shape.IsSelected));

            if (shapes.IsNotEmpty())
            {
                ICommand c = new AddMove(shapes, new Point(endPoint.X - initPoint.X, endPoint.Y - initPoint.Y));
                context.undoStack.Push(c);
                context.redoStack.Clear();
                c.Execute(ref context);
            }
        }