Browse Source

- Fixed scroll being blocked if zoomable is false. (decoupled bindHammer from create)

v3_develop
Alex de Mulder 9 years ago
parent
commit
d488cd3a7a
3 changed files with 27191 additions and 27160 deletions
  1. +2
    -1
      HISTORY.md
  2. +27167
    -27152
      dist/vis.js
  3. +22
    -7
      lib/network/Network.js

+ 2
- 1
HISTORY.md View File

@ -9,7 +9,8 @@ http://visjs.org
- Fixed bug where opening a cluster with smoothCurves off caused one child to go crazy. - Fixed bug where opening a cluster with smoothCurves off caused one child to go crazy.
- Fixed bug where zoomExtent does not work as expected. - Fixed bug where zoomExtent does not work as expected.
- Fixed nodes color data being overridden when having a group and a dataset update query. - Fixed nodes color data being overridden when having a group and a dataset update query.
- Decoupled animation from physics simulation
- Decoupled animation from physics simulation.
- Fixed scroll being blocked if zoomable is false.
## 2015-01-16, version 3.9.0 ## 2015-01-16, version 3.9.0

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


+ 22
- 7
lib/network/Network.js View File

@ -724,10 +724,13 @@ Network.prototype.setOptions = function (options) {
// configure the smooth curves // configure the smooth curves
this._configureSmoothCurves(); this._configureSmoothCurves();
// bind hammer
this._bindHammer();
// bind keys. If disabled, this will not do anything; // bind keys. If disabled, this will not do anything;
this._createKeyBinds(); this._createKeyBinds();
this.setSize(this.constants.width, this.constants.height); this.setSize(this.constants.width, this.constants.height);
this.moving = true; this.moving = true;
this.start(); this.start();
@ -780,10 +783,19 @@ Network.prototype._create = function () {
this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
} }
//////////////////////////////////////////////////////////////////
this._bindHammer();
};
/**
* This function binds hammer, it can be repeated over and over due to the uniqueness check.
* @private
*/
Network.prototype._bindHammer = function() {
var me = this; var me = this;
if (this.hammer !== undefined) {
this.hammer.dispose();
}
this.drag = {}; this.drag = {};
this.pinch = {}; this.pinch = {};
this.hammer = Hammer(this.frame.canvas, { this.hammer = Hammer(this.frame.canvas, {
@ -792,13 +804,18 @@ Network.prototype._create = function () {
this.hammer.on('tap', me._onTap.bind(me) ); this.hammer.on('tap', me._onTap.bind(me) );
this.hammer.on('doubletap', me._onDoubleTap.bind(me) ); this.hammer.on('doubletap', me._onDoubleTap.bind(me) );
this.hammer.on('hold', me._onHold.bind(me) ); this.hammer.on('hold', me._onHold.bind(me) );
this.hammer.on('pinch', me._onPinch.bind(me) );
this.hammer.on('touch', me._onTouch.bind(me) ); this.hammer.on('touch', me._onTouch.bind(me) );
this.hammer.on('dragstart', me._onDragStart.bind(me) ); this.hammer.on('dragstart', me._onDragStart.bind(me) );
this.hammer.on('drag', me._onDrag.bind(me) ); this.hammer.on('drag', me._onDrag.bind(me) );
this.hammer.on('dragend', me._onDragEnd.bind(me) ); this.hammer.on('dragend', me._onDragEnd.bind(me) );
this.hammer.on('mousewheel',me._onMouseWheel.bind(me) );
this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF
if (this.constants.zoomable == true) {
console.log('here')
this.hammer.on('mousewheel', me._onMouseWheel.bind(me));
this.hammer.on('DOMMouseScroll', me._onMouseWheel.bind(me)); // for FF
this.hammer.on('pinch', me._onPinch.bind(me) );
}
this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) ); this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) );
this.hammerFrame = Hammer(this.frame, { this.hammerFrame = Hammer(this.frame, {
@ -808,9 +825,7 @@ Network.prototype._create = function () {
// add the frame to the container element // add the frame to the container element
this.containerElement.appendChild(this.frame); this.containerElement.appendChild(this.frame);
};
}
/** /**
* Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin * Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin

Loading…
Cancel
Save