Browse Source

Fixed static smooth edges not being handled correctly in all angles

flowchartTest
Alex de Mulder 9 years ago
parent
commit
b75ccbaf06
3 changed files with 32644 additions and 32654 deletions
  1. +32132
    -32132
      dist/vis.js
  2. +15
    -15
      lib/network/modules/components/edges/BezierEdgeStatic.js
  3. +497
    -507
      test/networkTest.html

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


+ 15
- 15
lib/network/modules/components/edges/BezierEdgeStatic.js View File

@ -40,9 +40,9 @@ class BezierEdgeStatic extends BezierEdgeBase {
let dx = Math.abs(this.from.x - this.to.x); let dx = Math.abs(this.from.x - this.to.x);
let dy = Math.abs(this.from.y - this.to.y); let dy = Math.abs(this.from.y - this.to.y);
if (type === 'discrete' || type === 'diagonalCross') { if (type === 'discrete' || type === 'diagonalCross') {
if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) {
if (this.from.y > this.to.y) {
if (this.from.x < this.to.x) {
if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) {
if (this.from.y >= this.to.y) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dy; xVia = this.from.x + factor * dy;
yVia = this.from.y - factor * dy; yVia = this.from.y - factor * dy;
} }
@ -52,7 +52,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (this.from.y < this.to.y) { else if (this.from.y < this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dy; xVia = this.from.x + factor * dy;
yVia = this.from.y + factor * dy; yVia = this.from.y + factor * dy;
} }
@ -66,8 +66,8 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) {
if (this.from.y > this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.y >= this.to.y) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dx; xVia = this.from.x + factor * dx;
yVia = this.from.y - factor * dx; yVia = this.from.y - factor * dx;
} }
@ -77,7 +77,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (this.from.y < this.to.y) { else if (this.from.y < this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dx; xVia = this.from.x + factor * dx;
yVia = this.from.y + factor * dx; yVia = this.from.y + factor * dx;
} }
@ -92,7 +92,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (type === "straightCross") { else if (type === "straightCross") {
if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down
if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) { // up - down
xVia = this.from.x; xVia = this.from.x;
if (this.from.y < this.to.y) { if (this.from.y < this.to.y) {
yVia = this.to.y - (1 - factor) * dy; yVia = this.to.y - (1 - factor) * dy;
@ -154,9 +154,9 @@ class BezierEdgeStatic extends BezierEdgeBase {
yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle); yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle);
} }
else { // continuous else { // continuous
if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) {
if (this.from.y > this.to.y) {
if (this.from.x < this.to.x) {
if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) {
if (this.from.y >= this.to.y) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dy; xVia = this.from.x + factor * dy;
yVia = this.from.y - factor * dy; yVia = this.from.y - factor * dy;
xVia = this.to.x < xVia ? this.to.x : xVia; xVia = this.to.x < xVia ? this.to.x : xVia;
@ -168,7 +168,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (this.from.y < this.to.y) { else if (this.from.y < this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dy; xVia = this.from.x + factor * dy;
yVia = this.from.y + factor * dy; yVia = this.from.y + factor * dy;
xVia = this.to.x < xVia ? this.to.x : xVia; xVia = this.to.x < xVia ? this.to.x : xVia;
@ -181,8 +181,8 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) {
if (this.from.y > this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.y >= this.to.y) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dx; xVia = this.from.x + factor * dx;
yVia = this.from.y - factor * dx; yVia = this.from.y - factor * dx;
yVia = this.to.y > yVia ? this.to.y : yVia; yVia = this.to.y > yVia ? this.to.y : yVia;
@ -194,7 +194,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
} }
else if (this.from.y < this.to.y) { else if (this.from.y < this.to.y) {
if (this.from.x < this.to.x) {
if (this.from.x <= this.to.x) {
xVia = this.from.x + factor * dx; xVia = this.from.x + factor * dx;
yVia = this.from.y + factor * dx; yVia = this.from.y + factor * dx;
yVia = this.to.y < yVia ? this.to.y : yVia; yVia = this.to.y < yVia ? this.to.y : yVia;

+ 497
- 507
test/networkTest.html
File diff suppressed because it is too large
View File


Loading…
Cancel
Save