Browse Source

debugging a bit

flowchartTest
Alex de Mulder 9 years ago
parent
commit
efd876dba8
6 changed files with 10654 additions and 10639 deletions
  1. +10628
    -10623
      dist/vis.js
  2. +2
    -3
      examples/network/01_basic_usage.html
  3. +0
    -1
      lib/network/modules/EdgesHandler.js
  4. +13
    -5
      lib/network/modules/Validator.js
  5. +8
    -5
      lib/network/modules/components/AllOptions.js
  6. +3
    -2
      lib/network/modules/components/Node.js

+ 10628
- 10623
dist/vis.js
File diff suppressed because it is too large
View File


+ 2
- 3
examples/network/01_basic_usage.html View File

@ -44,9 +44,8 @@
edges: edges edges: edges
}; };
var options = { var options = {
manipulation: 'hello',
physics:{barnesHut:{gravitationslPull:34}, solver:'banana'},
groups:{'bla':{color:{backsground:'red'}, borderWidth:5}}
nodes:{title:undefined},edges:{hoverWidth:function(a) {return a;}},
configuration:{container:container}
} }
var network = new vis.Network(container, data, options); var network = new vis.Network(container, data, options);
// network.setOptions({nodes:{color:'red'}}) // network.setOptions({nodes:{color:'red'}})

+ 0
- 1
lib/network/modules/EdgesHandler.js View File

@ -139,7 +139,6 @@ class EdgesHandler {
setOptions(options) { setOptions(options) {
if (options !== undefined) { if (options !== undefined) {
console.log('edge',options)
// use the parser from the Edge class to fill in all shorthand notations // use the parser from the Edge class to fill in all shorthand notations
Edge.parseOptions(this.options, options); Edge.parseOptions(this.options, options);

+ 13
- 5
lib/network/modules/Validator.js View File

@ -93,18 +93,26 @@ class Validator {
' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle); ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle);
errorFound = true; errorFound = true;
} }
else if (recursive === true) {
else if (recursive === true && optionType === 'object') {
Validator.parse(options[option], referenceOptions[referenceOption], path); Validator.parse(options[option], referenceOptions[referenceOption], path);
} }
} }
else if (recursive === true) {
else if (recursive === true && optionType === 'object') {
Validator.parse(options[option], referenceOptions[referenceOption], path); Validator.parse(options[option], referenceOptions[referenceOption], path);
} }
} }
else { else {
// type of the field is incorrect
console.log('%cInvalid type received for "' + option + '". Expected: ' + Validator.print(Object.keys(referenceOptions[referenceOption].__type__)) + '. Received [' + optionType + '] "' + options[option] + '"' + Validator.printLocation(path, option), printStyle);
errorFound = true;
if (refOptionObj['undef'] !== undefined && optionType === 'undefined') {
// item is undefined, which is allowed
}
else if (refOptionObj['fn'] !== undefined && optionType === 'function') {
// item is a function, which is allowed
}
else {
// type of the field is incorrect
console.log('%cInvalid type received for "' + option + '". Expected: ' + Validator.print(Object.keys(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"' + Validator.printLocation(path, option), printStyle);
errorFound = true;
}
} }
} }

+ 8
- 5
lib/network/modules/components/AllOptions.js View File

@ -1,6 +1,9 @@
/** /**
* __any__
* __type__
* This object contains all possible options. It will check if the types are correct, if required if the option is one
* of the allowed values.
*
* __any__ means that the name of the property does not matter.
* __type__ is a required field for all objects and contains the allowed types of all objects
*/ */
let string = 'string'; let string = 'string';
let boolean = 'boolean'; let boolean = 'boolean';
@ -57,7 +60,7 @@ let allOptions = {
stroke: {number}, // px stroke: {number}, // px
strokeColor: {string}, strokeColor: {string},
align: {string:['horizontal','top','middle','bottom']}, align: {string:['horizontal','top','middle','bottom']},
__type__: {object}
__type__: {object,string}
}, },
hidden: {boolean}, hidden: {boolean},
hoverWidth: {fn,number}, hoverWidth: {fn,number},
@ -120,7 +123,7 @@ let allOptions = {
__type__: {object} __type__: {object}
}, },
layout: { layout: {
randomSeed: undefined,
randomSeed: {undef,number},
hierarchical: { hierarchical: {
enabled: {boolean}, enabled: {boolean},
levelSeparation: {number}, levelSeparation: {number},
@ -187,7 +190,7 @@ let allOptions = {
background: {string}, background: {string},
stroke: {number}, // px stroke: {number}, // px
strokeColor: {string}, strokeColor: {string},
__type__: {object}
__type__: {object,string}
}, },
group: {string,number,undef}, group: {string,number,undef},
hidden: {boolean}, hidden: {boolean},

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

@ -161,9 +161,10 @@ class Node {
*/ */
static parseOptions(parentOptions, newOptions) { static parseOptions(parentOptions, newOptions) {
var fields = [ var fields = [
'shadow',
'color', 'color',
'fixed'
'fixed',
'font',
'shadow'
]; ];
util.selectiveNotDeepExtend(fields, parentOptions, newOptions); util.selectiveNotDeepExtend(fields, parentOptions, newOptions);

Loading…
Cancel
Save