JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix shuffling, auto hide/show card text overflow
[peach-cgt.git] / client.coffee
index 0c54a71..6da0968 100644 (file)
@@ -298,7 +298,7 @@ init_card_designer = ->
 
        container.append ul
 
-       submit = $ $ "<div style=\"border: 1px solid black\">Done</div>"
+       submit = $ $ "<div style=\"border: 1px solid black; margin: 0 auto 10px 10px; width: 40px; text-align: center\">Done</div>"
        submit.bind 'click', ->
                $('#deck_designer').remove()
                show_message cards_in_deck
@@ -310,15 +310,17 @@ init_card_designer = ->
                                pile: "#{state.agent}_draw"
                                x: 0
                                y: 0
-                               z: next_card_z()
                                flipped: true
                        }
                        cards.push card
-                       cards.push card
-                       cards.push card
-                       cards.push card
+                       cards.push $.extend {}, card # clone
+                       cards.push $.extend {}, card # clone
+                       cards.push $.extend {}, card # clone
 
+               # asign z-index in random order
                cards.shuffle()
+               for card in cards
+                       card.z = next_card_z()
                show_message cards
 
                # let server assign card numbers