Лабораторная работа 1
This commit is contained in:
parent
02f8cc514d
commit
af92c80989
@ -66,13 +66,13 @@ public class DrawningTrolleybus
|
||||
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (_pictureWidth < _drawningTrolleybusWidth || _pictureHeight < _drawningTrolleybusHeight)
|
||||
if (width> _drawningTrolleybusWidth || height > _drawningTrolleybusHeight)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
|
||||
|
||||
if (_startPosY.HasValue && _startPosX.HasValue)
|
||||
{
|
||||
if (_startPosX + _drawningTrolleybusWidth > width)
|
||||
@ -89,28 +89,31 @@ public class DrawningTrolleybus
|
||||
|
||||
|
||||
}
|
||||
if (width < 0)
|
||||
if (_startPosX < 0)
|
||||
{
|
||||
width = 0;
|
||||
_startPosX = 0;
|
||||
}
|
||||
if (height < 0)
|
||||
if (_startPosY < 0)
|
||||
{
|
||||
height = 0;
|
||||
_startPosY = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
@ -123,6 +126,12 @@ public class DrawningTrolleybus
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
|
||||
|
||||
if (_startPosX < 0)
|
||||
{ _startPosX = 0; }
|
||||
if (_startPosY < 0)
|
||||
@ -144,14 +153,6 @@ public class DrawningTrolleybus
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
|
Loading…
Reference in New Issue
Block a user