src/widgets/Shortcuts.js
changeset 1068 7623f9af9272
parent 1033 c20df1c080e6
child 1072 ac1eacb3aa33
equal deleted inserted replaced
1067:539c9bee5372 1068:7623f9af9272
     4 
     4 
     5 /**
     5 /**
     6  * Keyboard shortcuts widget
     6  * Keyboard shortcuts widget
     7  * This widgets add global shortcuts for common actions.
     7  * This widgets add global shortcuts for common actions.
     8  * The default shortcuts are: 
     8  * The default shortcuts are: 
     9  * - Escape or Control-space for play/pause
     9  * - Control-space for play/pause
    10  * - Control-left for rewind (+shift to go faster)
    10  * - Control-left for rewind (+shift to go faster)
    11  * - Control-right for forward (+shift to go faster)
    11  * - Control-right for forward (+shift to go faster)
    12  */
    12  */
    13 IriSP.Widgets.Shortcuts.prototype = new IriSP.Widgets.Widget();
    13 IriSP.Widgets.Shortcuts.prototype = new IriSP.Widgets.Widget();
    14 
    14 
    19 
    19 
    20 IriSP.Widgets.Shortcuts.prototype.draw = function() {
    20 IriSP.Widgets.Shortcuts.prototype.draw = function() {
    21     var  _this = this;
    21     var  _this = this;
    22     
    22     
    23     /* Standard shortcuts */
    23     /* Standard shortcuts */
    24     Mousetrap.bindGlobal(["esc", "ctrl+space"], function (e) {
    24     Mousetrap.bindGlobal("ctrl+space", function (e) {
    25         e.preventDefault();
    25         e.preventDefault();
    26         if (! _this.media.getPaused()) {
    26         if (! _this.media.getPaused()) {
    27             _this.media.pause();
    27             _this.media.pause();
    28         } else {
    28         } else {
    29             _this.media.play();
    29             _this.media.play();
    52         // Forward
    52         // Forward
    53         e.preventDefault();
    53         e.preventDefault();
    54         _this.media.setCurrentTime(Math.min(_this.media.duration, _this.media.getCurrentTime() + 5 * _this.time_increment));
    54         _this.media.setCurrentTime(Math.min(_this.media.duration, _this.media.getCurrentTime() + 5 * _this.time_increment));
    55         return false;
    55         return false;
    56     });
    56     });
       
    57     Mousetrap.bindGlobal("ctrl+a", function (e) {
       
    58         // Annotate
       
    59         e.preventDefault();
       
    60         _this.player.trigger("CreateAnnotation.toggle");
       
    61         return false;
       
    62     });
    57 
    63 
    58 };
    64 };