Browse Source

fixed drop direction method

Vladimir Bykov 10 years ago
parent
commit
0fbe51d00a
1 changed files with 6 additions and 4 deletions
  1. 6 4
      apps/web/priv/static/app/js/okey/deck.js

+ 6 - 4
apps/web/priv/static/app/js/okey/deck.js

@@ -109,9 +109,11 @@ function DeckScope(scope) {
                     if(card){
                         card.direction = null
                     }
-                    card = this.restoredCards[j][i]
-                    if(card){
-                        card.direction = null
+                    if(this.restoredCards){
+                        card = this.restoredCards[j][i]
+                        if(card){
+                            card.direction = null
+                        }
                     }
                 }
             }
@@ -284,7 +286,6 @@ function DeckScope(scope) {
                                 }
                                 ;(this.cards[posY][posX] = card).pos = {x:posX,y:posY}
                                 this.normalizeCards()
-                                this.dropDiraction()
                                 this.restoredCards = null
                                 selected = null
                             }
@@ -299,6 +300,7 @@ function DeckScope(scope) {
                             }(card))
                         }
                     }
+                    this.dropDiraction()
                 }
                 return dropResult
             }