|
|
@ -724,10 +724,13 @@ Network.prototype.setOptions = function (options) { |
|
|
|
// configure the smooth curves
|
|
|
|
this._configureSmoothCurves(); |
|
|
|
|
|
|
|
// bind hammer
|
|
|
|
this._bindHammer(); |
|
|
|
|
|
|
|
// bind keys. If disabled, this will not do anything;
|
|
|
|
this._createKeyBinds(); |
|
|
|
|
|
|
|
|
|
|
|
this.setSize(this.constants.width, this.constants.height); |
|
|
|
this.moving = true; |
|
|
|
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._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; |
|
|
|
if (this.hammer !== undefined) { |
|
|
|
this.hammer.dispose(); |
|
|
|
} |
|
|
|
this.drag = {}; |
|
|
|
this.pinch = {}; |
|
|
|
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('doubletap', me._onDoubleTap.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('dragstart', me._onDragStart.bind(me) ); |
|
|
|
this.hammer.on('drag', me._onDrag.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.hammerFrame = Hammer(this.frame, { |
|
|
@ -808,9 +825,7 @@ Network.prototype._create = function () { |
|
|
|
|
|
|
|
// add the frame to the container element
|
|
|
|
this.containerElement.appendChild(this.frame); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin |
|
|
|