Изменение SetPictureSize в DrawingSeaplane

This commit is contained in:
Никита Шипилов 2024-02-19 01:08:19 +04:00
parent 127241a449
commit d8fa13de94

View File

@ -35,8 +35,27 @@ public class DrawingSeaplane
public bool SetPictureSize(int width, int height)
{
_pictureHeight = height;
if (_drawingSeaplaneWidth > width || _drawingSeaplaneHeight > height)
{
return false;
}
_pictureWidth = width;
_pictureHeight = height;
if (_startPosX.HasValue || _startPosY.HasValue)
{
if (_startPosX + _drawingSeaplaneWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingSeaplaneWidth;
}
else if (_startPosX < 0) _startPosX = 0;
if (_startPosY + _drawingSeaplaneHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingSeaplaneHeight;
}
else if (_startPosY < 0) _startPosY = 0;
}
return true;
}
@ -144,7 +163,7 @@ public class DrawingSeaplane
new Point(_startPosX.Value + 190, _startPosY.Value + 20)
};
g.DrawPolygon(pen, pointsFaceBottom);
Point[] pointsKeel = {
new Point(_startPosX.Value + 10, _startPosY.Value - 30),
new Point(_startPosX.Value + 10, _startPosY.Value + 5),