Space bar no longer scrolls in chrome, and keys are captured on capture phase instead of bubble phase (i.e. earlier).
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)
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