implement
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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!,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user