Completed Shape.cs and Program.cs
This commit is contained in:
parent
05b49929ba
commit
8342eff07e
2 changed files with 55 additions and 7 deletions
|
|
@ -33,7 +33,22 @@ void Run()
|
|||
|
||||
void HandleClick(ClickEvent @event)
|
||||
{
|
||||
// TODO - handle click at location
|
||||
// Check if clicked on existing shape
|
||||
foreach (var shape in shapes.ToList())
|
||||
{
|
||||
if (shape.PointInShape(@event.ClickedPoint))
|
||||
{
|
||||
shapes.Remove(shape);
|
||||
Console.WriteLine($"Removed shape with id {shape.Id}");
|
||||
Redraw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new shape
|
||||
var generatedShape = generator.CreateNewShape(@event.ClickedPoint);
|
||||
shapes.Add(generatedShape);
|
||||
Console.WriteLine($"Added shape with id {generatedShape.Id}");
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue