aframe-forcegraph-component
Advanced tools
Comparing version 1.6.8 to 1.6.9
34
index.js
@@ -122,3 +122,6 @@ /* global AFRAME */ | ||
elData.links.forEach(function(link) { | ||
el3d.add(link.__line = new THREE.Line(new THREE.Geometry(), lineMaterial)); | ||
var geometry = new THREE.BufferGeometry(); | ||
geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3)); | ||
el3d.add(link.__line = new THREE.Line(geometry, lineMaterial)); | ||
}); | ||
@@ -184,19 +187,18 @@ | ||
elData.links.forEach(function(link) { | ||
var line = link.__line; | ||
var line = link.__line, | ||
pos = isD3Sim | ||
? link | ||
: layout.getLinkPosition(layout.graph.getLink(link.source, link.target).id), | ||
start = pos[isD3Sim ? 'source' : 'from'], | ||
end = pos[isD3Sim ? 'target' : 'to'], | ||
linePos = line.geometry.attributes.position; | ||
if (isD3Sim) { | ||
line.geometry.vertices = [ | ||
new THREE.Vector3(link.source.x, link.source.y || 0, link.source.z || 0), | ||
new THREE.Vector3(link.target.x, link.target.y || 0, link.target.z || 0) | ||
]; | ||
} else { // ngraph | ||
var pos = layout.getLinkPosition(layout.graph.getLink(link.source, link.target).id); | ||
linePos.array[0] = start.x; | ||
linePos.array[1] = start.y || 0; | ||
linePos.array[2] = start.z || 0; | ||
linePos.array[3] = end.x; | ||
linePos.array[4] = end.y || 0; | ||
linePos.array[5] = end.z || 0; | ||
line.geometry.vertices = [ | ||
new THREE.Vector3(pos.from.x, pos.from.y || 0, pos.from.z || 0), | ||
new THREE.Vector3(pos.to.x, pos.to.y || 0, pos.to.z || 0) | ||
]; | ||
} | ||
line.geometry.verticesNeedUpdate = true; | ||
linePos.needsUpdate = true; | ||
line.geometry.computeBoundingSphere(); | ||
@@ -203,0 +205,0 @@ }); |
{ | ||
"name": "aframe-forcegraph-component", | ||
"version": "1.6.8", | ||
"version": "1.6.9", | ||
"description": "A 3D Force-Directed Graph component for A-Frame.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32
8111
1332301