From 1da80c53ca03b537822343fab29bb84f4fcff1c7 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 15 Jul 2024 19:41:13 -0400 Subject: [PATCH] fix: Fix positioning and size of the scoreboard panel --- lib/game/components/score_box.dart | 2 +- lib/game/components/score_panel.dart | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/game/components/score_box.dart b/lib/game/components/score_box.dart index f85e628..2945846 100644 --- a/lib/game/components/score_box.dart +++ b/lib/game/components/score_box.dart @@ -43,7 +43,7 @@ class ScoreBox extends PositionComponent void onLoad() { final availableHeight = game.size.y - 2 * screenMargin; size = Vector2(scoreBoxWidth, availableHeight / maxShips - scoreBoxMargin); - rRect = RRect.fromRectAndRadius(Vector2.zero() & size, _radius); + rRect = RRect.fromRectAndRadius(Vector2(scoreBoxMargin, 0) & size, _radius); } @override diff --git a/lib/game/components/score_panel.dart b/lib/game/components/score_panel.dart index 888fc27..8c43c52 100644 --- a/lib/game/components/score_panel.dart +++ b/lib/game/components/score_panel.dart @@ -11,8 +11,9 @@ class ScorePanel extends RectangleComponent with HasGameReference { @override void onLoad() { - position = Vector2(fixedSize.x - scoreBoxWidth, 0) - fixedSize / 2; - size = Vector2(scoreBoxWidth, fixedSize.y); + final left = fixedSize.x - scoreBoxWidth - 2 * scoreBoxMargin; + position = Vector2(left, screenMargin) - fixedSize / 2; + size = Vector2(scoreBoxWidth, fixedSize.y - screenMargin * 2); paint = Paint()..color = GamePalette.black; addAll( game.ships.values.map(