mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 17:14:52 -07:00
don't autoclose card view if single card gets dragged into same zone (#5517)
* rename canResize param to toNewZone * pass toNewZone down * don't autoclose card view if card gets dragged into same zone
This commit is contained in:
parent
085f0dd26c
commit
e8b1e3ef0c
5 changed files with 18 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -365,7 +370,7 @@ void ZoneViewZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
|||
player->sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void ZoneViewZone::removeCard(int position)
|
||||
void ZoneViewZone::removeCard(int position, bool toNewZone)
|
||||
{
|
||||
if (isReversed) {
|
||||
position -= cards.first()->getId();
|
||||
|
|
@ -382,7 +387,11 @@ void ZoneViewZone::removeCard(int position)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue