Ignore moves if shift/alt/control key pressed.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 11 Sep 2014 18:12:24 +0300
changeset 52 e4e21d2fcbe7
parent 51 c92358daee56
child 53 ee53cd2cb69a
Ignore moves if shift/alt/control key pressed.
2048.html
--- a/2048.html	Thu Sep 11 03:44:11 2014 +0300
+++ b/2048.html	Thu Sep 11 18:12:24 2014 +0300
@@ -441,6 +441,8 @@
     document.body.addEventListener("keydown", function(event) {
       if (document.activeElement.value)
         return;
+      if (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey)
+        return;
       var key = event.keyCode || event.which;
       var keyMoves = {38: "up", 40: "down", 37: "left", 39: "right"};
       if (key in keyMoves) {