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:
commit
2d18ba6408
@ -469,6 +469,8 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
|||||||
variables["totalPlayers"].Integer() = totalPlayers;
|
variables["totalPlayers"].Integer() = totalPlayers;
|
||||||
|
|
||||||
pos.w = variables["windowSize"]["x"].Integer() + totalPlayers * variables["cellMargin"]["x"].Integer();
|
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();
|
pos.h = variables["windowSize"]["y"].Integer() + totalPlayers * variables["cellMargin"]["y"].Integer();
|
||||||
variables["backgroundRect"]["x"].Integer() = 0;
|
variables["backgroundRect"]["x"].Integer() = 0;
|
||||||
variables["backgroundRect"]["y"].Integer() = 0;
|
variables["backgroundRect"]["y"].Integer() = 0;
|
||||||
@ -553,7 +555,7 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
|||||||
|
|
||||||
for(int teamId = 0; teamId < totalPlayers; ++teamId)
|
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();
|
variables["point"]["y"].Integer() = variables["cellOffset"]["y"].Integer() + teamId * variables["cellMargin"]["y"].Integer();
|
||||||
auto button = buildWidget(variables["button"]);
|
auto button = buildWidget(variables["button"]);
|
||||||
players.back()->addToggle(teamId, std::dynamic_pointer_cast<CToggleBase>(button));
|
players.back()->addToggle(teamId, std::dynamic_pointer_cast<CToggleBase>(button));
|
||||||
|
Loading…
Reference in New Issue
Block a user