summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/shortcuts_network.js
blob: 002e979a2c6c6eb0e56cb8ceaa4e333d97e6cc9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* eslint-disable */

/*= require shortcuts_navigation */

(function() {
  var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  this.ShortcutsNetwork = (function(superClass) {
    extend(ShortcutsNetwork, superClass);

    function ShortcutsNetwork(graph) {
      this.graph = graph;
      ShortcutsNetwork.__super__.constructor.call(this);
      Mousetrap.bind(['left', 'h'], this.graph.scrollLeft);
      Mousetrap.bind(['right', 'l'], this.graph.scrollRight);
      Mousetrap.bind(['up', 'k'], this.graph.scrollUp);
      Mousetrap.bind(['down', 'j'], this.graph.scrollDown);
      Mousetrap.bind(['shift+up', 'shift+k'], this.graph.scrollTop);
      Mousetrap.bind(['shift+down', 'shift+j'], this.graph.scrollBottom);
      this.enabledHelp.push('.hidden-shortcut.network');
    }

    return ShortcutsNetwork;

  })(ShortcutsNavigation);

}).call(this);