three-forcegraph
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -42,2 +42,13 @@ 'use strict'; | ||
var three$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
SphereGeometry: three.SphereGeometry, | ||
BufferGeometry: three.BufferGeometry, | ||
BufferAttribute: three.BufferAttribute, | ||
Mesh: three.Mesh, | ||
MeshLambertMaterial: three.MeshLambertMaterial, | ||
Line: three.Line, | ||
LineBasicMaterial: three.LineBasicMaterial | ||
}; | ||
var ngraph = { graph: graph, forcelayout: forcelayout, forcelayout3d: forcelayout3d }; | ||
@@ -174,3 +185,3 @@ | ||
if (!sphereGeometries.hasOwnProperty(val)) { | ||
sphereGeometries[val] = new three.SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
sphereGeometries[val] = new three$1.SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
} | ||
@@ -180,3 +191,3 @@ | ||
if (!sphereMaterials.hasOwnProperty(color)) { | ||
sphereMaterials[color] = new three.MeshLambertMaterial({ | ||
sphereMaterials[color] = new three$1.MeshLambertMaterial({ | ||
color: colorStr2Hex(color || '#ffffaa'), | ||
@@ -188,3 +199,3 @@ transparent: true, | ||
obj = new three.Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
obj = new three$1.Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
} | ||
@@ -203,3 +214,3 @@ | ||
if (!lineMaterials.hasOwnProperty(color)) { | ||
lineMaterials[color] = new three.LineBasicMaterial({ | ||
lineMaterials[color] = new three$1.LineBasicMaterial({ | ||
color: colorStr2Hex(color || '#f0f0f0'), | ||
@@ -211,6 +222,6 @@ transparent: true, | ||
var geometry = new three.BufferGeometry(); | ||
geometry.addAttribute('position', new three.BufferAttribute(new Float32Array(2 * 3), 3)); | ||
var geometry = new three$1.BufferGeometry(); | ||
geometry.addAttribute('position', new three$1.BufferAttribute(new Float32Array(2 * 3), 3)); | ||
var lineMaterial = lineMaterials[color]; | ||
var line = new three.Line(geometry, lineMaterial); | ||
var line = new three$1.Line(geometry, lineMaterial); | ||
@@ -217,0 +228,0 @@ line.renderOrder = 10; // Prevent visual glitches of dark lines on top of nodes by rendering them last |
@@ -38,2 +38,13 @@ import { BufferAttribute, BufferGeometry, Group, Line, LineBasicMaterial, Mesh, MeshLambertMaterial, SphereGeometry } from 'three'; | ||
var three$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
SphereGeometry: SphereGeometry, | ||
BufferGeometry: BufferGeometry, | ||
BufferAttribute: BufferAttribute, | ||
Mesh: Mesh, | ||
MeshLambertMaterial: MeshLambertMaterial, | ||
Line: Line, | ||
LineBasicMaterial: LineBasicMaterial | ||
}; | ||
var ngraph = { graph: graph, forcelayout: forcelayout, forcelayout3d: forcelayout3d }; | ||
@@ -170,3 +181,3 @@ | ||
if (!sphereGeometries.hasOwnProperty(val)) { | ||
sphereGeometries[val] = new SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
sphereGeometries[val] = new three$1.SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
} | ||
@@ -176,3 +187,3 @@ | ||
if (!sphereMaterials.hasOwnProperty(color)) { | ||
sphereMaterials[color] = new MeshLambertMaterial({ | ||
sphereMaterials[color] = new three$1.MeshLambertMaterial({ | ||
color: colorStr2Hex(color || '#ffffaa'), | ||
@@ -184,3 +195,3 @@ transparent: true, | ||
obj = new Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
obj = new three$1.Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
} | ||
@@ -199,3 +210,3 @@ | ||
if (!lineMaterials.hasOwnProperty(color)) { | ||
lineMaterials[color] = new LineBasicMaterial({ | ||
lineMaterials[color] = new three$1.LineBasicMaterial({ | ||
color: colorStr2Hex(color || '#f0f0f0'), | ||
@@ -207,6 +218,6 @@ transparent: true, | ||
var geometry = new BufferGeometry(); | ||
geometry.addAttribute('position', new BufferAttribute(new Float32Array(2 * 3), 3)); | ||
var geometry = new three$1.BufferGeometry(); | ||
geometry.addAttribute('position', new three$1.BufferAttribute(new Float32Array(2 * 3), 3)); | ||
var lineMaterial = lineMaterials[color]; | ||
var line = new Line(geometry, lineMaterial); | ||
var line = new three$1.Line(geometry, lineMaterial); | ||
@@ -213,0 +224,0 @@ line.renderOrder = 10; // Prevent visual glitches of dark lines on top of nodes by rendering them last |
{ | ||
"name": "three-forcegraph", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Force-directed graph as a ThreeJS 3d object", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/three-forcegraph.min.js", |
@@ -11,2 +11,14 @@ import { | ||
const three = window.THREE | ||
? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
SphereGeometry, | ||
BufferGeometry, | ||
BufferAttribute, | ||
Mesh, | ||
MeshLambertMaterial, | ||
Line, | ||
LineBasicMaterial | ||
}; | ||
import { | ||
@@ -152,3 +164,3 @@ forceSimulation as d3ForceSimulation, | ||
if (!sphereGeometries.hasOwnProperty(val)) { | ||
sphereGeometries[val] = new SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
sphereGeometries[val] = new three.SphereGeometry(Math.cbrt(val) * state.nodeRelSize, state.nodeResolution, state.nodeResolution); | ||
} | ||
@@ -158,3 +170,3 @@ | ||
if (!sphereMaterials.hasOwnProperty(color)) { | ||
sphereMaterials[color] = new MeshLambertMaterial({ | ||
sphereMaterials[color] = new three.MeshLambertMaterial({ | ||
color: colorStr2Hex(color || '#ffffaa'), | ||
@@ -166,3 +178,3 @@ transparent: true, | ||
obj = new Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
obj = new three.Mesh(sphereGeometries[val], sphereMaterials[color]); | ||
} | ||
@@ -181,3 +193,3 @@ | ||
if (!lineMaterials.hasOwnProperty(color)) { | ||
lineMaterials[color] = new LineBasicMaterial({ | ||
lineMaterials[color] = new three.LineBasicMaterial({ | ||
color: colorStr2Hex(color || '#f0f0f0'), | ||
@@ -189,6 +201,6 @@ transparent: true, | ||
const geometry = new BufferGeometry(); | ||
geometry.addAttribute('position', new BufferAttribute(new Float32Array(2 * 3), 3)); | ||
const geometry = new three.BufferGeometry(); | ||
geometry.addAttribute('position', new three.BufferAttribute(new Float32Array(2 * 3), 3)); | ||
const lineMaterial = lineMaterials[color]; | ||
const line = new Line(geometry, lineMaterial); | ||
const line = new three.Line(geometry, lineMaterial); | ||
@@ -195,0 +207,0 @@ line.renderOrder = 10; // Prevent visual glitches of dark lines on top of nodes by rendering them last |
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 not supported yet
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
1136694
9505