Skip to content
Browse files

Changed offsetX/Y for firefox compatibility

Firefox does not support the offsetX and offsetY properties. This means
that the game is completely unplayable - shooting will always shoot to
the right.
Changed to use something that firefox does support. Tested on firefox
and chromium.
  • Loading branch information...
1 parent a838e65 commit ffb124596cf2c5d0110bceace86c6a05a8054cb1 @jgeralnik committed Jul 22, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 client/input.js
View
4 client/input.js
@@ -52,8 +52,8 @@ DesktopInput.prototype.onleave = function() {
DesktopInput.prototype.onclick = function(event) {
// Get the position of the click.
- var cx = event.offsetX;
- var cy = event.offsetY;
+ var cx = event.clientX - event.target.getBoundingClientRect().left;
+ var cy = event.clientY - event.target.getBoundingClientRect().top;
// Get the current player.
var player = this.game.state.objects[playerId];
// Sometimes the player isn't there.

0 comments on commit ffb1245

Please sign in to comment.
Something went wrong with that request. Please try again.