Browse Source

reverted arrow spawn from center to edge due to labels disappearing behind nodes #49

css_transitions
Alex de Mulder 10 years ago
parent
commit
c25c8214d3
2 changed files with 10 additions and 10 deletions
  1. +5
    -5
      dist/vis.js
  2. +5
    -5
      src/graph/Edge.js

+ 5
- 5
dist/vis.js View File

@ -11010,10 +11010,10 @@ Edge.prototype._drawArrow = function(ctx) {
var dy = (this.to.y - this.from.y); var dy = (this.to.y - this.from.y);
var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
// var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI);
// var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength;
// var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x;
// var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y;
var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI);
var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength;
var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x;
var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y;
if (this.smooth == true) { if (this.smooth == true) {
@ -11036,7 +11036,7 @@ Edge.prototype._drawArrow = function(ctx) {
} }
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.from.x,this.from.y);
ctx.moveTo(xFrom,yFrom);
if (this.smooth == true) { if (this.smooth == true) {
ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo); ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo);
} }

+ 5
- 5
src/graph/Edge.js View File

@ -583,10 +583,10 @@ Edge.prototype._drawArrow = function(ctx) {
var dy = (this.to.y - this.from.y); var dy = (this.to.y - this.from.y);
var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
// var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI);
// var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength;
// var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x;
// var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y;
var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI);
var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength;
var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x;
var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y;
if (this.smooth == true) { if (this.smooth == true) {
@ -609,7 +609,7 @@ Edge.prototype._drawArrow = function(ctx) {
} }
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.from.x,this.from.y);
ctx.moveTo(xFrom,yFrom);
if (this.smooth == true) { if (this.smooth == true) {
ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo); ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo);
} }

Loading…
Cancel
Save