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); } }
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); } }