diff --git a/WarmlyLocomotive/DrawningWarmlyLocomotive.cs b/WarmlyLocomotive/DrawningWarmlyLocomotive.cs index b5896ac..1fa431d 100644 --- a/WarmlyLocomotive/DrawningWarmlyLocomotive.cs +++ b/WarmlyLocomotive/DrawningWarmlyLocomotive.cs @@ -72,19 +72,29 @@ public class DrawningWarmlyLocomotive return; } + //проверка у if ((y + _drawningLocomotiveHeight) > _pictureHeight) { _startPosY = _pictureHeight - _drawningLocomotiveHeight; } + else if(y < 0) + { + _startPosY = 0; + } else { _startPosY = y; } - + + //проверка х if ((x + _drawningLocomotiveWidth) > _pictureWidth) { _startPosX = _pictureWidth - _drawningLocomotiveWidth; } + else if(x < 0) + { + _startPosX = 0; + } else { _startPosX = x;