Browse Source

Fixed #860, edit node mode now works as it should.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
aa12cea8b6
4 changed files with 19 additions and 15 deletions
  1. +9
    -6
      dist/vis.js
  2. +4
    -4
      docs/network/index.html
  3. +2
    -1
      lib/network/Network.js
  4. +4
    -4
      lib/network/modules/ManipulationSystem.js

+ 9
- 6
dist/vis.js View File

@ -16528,8 +16528,11 @@ return /******/ (function(modules) { // webpackBootstrap
Network.prototype.addNodeMode = function () {
return this.manipulation.addNodeMode.apply(this.manipulation, arguments);
};
Network.prototype.editNode = function () {
return this.manipulation.editNode.apply(this.manipulation, arguments);
};
Network.prototype.editNodeMode = function () {
return this.manipulation.editNodeMode.apply(this.manipulation, arguments);
console.log('please use editNode instead of editNodeMode');return this.manipulation.editNode.apply(this.manipulation, arguments);
};
Network.prototype.addEdgeMode = function () {
return this.manipulation.addEdgeMode.apply(this.manipulation, arguments);
@ -26571,14 +26574,14 @@ return /******/ (function(modules) { // webpackBootstrap
this._temporaryBindEvent('click', this._performAddNode.bind(this));
}
}, {
key: 'editNodeMode',
key: 'editNode',
/**
* call the bound function to handle the editing of the node. The node has to be selected.
*
* @private
*/
value: function editNodeMode() {
value: function editNode() {
var _this2 = this;
// when using the gui, enable edit mode if it wasnt already.
@ -26599,7 +26602,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.options.editNode.length === 2) {
this.options.editNode(data, function (finalizedData) {
if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'delete') {
if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'editNode') {
// if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
_this2.body.data.nodes.update(finalizedData);
_this2.showManipulatorToolbar();
@ -27005,9 +27008,9 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_createEditNodeButton',
value: function _createEditNodeButton(locale) {
var button = this._createButton('editNodeMode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);
var button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);
this.manipulationDiv.appendChild(button);
this._bindHammerToDiv(button, this.editNodeMode.bind(this));
this._bindHammerToDiv(button, this.editNode.bind(this));
}
}, {
key: '_createEditEdgeButton',

+ 4
- 4
docs/network/index.html View File

@ -681,12 +681,12 @@ var locales = {
<code>enabled</code> to false.
</td>
</tr>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','editNodeMode', this);">
<td colspan="2"><span parent="editNodeMode" class="right-caret"></span> editNodeMode()</td>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','editNode', this);">
<td colspan="2"><span parent="editNode" class="right-caret"></span> editNode()</td>
</tr>
<tr class="hidden" parent="editNodeMode">
<tr class="hidden" parent="editNode">
<td class="midMethods">Returns: none</td>
<td>Go into editNode mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
<td>Edit the selected node. The explaination from <code>addNodeMode</code> applies here as well.</td>
</tr>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','addEdgeMode', this);">
<td colspan="2"><span parent="addEdgeMode" class="right-caret"></span> addEdgeMode()</td>

+ 2
- 1
lib/network/Network.js View File

@ -442,7 +442,8 @@ Network.prototype.getSeed = function() {return this.layoutEngine.get
Network.prototype.enableEditMode = function() {return this.manipulation.enableEditMode.apply(this.manipulation,arguments);};
Network.prototype.disableEditMode = function() {return this.manipulation.disableEditMode.apply(this.manipulation,arguments);};
Network.prototype.addNodeMode = function() {return this.manipulation.addNodeMode.apply(this.manipulation,arguments);};
Network.prototype.editNodeMode = function() {return this.manipulation.editNodeMode.apply(this.manipulation,arguments);};
Network.prototype.editNode = function() {return this.manipulation.editNode.apply(this.manipulation,arguments);};
Network.prototype.editNodeMode = function() {console.log("please use editNode instead of editNodeMode"); return this.manipulation.editNode.apply(this.manipulation,arguments);};
Network.prototype.addEdgeMode = function() {return this.manipulation.addEdgeMode.apply(this.manipulation,arguments);};
Network.prototype.editEdgeMode = function() {return this.manipulation.editEdgeMode.apply(this.manipulation,arguments);};
Network.prototype.deleteSelected = function() {return this.manipulation.deleteSelected.apply(this.manipulation,arguments);};

+ 4
- 4
lib/network/modules/ManipulationSystem.js View File

@ -253,7 +253,7 @@ class ManipulationSystem {
*
* @private
*/
editNodeMode() {
editNode() {
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
@ -272,7 +272,7 @@ class ManipulationSystem {
if (this.options.editNode.length === 2) {
this.options.editNode(data, (finalizedData) => {
if (finalizedData !== null && finalizedData !== undefined && this.inMode === 'delete') { // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
if (finalizedData !== null && finalizedData !== undefined && this.inMode === 'editNode') { // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
this.body.data.nodes.update(finalizedData);
this.showManipulatorToolbar();
}
@ -669,9 +669,9 @@ class ManipulationSystem {
}
_createEditNodeButton(locale) {
let button = this._createButton('editNodeMode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);
let button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);
this.manipulationDiv.appendChild(button);
this._bindHammerToDiv(button, this.editNodeMode.bind(this));
this._bindHammerToDiv(button, this.editNode.bind(this));
}
_createEditEdgeButton(locale) {

Loading…
Cancel
Save