Browse Source

removed mousetrap, added keycharm

v3_develop
Alex de Mulder 10 years ago
parent
commit
7dfe60be38
8 changed files with 25993 additions and 26596 deletions
  1. +5
    -0
      HISTORY.md
  2. +3
    -3
      NOTICE
  3. +25928
    -26548
      dist/vis.js
  4. +1
    -1
      dist/vis.map
  5. +14
    -14
      dist/vis.min.js
  6. +32
    -25
      lib/network/Network.js
  7. +9
    -4
      lib/shared/Activator.js
  8. +1
    -1
      package.json

+ 5
- 0
HISTORY.md View File

@ -4,6 +4,11 @@ http://visjs.org
## not yet released, version 3.6.4 ## not yet released, version 3.6.4
### General
- Removed mousetrap due to Apache license, created keycharm and implemented it with vis.
### Timeline ### Timeline
- Fixed height of background items when having a fixed or max height defined. - Fixed height of background items when having a fixed or max height defined.

+ 3
- 3
NOTICE View File

@ -28,6 +28,6 @@ Vis.js uses and redistributes the following third-party libraries:
http://momentjs.com/ http://momentjs.com/
The MIT License The MIT License
- mousetrap
http://craig.is/killing/mice
The Apache 2.0 License
- keycharm
https://github.com/AlexDM0/keycharm
The MIT License

+ 25928
- 26548
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 14
- 14
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 32
- 25
lib/network/Network.js View File

@ -1,6 +1,6 @@
var Emitter = require('emitter-component'); var Emitter = require('emitter-component');
var Hammer = require('../module/hammer'); var Hammer = require('../module/hammer');
var mousetrap = require('mousetrap');
var keycharm = require('keycharm');
var util = require('../util'); var util = require('../util');
var hammerUtil = require('../hammerUtil'); var hammerUtil = require('../hammerUtil');
var DataSet = require('../DataSet'); var DataSet = require('../DataSet');
@ -768,36 +768,43 @@ Network.prototype._create = function () {
*/ */
Network.prototype._createKeyBinds = function() { Network.prototype._createKeyBinds = function() {
var me = this; 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()) { 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) { 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));
} }
}; };

+ 9
- 4
lib/shared/Activator.js View File

@ -1,4 +1,4 @@
var mousetrap = require('mousetrap');
var keycharm = require('keycharm');
var Emitter = require('emitter-component'); var Emitter = require('emitter-component');
var Hammer = require('../module/hammer'); var Hammer = require('../module/hammer');
var util = require('../util'); var util = require('../util');
@ -51,7 +51,12 @@ function Activator(container) {
} }
}); });
// mousetrap listener only bounded when active)
if (this.keycharm !== undefined) {
this.keycharm.destroy();
}
this.keycharm = keycharm();
// keycharm listener only bounded when active)
this.escListener = this.deactivate.bind(this); this.escListener = this.deactivate.bind(this);
} }
@ -96,7 +101,7 @@ Activator.prototype.activate = function () {
// ugly hack: bind ESC after emitting the events, as the Network rebinds all // ugly hack: bind ESC after emitting the events, as the Network rebinds all
// keyboard events on a 'change' event // keyboard events on a 'change' event
mousetrap.bind('esc', this.escListener);
this.keycharm.bind('esc', this.escListener);
}; };
/** /**
@ -107,7 +112,7 @@ Activator.prototype.deactivate = function () {
this.active = false; this.active = false;
this.dom.overlay.style.display = ''; this.dom.overlay.style.display = '';
util.removeClassName(this.dom.container, 'vis-active'); util.removeClassName(this.dom.container, 'vis-active');
mousetrap.unbind('esc', this.escListener);
this.keycharm.unbind('esc', this.escListener);
this.emit('change'); this.emit('change');
this.emit('deactivate'); this.emit('deactivate');

+ 1
- 1
package.json View File

@ -31,7 +31,7 @@
"emitter-component": "^1.1.1", "emitter-component": "^1.1.1",
"hammerjs": "^1.1.0", "hammerjs": "^1.1.0",
"moment": "^2.7.0", "moment": "^2.7.0",
"mousetrap": "0.0.1"
"keycharm": "^0.0.6"
}, },
"devDependencies": { "devDependencies": {
"clean-css": "latest", "clean-css": "latest",

Loading…
Cancel
Save