Browse Source

arrows now connect their base to the code of the node per #55

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

+ 6
- 6
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 0.7.0-SNAPSHOT * @version 0.7.0-SNAPSHOT
* @date 2014-03-07
* @date 2014-03-08
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -10996,10 +10996,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) {
@ -11022,7 +11022,7 @@ Edge.prototype._drawArrow = function(ctx) {
} }
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(xFrom,yFrom);
ctx.moveTo(this.from.x,this.from.y);
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);
} }

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


+ 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(xFrom,yFrom);
ctx.moveTo(this.from.x,this.from.y);
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