Skip to content

Commit

Permalink
Fix right click and audio notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Aho committed Oct 15, 2015
1 parent 7e07b60 commit a5dc039
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client/src/ActionController.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ActionController
@robot = require 'robotjs'
@mouseState =
left : "up",
right : "down"
right : "up"

audioNotification: (clip) ->
audio = new Audio(clip)
Expand All @@ -33,13 +33,18 @@ class ActionController

# down: up|down, button: left|right
mouseButton: (down, button) =>
@mouseState.button = down
@robot.mouseToggle down, button

if(@mouseState.button != down)
if(down == 'down')
@audioNotification 'asset/audio/mousedown.ogg'
else
@audioNotification 'asset/audio/mouseup.ogg'
@mouseState.button = down
@robot.mouseToggle down, button

# Extra mouse up
if(down == 'up')
@robot.mouseToggle down, button

parseGestures: (model) =>

Expand Down

0 comments on commit a5dc039

Please sign in to comment.