Browse Source

fixed #899, self referencing edges do not use orientation other than horizontal

flowchartTest
Alex de Mulder 9 years ago
parent
commit
d1b0c59357
3 changed files with 3440 additions and 3432 deletions
  1. +3435
    -3431
      dist/vis.js
  2. +3
    -0
      lib/network/modules/components/Edge.js
  3. +2
    -1
      lib/network/modules/components/shared/Label.js

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


+ 3
- 0
lib/network/modules/components/Edge.js View File

@ -389,6 +389,7 @@ class Edge {
var node2 = this.to;
var selected = (this.from.selected || this.to.selected || this.selected);
if (node1.id != node2.id) {
this.labelModule.pointToSelf = false;
var point = this.edgeType.getPoint(0.5, viaNode);
ctx.save();
@ -404,6 +405,8 @@ class Edge {
ctx.restore();
}
else {
// Ignore the orientations.
this.labelModule.pointToSelf = true;
var x, y;
var radius = this.options.selfReferenceSize;
if (node1.shape.width > node1.shape.height) {

+ 2
- 1
lib/network/modules/components/shared/Label.js View File

@ -4,6 +4,7 @@ class Label {
constructor(body,options) {
this.body = body;
this.pointToSelf = false;
this.baseSize = undefined;
this.setOptions(options);
this.size = {top: 0, left: 0, width: 0, height: 0, yLine: 0}; // could be cached
@ -143,7 +144,7 @@ class Label {
_setAlignment(ctx, x, yLine, baseline) {
// check for label alignment (for edges)
// TODO: make alignment for nodes
if (this.options.font.align !== 'horizontal') {
if (this.options.font.align !== 'horizontal' && this.pointToSelf === false) {
x = 0;
yLine = 0;

Loading…
Cancel
Save