From 665d472714d54f9c72e5ec021075a0adec9954e6 Mon Sep 17 00:00:00 2001 From: Baryshev Dmitry Date: Thu, 29 Feb 2024 21:53:46 +0400 Subject: [PATCH] ura vse cool --- .../ProjectDumpTruck/DrawningDumpTruck.cs | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/ProjectDumpTruck/ProjectDumpTruck/DrawningDumpTruck.cs b/ProjectDumpTruck/ProjectDumpTruck/DrawningDumpTruck.cs index 072e350..cf289d1 100644 --- a/ProjectDumpTruck/ProjectDumpTruck/DrawningDumpTruck.cs +++ b/ProjectDumpTruck/ProjectDumpTruck/DrawningDumpTruck.cs @@ -34,11 +34,11 @@ internal class DrawningDumpTruck /// /// Ширина прорисовки автомобиля /// - private readonly int _drawningTruckWidth = 60; + private readonly int _drawningTruckWidth = 135; /// /// Высота прорисовки автомобиля /// - private readonly int _drawningTruckHeight = 110; + private readonly int _drawningTruckHeight = 85; /// /// Инициализация свойств /// @@ -99,30 +99,27 @@ internal class DrawningDumpTruck { - _startPosX = x; - _startPosY=y; + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + else + { + _startPosX = x; + _startPosY = y; - //if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) - //{ - // return; - //} - //else - //{ - // _startPosX = x; - // _startPosY = y; + if (_startPosX < 0) _startPosX = 0; + if (_startPosY < 0) _startPosY = 0; - // if (_startPosX < 0) _startPosX = 0; - // if (_startPosY < 0) _startPosY = 0; - - // if (_startPosX + _drawningTruckWidth > _pictureWidth.Value) - // { - // _startPosX = _pictureWidth.Value - _drawningTruckWidth; - // } - // if (_startPosY + _drawningTruckHeight > _pictureHeight.Value) - // { - // _startPosY = _pictureHeight.Value - _drawningTruckHeight; - // } - //} + if (_startPosX + _drawningTruckWidth > _pictureWidth.Value) + { + _startPosX = _pictureWidth.Value - _drawningTruckWidth; + } + if (_startPosY + _drawningTruckHeight > _pictureHeight.Value) + { + _startPosY = _pictureHeight.Value - _drawningTruckHeight; + } + } } public bool MoveTransport(DirectionType direction)