From 00121c8a797146015d68cb6671f2110d7f3333b6 Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Thu, 26 Feb 2015 12:21:15 +0100 Subject: [PATCH] fixed manipulation add edges view of edge that is created. Unfreeze after edge connected --- dist/vis.js | 20 +++++++++++--------- lib/network/mixins/ManipulationMixin.js | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/dist/vis.js b/dist/vis.js index a21b2669..9ce576c2 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 3.10.1-SNAPSHOT - * @date 2015-02-24 + * @date 2015-02-26 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -33801,7 +33801,7 @@ return /******/ (function(modules) { // webpackBootstrap delete this.sectors['support']['nodes']['targetNode']; delete this.sectors['support']['nodes']['targetViaNode']; this.controlNodesActive = false; - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); }; @@ -33882,7 +33882,7 @@ return /******/ (function(modules) { // webpackBootstrap this._restoreOverloadedFunctions(); // resume calculation - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); // reset global variables this.blockConnectingEdgeSelection = false; @@ -34059,7 +34059,7 @@ return /******/ (function(modules) { // webpackBootstrap // clear the toolbar this._clearManipulatorBar(); this._unselectAll(true); - this.freezeSimulationEnabled = true; + this.freezeSimulation(true); if (this.boundFunction) { this.off('select', this.boundFunction); @@ -34190,7 +34190,7 @@ return /******/ (function(modules) { // webpackBootstrap this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); if (this.selectedControlNode !== null) { this.selectedControlNode.select(); - this.freezeSimulationEnabled = true; + this.freezeSimulation(true); } this._redraw(); }; @@ -34234,7 +34234,7 @@ return /******/ (function(modules) { // webpackBootstrap else { this.edgeBeingEdited._restoreControlNodes(); } - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); this._redraw(); }; @@ -34276,11 +34276,13 @@ return /******/ (function(modules) { // webpackBootstrap connectionEdge.to = targetNode; this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + var me = this; this._handleOnDrag = function(event) { var pointer = this._getPointer(event.gesture.center); - var connectionEdge = this.edges['connectionEdge']; - connectionEdge.to.x = this._XconvertDOMtoCanvas(pointer.x); - connectionEdge.to.y = this._YconvertDOMtoCanvas(pointer.y); + var connectionEdge = me.edges['connectionEdge']; + connectionEdge.to.x = me._XconvertDOMtoCanvas(pointer.x); + connectionEdge.to.y = me._YconvertDOMtoCanvas(pointer.y); + me._redraw(); }; this.moving = true; diff --git a/lib/network/mixins/ManipulationMixin.js b/lib/network/mixins/ManipulationMixin.js index d26a12fe..26f634d8 100644 --- a/lib/network/mixins/ManipulationMixin.js +++ b/lib/network/mixins/ManipulationMixin.js @@ -18,7 +18,7 @@ exports._clearManipulatorBar = function() { delete this.sectors['support']['nodes']['targetNode']; delete this.sectors['support']['nodes']['targetViaNode']; this.controlNodesActive = false; - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); }; @@ -99,7 +99,7 @@ exports._createManipulatorBar = function() { this._restoreOverloadedFunctions(); // resume calculation - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); // reset global variables this.blockConnectingEdgeSelection = false; @@ -276,7 +276,7 @@ exports._createAddEdgeToolbar = function() { // clear the toolbar this._clearManipulatorBar(); this._unselectAll(true); - this.freezeSimulationEnabled = true; + this.freezeSimulation(true); if (this.boundFunction) { this.off('select', this.boundFunction); @@ -407,7 +407,7 @@ exports._selectControlNode = function(pointer) { this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); if (this.selectedControlNode !== null) { this.selectedControlNode.select(); - this.freezeSimulationEnabled = true; + this.freezeSimulation(true); } this._redraw(); }; @@ -451,7 +451,7 @@ exports._releaseControlNode = function(pointer) { else { this.edgeBeingEdited._restoreControlNodes(); } - this.freezeSimulationEnabled = false; + this.freezeSimulation(false); this._redraw(); }; @@ -493,11 +493,13 @@ exports._handleConnect = function(pointer) { connectionEdge.to = targetNode; this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + var me = this; this._handleOnDrag = function(event) { var pointer = this._getPointer(event.gesture.center); - var connectionEdge = this.edges['connectionEdge']; - connectionEdge.to.x = this._XconvertDOMtoCanvas(pointer.x); - connectionEdge.to.y = this._YconvertDOMtoCanvas(pointer.y); + var connectionEdge = me.edges['connectionEdge']; + connectionEdge.to.x = me._XconvertDOMtoCanvas(pointer.x); + connectionEdge.to.y = me._YconvertDOMtoCanvas(pointer.y); + me._redraw(); }; this.moving = true;