Добавлены проверки, что новая позиция и размеры объекта валидны в классе DrawingBoat
This commit is contained in:
parent
3eabfb5fd0
commit
6a05b662aa
@ -61,7 +61,15 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
|
||||
/// <param name="height">Высота картинки</param>
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
{
|
||||
// TODO проверки
|
||||
// Проверки, что новая позиция и размеры объекта валидны
|
||||
if (width < 0 || height < 0 || width > _pictureWidth || height > _pictureHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (x < 0 || y < 0 || x >= _pictureWidth - width || y >= _pictureHeight - height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
_pictureWidth = width;
|
||||
|
Loading…
x
Reference in New Issue
Block a user