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

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

@ -104,9 +104,7 @@
edges: edges
};
var options = {
stabilize: false,
navigation: true,
keyboard: true
interaction:{showNavigationIcons: true},
};
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
if (counter > 0) {
this._makeEntree([]);
this._makeItem([]);
}
// a header for the category
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 domElements
* @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) => {
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');
div.className = 'vis-network-configuration header';
div.innerHTML = name;
this._makeEntree([],div);
this._makeItem([],div);
}
/**
@ -470,7 +470,7 @@ class ConfigurationSystem {
select.onchange = function () {me._update(this.value, 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; };
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)};
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);
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 path
* @private
@ -644,7 +644,7 @@ class ConfigurationSystem {
let enabledValue = this._getValue(enabledPath);
if (enabledValue === true) {
let label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
this._handleObject(item, newPath);
}
else {
@ -653,7 +653,7 @@ class ConfigurationSystem {
}
else {
let label = this._makeLabel(subObj, newPath, true);
this._makeEntree(newPath, label);
this._makeItem(newPath, label);
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;}
_moveLeft() {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