Browse Source

tried to fix issue: Deck is inconsistent #11

Vladimir Bykov 11 years ago
parent
commit
e397bf656e
2 changed files with 5 additions and 1 deletions
  1. 2 1
      apps/web/priv/static/app/js/okey/okey.js
  2. 3 0
      apps/web/priv/static/app/js/timer.js

+ 2 - 1
apps/web/priv/static/app/js/okey/okey.js

@@ -103,6 +103,7 @@ function PostLoad()
                 });
             }
 
+            playersMap[scope.user].timer.on('beforeTimerEnd', function(){ scope.Draggable.revert() })
 
             scope.started = !0;
         }
@@ -189,7 +190,7 @@ function PostLoad()
         }
 
         if(e.detail.player == scope.user){
-            scope.Draggable.revert()
+            // scope.Draggable.revert()
             deck.insert(e.detail.revealed)
         }
         centralCard.dragHandler.disable()

+ 3 - 0
apps/web/priv/static/app/js/timer.js

@@ -33,6 +33,9 @@ function TimerScope(scope) {
                 dur: this.curTime
             }),
             this.timerId = this.withDelay(this.tick, 1e3);
+            this.withDelay(function(){
+                this.$el.trigger('beforeTimerEnd')
+            }, this.duration*1e3-500)
         },
         tick: function() {
             return this.paused