minor fix 2

This commit is contained in:
strwbrry1 2024-02-21 15:23:31 +04:00
parent 29891204b0
commit 051f96a96e
2 changed files with 14 additions and 21 deletions

View File

@ -39,6 +39,20 @@ namespace Catamaran
{
_pictureWidth = width;
_pictureHeight = height;
if (_startPosX != null && _startPosY != null)
{
if (_startPosX.Value < 0) _startPosX = 0;
if (_startPosY.Value < 0) _startPosY = 0;
if (_startPosX.Value + _drawingCatamaranWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingCatamaranWidth;
}
if (_startPosY.Value + _drawingCatamaranHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingCatamaranHeight;
}
}
return true;
}
return false;
@ -67,26 +81,6 @@ namespace Catamaran
}
public void CheckPos()
{
//if ((!_startPosX.HasValue || !_startPosY.HasValue) && (!_pictureHeight.HasValue || !_pictureWidth.HasValue))
//{
// return;
//}
if (_startPosX == null || _startPosY == null)
{
return;
}
if (_startPosX.Value + _drawingCatamaranWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingCatamaranWidth;
}
if (_startPosY.Value + _drawingCatamaranHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingCatamaranHeight;
}
}
public bool MoveTransport(DirectionType direction)
{
if (EntityCatamaran == null || !_startPosX.HasValue || !_startPosY.HasValue)

View File

@ -79,7 +79,6 @@ namespace Catamaran
if (_drawingCatamaran.SetPictureSize(pictureBox1.Width, pictureBox1.Height))
{
_drawingCatamaran.CheckPos();
Draw();
}