mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-08-06 02:33:48 -05:00
Fix card position when added to the stack (#7041)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Fedora, RPM, 44) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Fedora, RPM, skip, 43) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Servatrice_Debian, DEB, yes, skip, 12) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Ubuntu, DEB, 26.04) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Ubuntu, DEB, skip, 24.04) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, -macOS14, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-14, Apple, 14, Release, 1, 15.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, -macOS15, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15, Apple, 15, Release, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, 13, -macOS13_Intel, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15-intel, Intel, 13, Re… (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, macOS, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15, Apple, 15, Debug, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Visual Studio 18 2026, x64, 1, Windows, -Win10, qtimageformats qtmultimedia qtwebsockets, 6.11.0, windows-2025, 10, Rele… (push) Has been cancelled
Update Translations / Pull languages (push) Has been cancelled
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Fedora, RPM, 44) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Fedora, RPM, skip, 43) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Servatrice_Debian, DEB, yes, skip, 12) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Ubuntu, DEB, 26.04) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (Ubuntu, DEB, skip, 24.04) (push) Has been cancelled
Build Desktop / ${{ matrix.distro }} ${{ matrix.version }} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, -macOS14, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-14, Apple, 14, Release, 1, 15.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, -macOS15, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15, Apple, 15, Release, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, 1, macOS, 13, -macOS13_Intel, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15-intel, Intel, 13, Re… (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (7d, Ninja, macOS, qtimageformats qtmultimedia qtwebsockets, 6.11.0, macos-15, Apple, 15, Debug, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Visual Studio 18 2026, x64, 1, Windows, -Win10, qtimageformats qtmultimedia qtwebsockets, 6.11.0, windows-2025, 10, Rele… (push) Has been cancelled
Update Translations / Pull languages (push) Has been cancelled
This commit is contained in:
parent
6c960fdf31
commit
5bb6073422
|
|
@ -43,12 +43,18 @@ void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
|||
return;
|
||||
}
|
||||
|
||||
int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
||||
|
||||
// Same-zone no-op: don't move a card onto itself
|
||||
const auto &cards = getLogic()->getCards();
|
||||
if (!cards.isEmpty() && startZone == getLogic() && cards.at(index)->getId() == dragItems.at(0)->getId()) {
|
||||
return;
|
||||
int index;
|
||||
if (startZone == getLogic()) {
|
||||
// Reordering within the zone: use drop position
|
||||
index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
||||
// Same-zone no-op: don't move a card onto itself
|
||||
if (!cards.isEmpty() && cards.at(index)->getId() == dragItems.at(0)->getId()) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Coming from another zone: append at end (top of stack, rendered on top)
|
||||
index = static_cast<int>(cards.size());
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user