implement

This commit is contained in:
2026-02-17 00:48:28 +01:00
parent 0119c7a737
commit 5c7909034f
57 changed files with 1676 additions and 114 deletions

View File

@@ -7,4 +7,11 @@ public class Arrow : Shape
public Position EndPosition { get; set; }
public int Thickness { get; set; }
public override void Move(Position newPosition)
{
var difference = newPosition - EndPosition;
EndPosition += difference;
base.Move(newPosition);
}
}

View File

@@ -7,4 +7,11 @@ public class Line : Shape
public Position EndPosition { get; set; }
public int Thickness { get; set; }
public override void Move(Position newPosition)
{
var difference = newPosition - EndPosition;
EndPosition += difference;
base.Move(newPosition);
}
}

View File

@@ -11,6 +11,7 @@ public static class ShapeMappingExtensions
return new Rectangle()
{
Id = shape.Id,
OwnerId = shape.AuthorId,
Position = new Position(shape.PositionX, shape.PositionY),
Color = shape.Color,
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
@@ -23,6 +24,7 @@ public static class ShapeMappingExtensions
return new Arrow()
{
Id = shape.Id,
OwnerId = shape.AuthorId,
Position = new Position(shape.PositionX, shape.PositionY),
Color = shape.Color,
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
@@ -35,6 +37,7 @@ public static class ShapeMappingExtensions
return new Line()
{
Id = shape.Id,
OwnerId = shape.AuthorId,
Position = new Position(shape.PositionX, shape.PositionY),
Color = shape.Color,
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
@@ -47,6 +50,7 @@ public static class ShapeMappingExtensions
return new TextShape()
{
Id = shape.Id,
OwnerId = shape.AuthorId,
Position = new Position(shape.PositionX, shape.PositionY),
Color = shape.Color,
TextValue = shape.TextValue!,

View File

@@ -7,4 +7,11 @@ public class Rectangle : Shape
public Position EndPosition { get; set; }
public int BorderThickness { get; set; }
public override void Move(Position newPosition)
{
var difference = newPosition - Position;
EndPosition += difference;
base.Move(newPosition);
}
}

View File

@@ -11,4 +11,9 @@ public abstract class Shape
public Position Position { get; set; }
public string Color { get; set; }
public virtual void Move(Position newPosition)
{
Position = newPosition;
}
}

View File

@@ -10,4 +10,14 @@ public struct Position
X = x;
Y = y;
}
public static Position operator -(Position position, Position otherPosition)
{
return new Position(position.X - otherPosition.X, position.Y - otherPosition.Y);
}
public static Position operator +(Position position, Position otherPosition)
{
return new Position(position.X + otherPosition.X, position.Y + otherPosition.Y);
}
}