Лабораторная работа №1
This commit is contained in:
parent
4a17242de7
commit
9e4beecdc6
@ -33,7 +33,7 @@ public class DrawingExcavator
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки экскаватора
|
/// Ширина прорисовки экскаватора
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningExcavatorWidth = 175;
|
private readonly int _drawningExcavatorWidth = 174;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота прорисовки экскаватора
|
/// Высота прорисовки экскаватора
|
||||||
@ -74,9 +74,20 @@ public class DrawingExcavator
|
|||||||
{
|
{
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
_pictureHeight = height;
|
_pictureHeight = height;
|
||||||
|
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||||
|
{
|
||||||
|
if (_startPosX+_drawningExcavatorWidth>=_pictureWidth
|
||||||
|
|| _startPosY+_drawningExcavatorHeight>=_pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosX = 0;
|
||||||
|
_startPosY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else { return false; }
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -90,16 +101,21 @@ public class DrawingExcavator
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (x > 0 && y > 0 && x + _drawningExcavatorWidth < _pictureWidth && _drawningExcavatorHeight + y < _pictureHeight)
|
if (x + _drawningExcavatorWidth < _pictureWidth && _drawningExcavatorHeight + y < _pictureHeight && x>0 && y>0)
|
||||||
{
|
{
|
||||||
_startPosX = x;
|
_startPosX = x;
|
||||||
_startPosY = y;
|
_startPosY = y;
|
||||||
}
|
}
|
||||||
else
|
if (x + _drawningExcavatorWidth >_pictureWidth || x < 0)
|
||||||
{
|
{
|
||||||
_startPosX = 10;
|
_startPosX = 0;
|
||||||
_startPosY = 10;
|
|
||||||
}
|
}
|
||||||
|
if (y+_drawningExcavatorHeight > _pictureHeight || y < 0)
|
||||||
|
{
|
||||||
|
_startPosY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user