|
|
@ -1,6 +1,6 @@ |
|
|
|
var Emitter = require('emitter-component'); |
|
|
|
var Hammer = require('../module/hammer'); |
|
|
|
var mousetrap = require('mousetrap'); |
|
|
|
var keycharm = require('keycharm'); |
|
|
|
var util = require('../util'); |
|
|
|
var hammerUtil = require('../hammerUtil'); |
|
|
|
var DataSet = require('../DataSet'); |
|
|
@ -768,36 +768,43 @@ Network.prototype._create = function () { |
|
|
|
*/ |
|
|
|
Network.prototype._createKeyBinds = function() { |
|
|
|
var me = this; |
|
|
|
this.mousetrap = mousetrap; |
|
|
|
if (this.keycharm !== undefined) { |
|
|
|
this.keycharm.destroy(); |
|
|
|
} |
|
|
|
this.keycharm = keycharm(); |
|
|
|
|
|
|
|
this.mousetrap.reset(); |
|
|
|
this.keycharm.reset(); |
|
|
|
|
|
|
|
if (this.constants.keyboard.enabled && this.isActive()) { |
|
|
|
this.mousetrap.bind("up", this._moveUp.bind(me) , "keydown"); |
|
|
|
this.mousetrap.bind("up", this._yStopMoving.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("down", this._moveDown.bind(me) , "keydown"); |
|
|
|
this.mousetrap.bind("down", this._yStopMoving.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("left", this._moveLeft.bind(me) , "keydown"); |
|
|
|
this.mousetrap.bind("left", this._xStopMoving.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("right",this._moveRight.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("right",this._xStopMoving.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("=", this._zoomIn.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("=", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("-", this._zoomOut.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("-", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("[", this._zoomIn.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("[", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("]", this._zoomOut.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("]", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("pageup",this._zoomIn.bind(me), "keydown"); |
|
|
|
this.mousetrap.bind("pageup",this._stopZoom.bind(me), "keyup"); |
|
|
|
this.mousetrap.bind("pagedown",this._zoomOut.bind(me),"keydown"); |
|
|
|
this.mousetrap.bind("pagedown",this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("up", this._moveUp.bind(me) , "keydown"); |
|
|
|
this.keycharm.bind("up", this._yStopMoving.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("down", this._moveDown.bind(me) , "keydown"); |
|
|
|
this.keycharm.bind("down", this._yStopMoving.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("left", this._moveLeft.bind(me) , "keydown"); |
|
|
|
this.keycharm.bind("left", this._xStopMoving.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("right",this._moveRight.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("right",this._xStopMoving.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("=", this._zoomIn.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("=", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("num+", this._zoomIn.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("num+", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("num-", this._zoomOut.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("num-", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("-", this._zoomOut.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("-", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("[", this._zoomIn.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("[", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("]", this._zoomOut.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("]", this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("pageup",this._zoomIn.bind(me), "keydown"); |
|
|
|
this.keycharm.bind("pageup",this._stopZoom.bind(me), "keyup"); |
|
|
|
this.keycharm.bind("pagedown",this._zoomOut.bind(me),"keydown"); |
|
|
|
this.keycharm.bind("pagedown",this._stopZoom.bind(me), "keyup"); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.constants.dataManipulation.enabled == true) { |
|
|
|
this.mousetrap.bind("escape",this._createManipulatorBar.bind(me)); |
|
|
|
this.mousetrap.bind("del",this._deleteSelected.bind(me)); |
|
|
|
this.keycharm.bind("esc",this._createManipulatorBar.bind(me)); |
|
|
|
this.keycharm.bind("delete",this._deleteSelected.bind(me)); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|