Browse Source

fixed issue Card Multiselect Issues #13

Vladimir Bykov 11 years ago
parent
commit
070ad055e0
2 changed files with 11 additions and 1 deletions
  1. 1 1
      apps/web/priv/static/app/js/okey/card.js
  2. 10 0
      apps/web/priv/static/app/js/okey/deck.js

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

@@ -58,7 +58,7 @@ function CardScope(scope) {
             return Math.round(pos.left + width / 2);
         },
         toggle: function(e) {
-            e.stopPropagation(), selStart ? this.nearSelectGroup() ? this.selected && !this.betweenSelected() ? this.uncheck() : this.check() : (Card.uncheckAll(), 
+            e.stopPropagation(), selStart && deck.contains(this) ? this.nearSelectGroup() ? this.selected && !this.betweenSelected() ? this.uncheck() : this.check() : (Card.uncheckAll(), 
             this.check()) : ~Card.selected.indexOf(this) || Card.uncheckAll();
         },
         check: function() {

+ 10 - 0
apps/web/priv/static/app/js/okey/deck.js

@@ -182,6 +182,16 @@ function DeckScope(scope) {
                         scope.CARD_COLORS.indexOf(card.color) + 1, card.value)); }), result;
         },
 
+        contains: function(card){
+            var result = false
+            this.each(function(c){
+                if(c == card){
+                    result = true
+                }
+            })
+            return result
+        },
+
         dir: function() {
             for (var i = 0; 15 > i; i++) this.cards[0][i] && this.cards[0][i].log();
             for (var i = 0; 15 > i; i++) this.cards[1][i] && this.cards[1][i].log();