From 8cfe62a06454938b2e583e9ec10f73707d1b22b3 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 21 Jul 2026 11:25:00 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=8D=D1=84=D1=84=D0=B5=D0=BA=D1=82=20?= =?UTF-8?q?=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=88=D0=B8=D1=80=D0=B8=D0=BD=D1=8B=20=D1=80=D0=B0=D0=BA=D0=B5?= =?UTF-8?q?=D1=82=D0=BA=D0=B8,=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20Ni?= =?UTF-8?q?neSliceSprite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/view.js b/src/view.js index ebd816e..e2f166a 100644 --- a/src/view.js +++ b/src/view.js @@ -41,8 +41,9 @@ function createBallView(ball, textures) { function createPaddleView(paddle, textures) { const texture = textures['/sprites/paddle.png']; const paddleSprite = new NineSliceSprite({ texture, leftWidth: 150, rightWidth: 150, topHeight: 0, bottomHeight: 0 }); - paddleSprite.width = paddle.width; - paddleSprite.height = paddle.height; + const paddleAspectRatio = paddle.height / texture.height; + paddleSprite.scale.set(paddleAspectRatio); + paddleSprite.width = paddle.width / paddleAspectRatio; return paddleSprite; } @@ -174,8 +175,9 @@ export function createGameView(game, container, textures) { * @param {object} textures объект с текстурами для визуального отображения */ export function managePerkViewsLifetime(views, game, container, textures) { - if (views.paddle.width !== game.paddle.width) { - views.paddle.width = game.paddle.width; + // Изменяем ширину отображения ракетки основываясь на aspect ratio по оси X и ширине ракетки + if (views.paddle.width * views.paddle.scale.x !== game.paddle.width) { + views.paddle.width = game.paddle.width / views.paddle.scale.x; } for (const [ball, ballView] of views.balls) {