1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00

Merge pull request #4963 from Laserlicht/randommap_button

fix misaligned button in randommap
This commit is contained in:
Ivan Savenko 2024-11-25 13:42:20 +02:00 committed by GitHub
commit 2d18ba6408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -469,6 +469,8 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
variables["totalPlayers"].Integer() = totalPlayers;
pos.w = variables["windowSize"]["x"].Integer() + totalPlayers * variables["cellMargin"]["x"].Integer();
auto widthExtend = std::max(pos.w, 220) - pos.w; // too small for buttons
pos.w += widthExtend;
pos.h = variables["windowSize"]["y"].Integer() + totalPlayers * variables["cellMargin"]["y"].Integer();
variables["backgroundRect"]["x"].Integer() = 0;
variables["backgroundRect"]["y"].Integer() = 0;
@ -553,7 +555,7 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
for(int teamId = 0; teamId < totalPlayers; ++teamId)
{
variables["point"]["x"].Integer() = variables["cellOffset"]["x"].Integer() + plId * variables["cellMargin"]["x"].Integer();
variables["point"]["x"].Integer() = variables["cellOffset"]["x"].Integer() + plId * variables["cellMargin"]["x"].Integer() + (widthExtend / 2);
variables["point"]["y"].Integer() = variables["cellOffset"]["y"].Integer() + teamId * variables["cellMargin"]["y"].Integer();
auto button = buildWidget(variables["button"]);
players.back()->addToggle(teamId, std::dynamic_pointer_cast<CToggleBase>(button));