Sync command zone visibility on construction and reflow stack on height change

- Sync command zone visibility in the PlayerGraphicsItem constructor in case processPlayerInfo runs before the signal is connected.
    - Emit CommandZone::effectiveHeightChanged() when a minimized zone's height changes so the stack zone repositions.
This commit is contained in:
DawnFire42 2026-06-19 11:40:46 -04:00
parent 4c60fd2ebd
commit f74f83c5ec
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
3 changed files with 15 additions and 5 deletions

View file

@ -66,6 +66,8 @@ PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
connect(player, &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
&PlayerGraphicsItem::onCustomZoneAdded);
connect(player, &PlayerLogic::commandZoneSupportChanged, this, &PlayerGraphicsItem::setCommandZoneVisible);
// Sync initial state in case processPlayerInfo already ran before this connection.
setCommandZoneVisible(player->hasServerCommandZone());
playerMenu->setMenusForGraphicItems();
@ -131,6 +133,7 @@ void PlayerGraphicsItem::initializeZones()
commandZoneGraphicsItem->setZValue(ZValues::COMMAND_ZONE);
commandZoneGraphicsItem->setVisible(false);
connect(commandZoneGraphicsItem, &CommandZone::minimizedChanged, this, &PlayerGraphicsItem::rearrangeZones);
connect(commandZoneGraphicsItem, &CommandZone::effectiveHeightChanged, this, &PlayerGraphicsItem::rearrangeZones);
connect(handZoneGraphicsItem->getLogic(), &HandZoneLogic::cardCountChanged, handCounter,
&HandCounter::updateNumber);