Browse Source

fixed bug in navigation

flowchartTest
Alex de Mulder 9 years ago
parent
commit
8fe1b70c0a
4 changed files with 36 additions and 38 deletions
  1. +18
    -18
      dist/vis.js
  2. +1
    -3
      examples/network/20_navigation.html
  3. +15
    -15
      lib/network/modules/ConfigurationSystem.js
  4. +2
    -2
      lib/network/modules/components/NavigationHandler.js

+ 18
- 18
dist/vis.js View File

@ -24796,7 +24796,7 @@ return /******/ (function(modules) { // webpackBootstrap
// linebreak between categories // linebreak between categories
if (counter > 0) { if (counter > 0) {
this._makeEntree([]);
this._makeItem([]);
} }
// a header for the category // a header for the category
this._makeHeader(option); this._makeHeader(option);
@ -24895,25 +24895,25 @@ return /******/ (function(modules) { // webpackBootstrap
return newPath; return newPath;
} }
}, { }, {
key: '_makeEntree',
key: '_makeItem',
/** /**
* all option elements are wrapped in an entree
* all option elements are wrapped in an item
* @param path * @param path
* @param domElements * @param domElements
* @private * @private
*/ */
value: function _makeEntree(path) {
value: function _makeItem(path) {
for (var _len = arguments.length, domElements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { for (var _len = arguments.length, domElements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
domElements[_key - 1] = arguments[_key]; domElements[_key - 1] = arguments[_key];
} }
var entree = document.createElement('div');
entree.className = 'vis-network-configuration entree s' + path.length;
var item = document.createElement('div');
item.className = 'vis-network-configuration item s' + path.length;
domElements.forEach(function (element) { domElements.forEach(function (element) {
entree.appendChild(element);
item.appendChild(element);
}); });
this.domElements.push(entree);
this.domElements.push(item);
} }
}, { }, {
key: '_makeHeader', key: '_makeHeader',
@ -24927,7 +24927,7 @@ return /******/ (function(modules) { // webpackBootstrap
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'vis-network-configuration header'; div.className = 'vis-network-configuration header';
div.innerHTML = name; div.innerHTML = name;
this._makeEntree([], div);
this._makeItem([], div);
} }
}, { }, {
key: '_makeLabel', key: '_makeLabel',
@ -24988,7 +24988,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
var label = this._makeLabel(path[path.length - 1], path); var label = this._makeLabel(path[path.length - 1], path);
this._makeEntree(path, label, select);
this._makeItem(path, label, select);
} }
}, { }, {
key: '_makeRange', key: '_makeRange',
@ -25037,7 +25037,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
var label = this._makeLabel(path[path.length - 1], path); var label = this._makeLabel(path[path.length - 1], path);
this._makeEntree(path, label, range, input);
this._makeItem(path, label, range, input);
} }
}, { }, {
key: '_makeCheckbox', key: '_makeCheckbox',
@ -25073,7 +25073,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
var label = this._makeLabel(path[path.length - 1], path); var label = this._makeLabel(path[path.length - 1], path);
this._makeEntree(path, label, checkbox);
this._makeItem(path, label, checkbox);
} }
}, { }, {
key: '_makeColorField', key: '_makeColorField',
@ -25105,7 +25105,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
var label = this._makeLabel(path[path.length - 1], path); var label = this._makeLabel(path[path.length - 1], path);
this._makeEntree(path, label, div);
this._makeItem(path, label, div);
} }
}, { }, {
key: '_showColorPicker', key: '_showColorPicker',
@ -25137,7 +25137,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_handleObject', key: '_handleObject',
/** /**
* parse an object and draw the correct entrees
* parse an object and draw the correct items
* @param obj * @param obj
* @param path * @param path
* @private * @private
@ -25173,14 +25173,14 @@ return /******/ (function(modules) { // webpackBootstrap
var enabledValue = this._getValue(enabledPath); var enabledValue = this._getValue(enabledPath);
if (enabledValue === true) { if (enabledValue === true) {
var label = this._makeLabel(subObj, newPath, true); var label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
this._handleObject(item, newPath); this._handleObject(item, newPath);
} else { } else {
this._makeCheckbox(item, enabledValue, newPath); this._makeCheckbox(item, enabledValue, newPath);
} }
} else { } else {
var label = this._makeLabel(subObj, newPath, true); var label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
this._handleObject(item, newPath); this._handleObject(item, newPath);
} }
} }
@ -33971,12 +33971,12 @@ return /******/ (function(modules) { // webpackBootstrap
}, { }, {
key: '_zoomIn', key: '_zoomIn',
value: function _zoomIn() { value: function _zoomIn() {
this.body.view.scale += this.options.keyboard.speed.zoom;
this.body.view.scale *= 1 + this.options.keyboard.speed.zoom;
} }
}, { }, {
key: '_zoomOut', key: '_zoomOut',
value: function _zoomOut() { value: function _zoomOut() {
this.body.view.scale -= this.options.keyboard.speed.zoom;
this.body.view.scale /= 1 + this.options.keyboard.speed.zoom;
} }
}, { }, {
key: 'configureKeyboardBindings', key: 'configureKeyboardBindings',

+ 1
- 3
examples/network/20_navigation.html View File

@ -104,9 +104,7 @@
edges: edges edges: edges
}; };
var options = { var options = {
stabilize: false,
navigation: true,
keyboard: true
interaction:{showNavigationIcons: true},
}; };
network = new vis.Network(container, data, options); network = new vis.Network(container, data, options);

+ 15
- 15
lib/network/modules/ConfigurationSystem.js View File

@ -303,7 +303,7 @@ class ConfigurationSystem {
// linebreak between categories // linebreak between categories
if (counter > 0) { if (counter > 0) {
this._makeEntree([]);
this._makeItem([]);
} }
// a header for the category // a header for the category
this._makeHeader(option); this._makeHeader(option);
@ -392,18 +392,18 @@ class ConfigurationSystem {
} }
/** /**
* all option elements are wrapped in an entree
* all option elements are wrapped in an item
* @param path * @param path
* @param domElements * @param domElements
* @private * @private
*/ */
_makeEntree(path,...domElements) {
let entree = document.createElement('div');
entree.className = 'vis-network-configuration entree s' + path.length;
_makeItem(path,...domElements) {
let item = document.createElement('div');
item.className = 'vis-network-configuration item s' + path.length;
domElements.forEach((element) => { domElements.forEach((element) => {
entree.appendChild(element);
item.appendChild(element);
}); });
this.domElements.push(entree);
this.domElements.push(item);
} }
/** /**
@ -415,7 +415,7 @@ class ConfigurationSystem {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'vis-network-configuration header'; div.className = 'vis-network-configuration header';
div.innerHTML = name; div.innerHTML = name;
this._makeEntree([],div);
this._makeItem([],div);
} }
/** /**
@ -470,7 +470,7 @@ class ConfigurationSystem {
select.onchange = function () {me._update(this.value, path);}; select.onchange = function () {me._update(this.value, path);};
let label = this._makeLabel(path[path.length-1], path); let label = this._makeLabel(path[path.length-1], path);
this._makeEntree(path, label, select);
this._makeItem(path, label, select);
} }
@ -515,7 +515,7 @@ class ConfigurationSystem {
range.oninput = function () {input.value = this.value; }; range.oninput = function () {input.value = this.value; };
let label = this._makeLabel(path[path.length-1], path); let label = this._makeLabel(path[path.length-1], path);
this._makeEntree(path, label, range, input);
this._makeItem(path, label, range, input);
} }
@ -549,7 +549,7 @@ class ConfigurationSystem {
checkbox.onchange = function() {me._update(this.checked, path)}; checkbox.onchange = function() {me._update(this.checked, path)};
let label = this._makeLabel(path[path.length-1], path); let label = this._makeLabel(path[path.length-1], path);
this._makeEntree(path, label, checkbox);
this._makeItem(path, label, checkbox);
} }
@ -579,7 +579,7 @@ class ConfigurationSystem {
} }
let label = this._makeLabel(path[path.length-1], path); let label = this._makeLabel(path[path.length-1], path);
this._makeEntree(path,label, div);
this._makeItem(path,label, div);
} }
@ -607,7 +607,7 @@ class ConfigurationSystem {
/** /**
* parse an object and draw the correct entrees
* parse an object and draw the correct items
* @param obj * @param obj
* @param path * @param path
* @private * @private
@ -644,7 +644,7 @@ class ConfigurationSystem {
let enabledValue = this._getValue(enabledPath); let enabledValue = this._getValue(enabledPath);
if (enabledValue === true) { if (enabledValue === true) {
let label = this._makeLabel(subObj, newPath, true); let label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
this._handleObject(item, newPath); this._handleObject(item, newPath);
} }
else { else {
@ -653,7 +653,7 @@ class ConfigurationSystem {
} }
else { else {
let label = this._makeLabel(subObj, newPath, true); let label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
this._handleObject(item, newPath); this._handleObject(item, newPath);
} }
} }

+ 2
- 2
lib/network/modules/components/NavigationHandler.js View File

@ -147,8 +147,8 @@ class NavigationHandler {
_moveDown() {this.body.view.translation.y -= this.options.keyboard.speed.y;} _moveDown() {this.body.view.translation.y -= this.options.keyboard.speed.y;}
_moveLeft() {this.body.view.translation.x += this.options.keyboard.speed.x;} _moveLeft() {this.body.view.translation.x += this.options.keyboard.speed.x;}
_moveRight(){this.body.view.translation.x -= this.options.keyboard.speed.x;} _moveRight(){this.body.view.translation.x -= this.options.keyboard.speed.x;}
_zoomIn() {this.body.view.scale += this.options.keyboard.speed.zoom;}
_zoomOut() {this.body.view.scale -= this.options.keyboard.speed.zoom;}
_zoomIn() {this.body.view.scale *= 1+this.options.keyboard.speed.zoom;}
_zoomOut() {this.body.view.scale /= 1+this.options.keyboard.speed.zoom;}
/** /**

Loading…
Cancel
Save