From 7a645e85f86173dbfee951b37704dade547ed7ca Mon Sep 17 00:00:00 2001 From: m1aksim1 Date: Wed, 5 Oct 2022 00:52:02 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=B8=20=D0=B2=20SetPosition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarPlanes/WarPlanes/DrawningWarplane.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/WarPlanes/WarPlanes/DrawningWarplane.cs b/WarPlanes/WarPlanes/DrawningWarplane.cs index e1c0ce4..5fe61ec 100644 --- a/WarPlanes/WarPlanes/DrawningWarplane.cs +++ b/WarPlanes/WarPlanes/DrawningWarplane.cs @@ -53,16 +53,16 @@ /// Высота картинки public void SetPosition(int x, int y, int width, int height) { - _startPosX = x; - _startPosY = y; - _pictureWidth = width; - _pictureHeight = height; - - if (width <= _warplaneWidth || height <= _warplaneHeight || x < 0 || y < 0 || x > width - _warplaneWidth || y > height - _warplaneHeight) + if (width <= _warplaneWidth || height <= _warplaneHeight || x < 0 || y < 0 || x > width - _warplaneWidth || y > height - _warplaneHeight) { _pictureWidth = null; _pictureHeight = null; - } + return; + } + _startPosX = x; + _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; } /// /// Изменение направления пермещения