This commit is contained in:
Salikh 2023-12-16 01:45:32 +04:00
parent c768bdc104
commit 4d2629e9ec

View File

@ -52,13 +52,13 @@ namespace AirBomber.DrawningObjects
}
public void SetPosition(int x, int y)
{
if (_startPosX + _PlaneWidth > _pictureWidth)
if (x < 0 || x + _PlaneWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _PlaneWidth;
x = _pictureWidth - _PlaneWidth;
}
if (_startPosY + _PlaneHeight > 740)
if (y < 0 || y + _PlaneWidth > _pictureHeight)
{
_startPosY = 740 - _PlaneHeight;
y = _pictureHeight - _PlaneWidth;
}
_startPosX = x;
_startPosY = y;