Browse Source

arrows working!

flowchartTest
Alex de Mulder 9 years ago
parent
commit
14de6f2cac
7 changed files with 597 additions and 591 deletions
  1. +585
    -582
      dist/vis.js
  2. +1
    -1
      examples/network/01_basic_usage.html
  3. +4
    -4
      lib/network/modules/NodesHandler.js
  4. +0
    -2
      lib/network/modules/components/Edge.js
  5. +1
    -1
      lib/network/modules/components/Node.js
  6. +6
    -0
      lib/network/modules/components/edges/straightEdge.js
  7. +0
    -1
      lib/network/modules/components/edges/util/bezierBaseEdge.js

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


+ 1
- 1
examples/network/01_basic_usage.html View File

@ -33,7 +33,7 @@
var edges = [ var edges = [
{from: 1, to: 3}, {from: 1, to: 3},
{from: 1, to: 1}, {from: 1, to: 1},
{from: 1, to: 2, arrows:{from:true}},
{from: 1, to: 2,smooth:false, arrows:{from:false, middle:false, to: true}},
{from: 2, to: 4}, {from: 2, to: 4},
{from: 2, to: 5} {from: 2, to: 5}
]; ];

+ 4
- 4
lib/network/modules/NodesHandler.js View File

@ -52,15 +52,15 @@ class NodesHandler {
background: 'none', background: 'none',
stroke: 0, // px stroke: 0, // px
strokeColor: 'white', strokeColor: 'white',
align:'horizontal'
align: 'horizontal'
}, },
group: undefined, group: undefined,
hidden: false, hidden: false,
icon: { icon: {
fontFace: undefined, //'FontAwesome', fontFace: undefined, //'FontAwesome',
code: undefined, //'\uf007',
size: undefined, //50,
color: undefined //'#aa00ff'
code: undefined, //'\uf007',
size: undefined, //50,
color: undefined //'#aa00ff'
}, },
image: undefined, // --> URL image: undefined, // --> URL
label: undefined, label: undefined,

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

@ -161,8 +161,6 @@ class Edge {
} }
/** /**
* Enable or disable the physics. * Enable or disable the physics.
* @param status * @param status

+ 1
- 1
lib/network/modules/components/Node.js View File

@ -303,7 +303,7 @@ class Node {
* @returns {number} distance Distance to the border in pixels * @returns {number} distance Distance to the border in pixels
*/ */
distanceToBorder(ctx, angle) { distanceToBorder(ctx, angle) {
this.shape.distanceToBorder(ctx,angle);
return this.shape.distanceToBorder(ctx,angle);
} }

+ 6
- 0
lib/network/modules/components/edges/straightEdge.js View File

@ -42,6 +42,12 @@ class StraightEdge extends BaseEdge {
_findBorderPosition(nearNode, ctx) { _findBorderPosition(nearNode, ctx) {
let node1 = this.to; let node1 = this.to;
let node2 = this.from; let node2 = this.from;
if (nearNode.id === this.from.id) {
node1 = this.from;
node2 = this.to;
}
let angle = Math.atan2((node1.y - node2.y), (node1.x - node2.x)); let angle = Math.atan2((node1.y - node2.y), (node1.x - node2.x));
let dx = (node1.x - node2.x); let dx = (node1.x - node2.x);

+ 0
- 1
lib/network/modules/components/edges/util/bezierBaseEdge.js View File

@ -46,7 +46,6 @@ class BezierBaseEdge extends BaseEdge {
distanceToBorder = node.distanceToBorder(ctx, angle); distanceToBorder = node.distanceToBorder(ctx, angle);
distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2));
difference = distanceToBorder - distanceToPoint; difference = distanceToBorder - distanceToPoint;
console.log(pos, difference, middle)
if (Math.abs(difference) < threshold) { if (Math.abs(difference) < threshold) {
break; // found break; // found
} }

Loading…
Cancel
Save