|
|
@ -2,6 +2,7 @@ var util = require('../../util'); |
|
|
|
var Node = require('../Node'); |
|
|
|
var Edge = require('../Edge'); |
|
|
|
var Hammer = require('../../module/hammer'); |
|
|
|
var hammerUtil = require('../../hammerUtil'); |
|
|
|
|
|
|
|
/** |
|
|
|
* clears the toolbar div element of children |
|
|
@ -26,7 +27,7 @@ exports._cleanManipulatorHammers = function() { |
|
|
|
// clean hammer bindings
|
|
|
|
if (this.manipulationHammers.length != 0) { |
|
|
|
for (var i = 0; i < this.manipulationHammers.length; i++) { |
|
|
|
this.manipulationHammers[i].dispose(); |
|
|
|
this.manipulationHammers[i].destroy(); |
|
|
|
} |
|
|
|
this.manipulationHammers = []; |
|
|
|
} |
|
|
@ -215,10 +216,10 @@ exports._createManipulatorBar = function() { |
|
|
|
|
|
|
|
|
|
|
|
exports._bindHammerToDiv = function(domElement, funct) { |
|
|
|
var hammer = Hammer(domElement, {prevent_default: true}); |
|
|
|
hammer.on('touch', this[funct].bind(this)); |
|
|
|
var hammer = new Hammer(domElement, {}); |
|
|
|
hammerUtil.onTouch(hammer, this[funct].bind(this)); |
|
|
|
this.manipulationHammers.push(hammer); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -419,7 +420,7 @@ exports._selectControlNode = function(pointer) { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
exports._controlNodeDrag = function(event) { |
|
|
|
var pointer = this._getPointer(event.gesture.center); |
|
|
|
var pointer = this._getPointer(event.center); |
|
|
|
if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { |
|
|
|
this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); |
|
|
|
this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); |
|
|
@ -494,7 +495,7 @@ exports._handleConnect = function(pointer) { |
|
|
|
this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; |
|
|
|
var me = this; |
|
|
|
this._handleOnDrag = function(event) { |
|
|
|
var pointer = me._getPointer(event.gesture.center); |
|
|
|
var pointer = me._getPointer(event.center); |
|
|
|
var connectionEdge = me.body.edges['connectionEdge']; |
|
|
|
connectionEdge.to.x = me._XconvertDOMtoCanvas(pointer.x); |
|
|
|
connectionEdge.to.y = me._YconvertDOMtoCanvas(pointer.y); |
|
|
@ -507,7 +508,7 @@ exports._handleConnect = function(pointer) { |
|
|
|
|
|
|
|
exports._finishConnect = function(event) { |
|
|
|
if (this._getSelectedNodeCount() == 1) { |
|
|
|
var pointer = this._getPointer(event.gesture.center); |
|
|
|
var pointer = this._getPointer(event.center); |
|
|
|
// restore the drag function
|
|
|
|
this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; |
|
|
|
delete this.cachedFunctions["_handleOnDrag"]; |
|
|
|