Browse Source

tweaks and minor bugfix

css_transitions
Alex de Mulder 11 years ago
parent
commit
9f643b964c
3 changed files with 14 additions and 6 deletions
  1. +10
    -2
      src/graph/Edge.js
  2. +2
    -2
      src/graph/Graph.js
  3. +2
    -2
      src/graph/Node.js

+ 10
- 2
src/graph/Edge.js View File

@ -557,6 +557,7 @@ Edge.prototype._drawArrow = function(ctx) {
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) {
angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x));
dx = (this.to.x - this.via.x);
@ -565,9 +566,16 @@ Edge.prototype._drawArrow = function(ctx) {
}
var toBorderDist = this.to.distanceToBorder(ctx, angle);
var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength;
var xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x;
var yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y;
var xTo,yTo;
if (this.smooth == true) {
xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x;
yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y;
}
else {
xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x;
yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y;
}
ctx.beginPath();
ctx.moveTo(xFrom,yFrom);

+ 2
- 2
src/graph/Graph.js View File

@ -22,7 +22,7 @@ function Graph (container, data, options) {
this.renderRefreshRate = 60; // hz (fps)
this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on
this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame
this.maxRenderSteps = 4; // max amount of physics ticks per render step.
this.maxRenderSteps = 3; // max amount of physics ticks per render step.
this.stabilize = true; // stabilize before displaying the graph
this.selectable = true;
@ -1725,7 +1725,7 @@ Graph.prototype._isMoving = function(vmin) {
* @private
*/
Graph.prototype._discreteStepNodes = function() {
var interval = 0.75;
var interval = 0.5;
var nodes = this.nodes;
var nodeId;

+ 2
- 2
src/graph/Node.js View File

@ -235,7 +235,7 @@ Node.parseColor = function(color) {
var lighterColorHex = util.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v);
c = {
border: color,
background: color,
border:darkerColorHex,
highlight: {
background:lighterColorHex,
@ -245,7 +245,7 @@ Node.parseColor = function(color) {
}
else {
c = {
border:color,
background:color,
border:color,
highlight: {
background:color,

Loading…
Cancel
Save