Browse Source

bridged label object options, fixed bug with self referencing circles

flowchartTest
Alex de Mulder 9 years ago
parent
commit
75f5d48b57
7 changed files with 5818 additions and 5810 deletions
  1. +5803
    -5799
      dist/vis.js
  2. +1
    -0
      lib/network/Network.js
  3. +1
    -1
      lib/network/modules/ConfigurationSystem.js
  4. +1
    -0
      lib/network/modules/NodesHandler.js
  5. +1
    -5
      lib/network/modules/components/Edge.js
  6. +10
    -4
      lib/network/modules/components/edges/util/EdgeBase.js
  7. +1
    -1
      lib/network/modules/components/unified/label.js

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


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

@ -175,6 +175,7 @@ Network.prototype.setOptions = function (options) {
// start the physics simulation. Can be safely called multiple times. // start the physics simulation. Can be safely called multiple times.
this.body.emitter.emit("startSimulation"); this.body.emitter.emit("startSimulation");
this.body.emitter.emit("_requestRedraw");
} }
}; };

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

@ -481,7 +481,7 @@ class ConfigurationSystem {
var me = this; var me = this;
range.onchange = function () {input.value = this.value; me._update(this.value, path);}; range.onchange = function () {input.value = this.value; me._update(this.value, path);};
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._makeEntree(path, label, range, input);

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

@ -124,6 +124,7 @@ class NodesHandler {
for (let nodeId in this.body.nodes) { for (let nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) { if (this.body.nodes.hasOwnProperty(nodeId)) {
this.body.nodes[nodeId].updateLabelModule(); this.body.nodes[nodeId].updateLabelModule();
this.body.nodes[nodeId]._reset();
} }
} }
} }

+ 1
- 5
lib/network/modules/components/Edge.js View File

@ -48,10 +48,6 @@ class Edge {
this.labelModule = new Label(this.body, this.options); this.labelModule = new Label(this.body, this.options);
this.setOptions(options); this.setOptions(options);
this.controlNodesEnabled = false;
this.controlNodes = {from: undefined, to: undefined, positions: {}};
this.connectedNode = undefined;
} }
@ -123,7 +119,7 @@ class Edge {
this.options.color.inherit.enabled = false; this.options.color.inherit.enabled = false;
} }
else { else {
util.extend(this.options.color, options.color);
this.options.color = util.bridgeObject(options.color);
if (options.color.inherit === undefined) { if (options.color.inherit === undefined) {
this.options.color.inherit.enabled = false; this.options.color.inherit.enabled = false;
} }

+ 10
- 4
lib/network/modules/components/edges/util/EdgeBase.js View File

@ -40,7 +40,7 @@ class EdgeBase {
} }
} }
else { else {
let [x,y,radius] = this._getCircleData();
let [x,y,radius] = this._getCircleData(ctx);
this._circle(ctx, x, y, radius); this._circle(ctx, x, y, radius);
} }
@ -116,7 +116,7 @@ class EdgeBase {
to = this._findBorderPosition(this.to, ctx); to = this._findBorderPosition(this.to, ctx);
} }
else { else {
let [x,y,radius] = this._getCircleData();
let [x,y,radius] = this._getCircleData(ctx);
from = this._findBorderPositionCircle(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1}); from = this._findBorderPositionCircle(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1});
to = this._findBorderPositionCircle(this.from, ctx, {x, y, low:0.6, high:0.8, direction:1}); to = this._findBorderPositionCircle(this.from, ctx, {x, y, low:0.6, high:0.8, direction:1});
@ -124,11 +124,17 @@ class EdgeBase {
return {from, to}; return {from, to};
} }
_getCircleData() {
_getCircleData(ctx) {
let x, y; let x, y;
let node = this.from; let node = this.from;
let radius = this.options.selfReferenceSize; let radius = this.options.selfReferenceSize;
if (ctx !== undefined) {
if (node.shape.width === undefined) {
node.shape.resize(ctx);
}
}
// get circle coordinates // get circle coordinates
if (node.shape.width > node.shape.height) { if (node.shape.width > node.shape.height) {
x = node.x + node.shape.width * 0.5; x = node.x + node.shape.width * 0.5;
@ -435,7 +441,7 @@ class EdgeBase {
else { else {
// draw circle // draw circle
let angle, point; let angle, point;
let [x,y,radius] = this._getCircleData();
let [x,y,radius] = this._getCircleData(ctx);
if (position == 'from') { if (position == 'from') {
point = this.findBorderPosition(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1}); point = this.findBorderPosition(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1});

+ 1
- 1
lib/network/modules/components/unified/label.js View File

@ -37,7 +37,7 @@ class Label {
this.fontOptions.color = optionsArray[2]; this.fontOptions.color = optionsArray[2];
} }
else if (typeof options.font == 'object') { else if (typeof options.font == 'object') {
util.protoExtend(this.fontOptions, options.font);
this.fontOptions = util.bridgeObject(options.font);
} }
this.fontOptions.size = Number(this.fontOptions.size); this.fontOptions.size = Number(this.fontOptions.size);
} }

Loading…
Cancel
Save