Browse Source

improved cards restoring

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

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

@@ -4,12 +4,13 @@ function DeckScope(scope) {
         options = options || {};
         this.$el = $(root);
         this.elements = { $dropPlace: "#Deck" };
-        this.proxies = [ "select", "track", "place" ];
+        this.proxies = [ "select", "track", "place", 'restoreCards' ];
         this.cards = [ [], [] ];
         this.trfs = [ [], [] ];
         this.__super__.constructor.call(this),
         this.$dropPlace.droppable({ accept: this.place });
-        // this.move = $.debounce(this.move, 25)
+
+        this.track = $.debounce(this.track, 25)
 
         this.restoredCards = [[], []]
         this.selectedPos = {}
@@ -44,6 +45,7 @@ function DeckScope(scope) {
                     },
                     card.on("dragstart", this.select),
                     card.on("dragmove", this.track),
+                    card.$el.on('revert', this.restoreCards)
                     card.$el.doubletap(function(){ 
                         scope.apiProvider.actionDiscard(card) 
                     }),