Browse Source

- Improved robustness against people molesting the Function.prototype.bind()

flowchartTest
Alex de Mulder 9 years ago
parent
commit
34be08fd51
4 changed files with 1528 additions and 1461 deletions
  1. +5
    -0
      HISTORY.md
  2. +1493
    -1434
      dist/vis.js
  3. +5
    -2
      lib/network/modules/CanvasRenderer.js
  4. +25
    -25
      lib/network/modules/components/NavigationHandler.js

+ 5
- 0
HISTORY.md View File

@ -8,6 +8,11 @@ http://visjs.org
- Fixed #892, addressed any case in validator.
### Network
- Improved robustness against people molesting the Function.prototype.bind()
## 2015-05-28, version 4.1.0
### Network

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


+ 5
- 2
lib/network/modules/CanvasRenderer.js View File

@ -126,10 +126,10 @@ class CanvasRenderer {
if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedrawRequests === true) {
this.redrawRequested = true;
if (this.requiresTimeout === true) {
window.setTimeout(this._redraw.bind(this, false), 0);
window.setTimeout(() => {this._redraw(false);}, 0);
}
else {
window.requestAnimationFrame(this._redraw.bind(this, false));
window.requestAnimationFrame(() => {this._redraw(false);});
}
}
}
@ -169,6 +169,7 @@ class CanvasRenderer {
this.body.emitter.emit("beforeDrawing", ctx);
ctx.closePath();
console.log(arguments)
if (hidden === false) {
if (this.dragging === false || (this.dragging === true && this.options.hideEdgesOnDrag === false)) {
this._drawEdges(ctx);
@ -241,6 +242,7 @@ class CanvasRenderer {
* @private
*/
_drawNodes(ctx, alwaysShow = false) {
console.log("draw nodes")
let nodes = this.body.nodes;
let nodeIndices = this.body.nodeIndices;
let node;
@ -289,6 +291,7 @@ class CanvasRenderer {
* @private
*/
_drawEdges(ctx) {
console.log("draw edges")
let edges = this.body.edges;
let edgeIndices = this.body.edgeIndices;
let edge;

+ 25
- 25
lib/network/modules/components/NavigationHandler.js View File

@ -168,31 +168,31 @@ class NavigationHandler {
this.keycharm.reset();
if (this.activated === true) {
this.keycharm.bind("up", this.bindToRedraw.bind(this, "_moveUp"), "keydown");
this.keycharm.bind("down", this.bindToRedraw.bind(this, "_moveDown"), "keydown");
this.keycharm.bind("left", this.bindToRedraw.bind(this, "_moveLeft"), "keydown");
this.keycharm.bind("right", this.bindToRedraw.bind(this, "_moveRight"), "keydown");
this.keycharm.bind("=", this.bindToRedraw.bind(this, "_zoomIn"), "keydown");
this.keycharm.bind("num+", this.bindToRedraw.bind(this, "_zoomIn"), "keydown");
this.keycharm.bind("num-", this.bindToRedraw.bind(this, "_zoomOut"), "keydown");
this.keycharm.bind("-", this.bindToRedraw.bind(this, "_zoomOut"), "keydown");
this.keycharm.bind("[", this.bindToRedraw.bind(this, "_zoomOut"), "keydown");
this.keycharm.bind("]", this.bindToRedraw.bind(this, "_zoomIn"), "keydown");
this.keycharm.bind("pageup", this.bindToRedraw.bind(this, "_zoomIn"), "keydown");
this.keycharm.bind("pagedown", this.bindToRedraw.bind(this, "_zoomOut"), "keydown");
this.keycharm.bind("up", this.unbindFromRedraw.bind(this, "_moveUp"), "keyup");
this.keycharm.bind("down", this.unbindFromRedraw.bind(this, "_moveDown"), "keyup");
this.keycharm.bind("left", this.unbindFromRedraw.bind(this, "_moveLeft"), "keyup");
this.keycharm.bind("right", this.unbindFromRedraw.bind(this, "_moveRight"), "keyup");
this.keycharm.bind("=", this.unbindFromRedraw.bind(this, "_zoomIn"), "keyup");
this.keycharm.bind("num+", this.unbindFromRedraw.bind(this, "_zoomIn"), "keyup");
this.keycharm.bind("num-", this.unbindFromRedraw.bind(this, "_zoomOut"), "keyup");
this.keycharm.bind("-", this.unbindFromRedraw.bind(this, "_zoomOut"), "keyup");
this.keycharm.bind("[", this.unbindFromRedraw.bind(this, "_zoomOut"), "keyup");
this.keycharm.bind("]", this.unbindFromRedraw.bind(this, "_zoomIn"), "keyup");
this.keycharm.bind("pageup", this.unbindFromRedraw.bind(this, "_zoomIn"), "keyup");
this.keycharm.bind("pagedown", this.unbindFromRedraw.bind(this, "_zoomOut"), "keyup");
this.keycharm.bind("up", () => {this.bindToRedraw("_moveUp") ;}, "keydown");
this.keycharm.bind("down", () => {this.bindToRedraw("_moveDown") ;}, "keydown");
this.keycharm.bind("left", () => {this.bindToRedraw("_moveLeft") ;}, "keydown");
this.keycharm.bind("right", () => {this.bindToRedraw("_moveRight");}, "keydown");
this.keycharm.bind("=", () => {this.bindToRedraw("_zoomIn") ;}, "keydown");
this.keycharm.bind("num+", () => {this.bindToRedraw("_zoomIn") ;}, "keydown");
this.keycharm.bind("num-", () => {this.bindToRedraw("_zoomOut") ;}, "keydown");
this.keycharm.bind("-", () => {this.bindToRedraw("_zoomOut") ;}, "keydown");
this.keycharm.bind("[", () => {this.bindToRedraw("_zoomOut") ;}, "keydown");
this.keycharm.bind("]", () => {this.bindToRedraw("_zoomIn") ;}, "keydown");
this.keycharm.bind("pageup", () => {this.bindToRedraw("_zoomIn") ;}, "keydown");
this.keycharm.bind("pagedown", () => {this.bindToRedraw("_zoomOut") ;}, "keydown");
this.keycharm.bind("up", () => {this.unbindFromRedraw("_moveUp") ;}, "keyup");
this.keycharm.bind("down", () => {this.unbindFromRedraw("_moveDown") ;}, "keyup");
this.keycharm.bind("left", () => {this.unbindFromRedraw("_moveLeft") ;}, "keyup");
this.keycharm.bind("right", () => {this.unbindFromRedraw("_moveRight");}, "keyup");
this.keycharm.bind("=", () => {this.unbindFromRedraw("_zoomIn") ;}, "keyup");
this.keycharm.bind("num+", () => {this.unbindFromRedraw("_zoomIn") ;}, "keyup");
this.keycharm.bind("num-", () => {this.unbindFromRedraw("_zoomOut") ;}, "keyup");
this.keycharm.bind("-", () => {this.unbindFromRedraw("_zoomOut") ;}, "keyup");
this.keycharm.bind("[", () => {this.unbindFromRedraw("_zoomOut") ;}, "keyup");
this.keycharm.bind("]", () => {this.unbindFromRedraw("_zoomIn") ;}, "keyup");
this.keycharm.bind("pageup", () => {this.unbindFromRedraw("_zoomIn") ;}, "keyup");
this.keycharm.bind("pagedown", () => {this.unbindFromRedraw("_zoomOut") ;}, "keyup");
}
}
}

Loading…
Cancel
Save