if selection?
update_path selection.element, selection.data, to_mouse: true
+keydown = (keycode) ->
+ switch keycode
+ when 'O'.charCodeAt 0
+ return stop_close_drawing()
+ when (' '.charCodeAt 0), 13, 10, 27
+ return stop_drawing()
+
# called automatically on domcontentloaded
init = ->
$container = $ '.crayon_mockup'
$svg.mousemove (e) ->
offset = $svg.offset()
mousemove e.pageX - offset.left, e.pageY - offset.top
+ ($ document).keydown (e) ->
+ return keydown e.keyCode
$ init