Skip to content

Commit 9807fa3

Browse files
committed
QoL: Dragging a Map card drags all cards on top of it (except for other Maps).
1 parent a119dcb commit 9807fa3

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

card.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,9 +1855,33 @@ func (card *Card) Deselect() {
18551855

18561856
func (card *Card) StartDragging() {
18571857
if card.Draggable {
1858+
1859+
card.Dragging = true
1860+
1861+
touchingAnotherMap := false
1862+
1863+
// Dragging a Map drags everything on the map too
1864+
if card.ContentType == ContentTypeMap {
1865+
touchingCards := card.GridExtents.Grid.CardsInCardShape(card, 0, 0)
1866+
1867+
for _, other := range touchingCards {
1868+
if other.ContentType == ContentTypeMap {
1869+
touchingAnotherMap = true
1870+
break
1871+
}
1872+
}
1873+
1874+
if !touchingAnotherMap {
1875+
for _, other := range touchingCards {
1876+
if !other.Dragging && other.ContentType != ContentTypeMap {
1877+
other.StartDragging()
1878+
}
1879+
}
1880+
}
1881+
}
1882+
18581883
card.DragStart = globals.Mouse.WorldPosition()
18591884
card.DragStartOffset = card.DragStart.Sub(Vector{card.Rect.X, card.Rect.Y})
1860-
card.Dragging = true
18611885
card.CreateUndoState = true // TODO: DON'T FORGET TO DO THIS WHEN MOVING CARDS VIA SHORTCUTS
18621886

18631887
PlayUISound(UISoundTypeToggleOff)

0 commit comments

Comments
 (0)