summary history branches tags files
commit:9d8e4bf88a6d9242d94ad31bdccb931b2f6c570d
author:mrmekon
committer:mrmekon
date:Mon Apr 2 15:56:54 2012 -0400
parents:52c4098461dc61c56c01287c85221b82e6737005
Space bar no longer scrolls in chrome, and keys are captured on capture phase instead of bubble phase (i.e. earlier).
diff --git a/tempest/tempest.cljs b/tempest/tempest.cljs
line changes: +1/-1
index 8721b73..4d9356d
--- a/tempest/tempest.cljs
+++ b/tempest/tempest.cljs
@@ -73,7 +73,7 @@ Publicly exported functions to embed Tempest game in HTML.
         context (.getContext canvas "2d")
         bgcanvas (dom/getElement "canv-bg")
         bgcontext (.getContext bgcanvas "2d")
-        handler (goog.events.KeyHandler. document)
+        handler (goog.events.KeyHandler. document true)
         dims {:width (.-width canvas) :height (.-height canvas)}]
 
     (draw/draw-board bgcontext dims level)

diff --git a/tempest/tempest/core.cljs b/tempest/tempest/core.cljs
line changes: +3/-1
index 2e4d96c..8ce3d73
--- a/tempest/tempest/core.cljs
+++ b/tempest/tempest/core.cljs
@@ -481,7 +481,9 @@ flipper appears to flip 'inside' the level:
    be called as the browser's key-handling callback."
   [event]
   (let [key (.-keyCode event)]
-    (swap! *key-event-queue* #(concat % [key]))))
+    (swap! *key-event-queue* #(concat % [key]))
+    (.preventDefault event)
+    (.stopPropagation event)))
 
 (defn handle-keypress
   "Returns new game state updated to reflect the results of a player's