Browse Source

updated group options, icon api change

flowchartTest
Alex de Mulder 9 years ago
parent
commit
b62d536fe7
7 changed files with 5249 additions and 5242 deletions
  1. +5224
    -5220
      dist/vis.js
  2. +6
    -6
      examples/network/38_node_as_icon.html
  3. +9
    -6
      lib/network/Network.js
  4. +4
    -4
      lib/network/modules/Groups.js
  5. +1
    -1
      lib/network/modules/InteractionHandler.js
  6. +4
    -4
      lib/network/modules/NodesHandler.js
  7. +1
    -1
      lib/network/modules/components/nodes/shapes/icon.js

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


+ 6
- 6
examples/network/38_node_as_icon.html View File

@ -22,7 +22,7 @@
usergroups: { usergroups: {
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'FontAwesome',
face: 'FontAwesome',
code: '\uf0c0', code: '\uf0c0',
size: 50, size: 50,
color: '#57169a' color: '#57169a'
@ -31,7 +31,7 @@
users: { users: {
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'FontAwesome',
face: 'FontAwesome',
code: '\uf007', code: '\uf007',
size: 50, size: 50,
color: '#aa00ff' color: '#aa00ff'
@ -62,7 +62,7 @@
label: 'Organisation 1', label: 'Organisation 1',
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'FontAwesome',
face: 'FontAwesome',
code: '\uf1ad', code: '\uf1ad',
size: 50, size: 50,
color: '#f0a30a' color: '#f0a30a'
@ -105,7 +105,7 @@
usergroups: { usergroups: {
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'Ionicons',
face: 'Ionicons',
code: '\uf47c', code: '\uf47c',
size: 50, size: 50,
color: '#57169a' color: '#57169a'
@ -114,7 +114,7 @@
users: { users: {
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'Ionicons',
face: 'Ionicons',
code: '\uf47e', code: '\uf47e',
size: 50, size: 50,
color: '#aa00ff' color: '#aa00ff'
@ -145,7 +145,7 @@
label: 'Organisation 1', label: 'Organisation 1',
shape: 'icon', shape: 'icon',
icon: { icon: {
fontFace: 'Ionicons',
face: 'Ionicons',
code: '\uf276', code: '\uf276',
size: 50, size: 50,
color: '#f0a30a' color: '#f0a30a'

+ 9
- 6
lib/network/Network.js View File

@ -43,14 +43,16 @@ function Network (container, data, options) {
} }
// set constant values // set constant values
this.remainingOptions = {
dataManipulation: {
enabled: false,
initiallyVisible: false
},
this.options = {};
this.defaultOptions = {
//dataManipulation: {
// enabled: false,
// initiallyVisible: false
//},
locale: 'en', locale: 'en',
locales: locales,
locales: locales
}; };
util.extend(this.options, this.defaultOptions);
// containers for nodes and edges // containers for nodes and edges
this.body = { this.body = {
@ -247,6 +249,7 @@ Network.prototype.setOptions = function (options) {
// the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system. // the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system.
options = this.layoutEngine.setOptions(options.layout, options); options = this.layoutEngine.setOptions(options.layout, options);
this.groups.setOptions(options.groups);
this.nodesHandler.setOptions(options.nodes); this.nodesHandler.setOptions(options.nodes);
this.edgesHandler.setOptions(options.edges); this.edgesHandler.setOptions(options.edges);
this.physics.setOptions(options.physics); this.physics.setOptions(options.physics);

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

@ -49,11 +49,11 @@ class Groups {
let optionFields = ['useDefaultGroups']; let optionFields = ['useDefaultGroups'];
if (options !== undefined) { if (options !== undefined) {
for (let groupname in options) {
if (options.hasOwnProperty(groupname)) {
for (let groupName in options) {
if (options.hasOwnProperty(groupName)) {
if (optionFields.indexOf(groupName) == -1) { if (optionFields.indexOf(groupName) == -1) {
let group = options[groupname];
this.add(groupname, group);
let group = options[groupName];
this.add(groupName, group);
} }
} }
} }

+ 1
- 1
lib/network/modules/InteractionHandler.js View File

@ -421,7 +421,7 @@ class InteractionHandler {
* @private * @private
*/ */
onMouseMove(event) { onMouseMove(event) {
let pointer = {x:event.pageX, y:event.pageY};
let pointer = this.getPointer({x:event.pageX, y:event.pageY});
let popupVisible = false; let popupVisible = false;
// check if the previously selected node is still selected // check if the previously selected node is still selected

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

@ -57,10 +57,10 @@ class NodesHandler {
group: undefined, group: undefined,
hidden: false, hidden: false,
icon: { icon: {
fontFace: undefined, //'FontAwesome',
code: undefined, //'\uf007',
size: undefined, //50,
color: undefined //'#aa00ff'
face: undefined, //'FontAwesome',
code: undefined, //'\uf007',
size: undefined, //50,
color:undefined //'#aa00ff'
}, },
image: undefined, // --> URL image: undefined, // --> URL
label: undefined, label: undefined,

+ 1
- 1
lib/network/modules/components/nodes/shapes/icon.js View File

@ -50,7 +50,7 @@ class Icon extends NodeBase {
let relativeIconSize = iconSize * this.body.view.scale; let relativeIconSize = iconSize * this.body.view.scale;
if (this.options.icon.code && relativeIconSize > this.options.scaling.label.drawThreshold - 1) { if (this.options.icon.code && relativeIconSize > this.options.scaling.label.drawThreshold - 1) {
ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.fontFace;
ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.face;
// draw icon // draw icon
ctx.fillStyle = this.options.icon.color || "black"; ctx.fillStyle = this.options.icon.color || "black";

Loading…
Cancel
Save