From a956864614c2d7fd4b79ab551bb50a6c7ff49a5f Mon Sep 17 00:00:00 2001 From: RickyRister Date: Tue, 21 Jan 2025 23:43:29 -0800 Subject: [PATCH] don't autoclose card view if card gets dragged into same zone --- cockatrice/src/game/zones/view_zone.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/game/zones/view_zone.cpp b/cockatrice/src/game/zones/view_zone.cpp index c5b46eb02..d86e71f90 100644 --- a/cockatrice/src/game/zones/view_zone.cpp +++ b/cockatrice/src/game/zones/view_zone.cpp @@ -315,6 +315,11 @@ bool ZoneViewZone::prepareAddCard(int x) } } + // autoclose check is done both here and in removeCard + if (cards.isEmpty() && !doInsert && SettingsCache::instance().getCloseEmptyCardView()) { + close(); + } + return doInsert; } @@ -382,7 +387,11 @@ void ZoneViewZone::removeCard(int position, bool toNewZone) CardItem *card = cards.takeAt(position); card->deleteLater(); - if (cards.isEmpty() && SettingsCache::instance().getCloseEmptyCardView()) { + // The toNewZone check is to prevent the view from auto-closing if the view contains only a single card and that + // card gets dragged within the view. + // Another autoclose check is done in prepareAddCard so that the view autocloses if the last card was moved to an + // unrevealed portion of the same zone. + if (cards.isEmpty() && SettingsCache::instance().getCloseEmptyCardView() && toNewZone) { close(); return; }