3d-force-graph 1.72.0 → 1.72.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // Version 1.72.0 3d-force-graph - https://github.com/vasturiano/3d-force-graph
1
+ // Version 1.72.1 3d-force-graph - https://github.com/vasturiano/3d-force-graph
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -32928,6 +32928,264 @@
32928
32928
 
32929
32929
  }
32930
32930
 
32931
+ class Light extends Object3D {
32932
+
32933
+ constructor( color, intensity = 1 ) {
32934
+
32935
+ super();
32936
+
32937
+ this.isLight = true;
32938
+
32939
+ this.type = 'Light';
32940
+
32941
+ this.color = new Color( color );
32942
+ this.intensity = intensity;
32943
+
32944
+ }
32945
+
32946
+ dispose() {
32947
+
32948
+ // Empty here in base class; some subclasses override.
32949
+
32950
+ }
32951
+
32952
+ copy( source, recursive ) {
32953
+
32954
+ super.copy( source, recursive );
32955
+
32956
+ this.color.copy( source.color );
32957
+ this.intensity = source.intensity;
32958
+
32959
+ return this;
32960
+
32961
+ }
32962
+
32963
+ toJSON( meta ) {
32964
+
32965
+ const data = super.toJSON( meta );
32966
+
32967
+ data.object.color = this.color.getHex();
32968
+ data.object.intensity = this.intensity;
32969
+
32970
+ if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
32971
+
32972
+ if ( this.distance !== undefined ) data.object.distance = this.distance;
32973
+ if ( this.angle !== undefined ) data.object.angle = this.angle;
32974
+ if ( this.decay !== undefined ) data.object.decay = this.decay;
32975
+ if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
32976
+
32977
+ if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
32978
+
32979
+ return data;
32980
+
32981
+ }
32982
+
32983
+ }
32984
+
32985
+ const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();
32986
+ const _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();
32987
+ const _lookTarget$1 = /*@__PURE__*/ new Vector3();
32988
+
32989
+ class LightShadow {
32990
+
32991
+ constructor( camera ) {
32992
+
32993
+ this.camera = camera;
32994
+
32995
+ this.bias = 0;
32996
+ this.normalBias = 0;
32997
+ this.radius = 1;
32998
+ this.blurSamples = 8;
32999
+
33000
+ this.mapSize = new Vector2( 512, 512 );
33001
+
33002
+ this.map = null;
33003
+ this.mapPass = null;
33004
+ this.matrix = new Matrix4();
33005
+
33006
+ this.autoUpdate = true;
33007
+ this.needsUpdate = false;
33008
+
33009
+ this._frustum = new Frustum();
33010
+ this._frameExtents = new Vector2( 1, 1 );
33011
+
33012
+ this._viewportCount = 1;
33013
+
33014
+ this._viewports = [
33015
+
33016
+ new Vector4( 0, 0, 1, 1 )
33017
+
33018
+ ];
33019
+
33020
+ }
33021
+
33022
+ getViewportCount() {
33023
+
33024
+ return this._viewportCount;
33025
+
33026
+ }
33027
+
33028
+ getFrustum() {
33029
+
33030
+ return this._frustum;
33031
+
33032
+ }
33033
+
33034
+ updateMatrices( light ) {
33035
+
33036
+ const shadowCamera = this.camera;
33037
+ const shadowMatrix = this.matrix;
33038
+
33039
+ _lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );
33040
+ shadowCamera.position.copy( _lightPositionWorld$1 );
33041
+
33042
+ _lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );
33043
+ shadowCamera.lookAt( _lookTarget$1 );
33044
+ shadowCamera.updateMatrixWorld();
33045
+
33046
+ _projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
33047
+ this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );
33048
+
33049
+ shadowMatrix.set(
33050
+ 0.5, 0.0, 0.0, 0.5,
33051
+ 0.0, 0.5, 0.0, 0.5,
33052
+ 0.0, 0.0, 0.5, 0.5,
33053
+ 0.0, 0.0, 0.0, 1.0
33054
+ );
33055
+
33056
+ shadowMatrix.multiply( _projScreenMatrix$1 );
33057
+
33058
+ }
33059
+
33060
+ getViewport( viewportIndex ) {
33061
+
33062
+ return this._viewports[ viewportIndex ];
33063
+
33064
+ }
33065
+
33066
+ getFrameExtents() {
33067
+
33068
+ return this._frameExtents;
33069
+
33070
+ }
33071
+
33072
+ dispose() {
33073
+
33074
+ if ( this.map ) {
33075
+
33076
+ this.map.dispose();
33077
+
33078
+ }
33079
+
33080
+ if ( this.mapPass ) {
33081
+
33082
+ this.mapPass.dispose();
33083
+
33084
+ }
33085
+
33086
+ }
33087
+
33088
+ copy( source ) {
33089
+
33090
+ this.camera = source.camera.clone();
33091
+
33092
+ this.bias = source.bias;
33093
+ this.radius = source.radius;
33094
+
33095
+ this.mapSize.copy( source.mapSize );
33096
+
33097
+ return this;
33098
+
33099
+ }
33100
+
33101
+ clone() {
33102
+
33103
+ return new this.constructor().copy( this );
33104
+
33105
+ }
33106
+
33107
+ toJSON() {
33108
+
33109
+ const object = {};
33110
+
33111
+ if ( this.bias !== 0 ) object.bias = this.bias;
33112
+ if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
33113
+ if ( this.radius !== 1 ) object.radius = this.radius;
33114
+ if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();
33115
+
33116
+ object.camera = this.camera.toJSON( false ).object;
33117
+ delete object.camera.matrix;
33118
+
33119
+ return object;
33120
+
33121
+ }
33122
+
33123
+ }
33124
+
33125
+ class DirectionalLightShadow extends LightShadow {
33126
+
33127
+ constructor() {
33128
+
33129
+ super( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );
33130
+
33131
+ this.isDirectionalLightShadow = true;
33132
+
33133
+ }
33134
+
33135
+ }
33136
+
33137
+ class DirectionalLight extends Light {
33138
+
33139
+ constructor( color, intensity ) {
33140
+
33141
+ super( color, intensity );
33142
+
33143
+ this.isDirectionalLight = true;
33144
+
33145
+ this.type = 'DirectionalLight';
33146
+
33147
+ this.position.copy( Object3D.DEFAULT_UP );
33148
+ this.updateMatrix();
33149
+
33150
+ this.target = new Object3D();
33151
+
33152
+ this.shadow = new DirectionalLightShadow();
33153
+
33154
+ }
33155
+
33156
+ dispose() {
33157
+
33158
+ this.shadow.dispose();
33159
+
33160
+ }
33161
+
33162
+ copy( source ) {
33163
+
33164
+ super.copy( source );
33165
+
33166
+ this.target = source.target.clone();
33167
+ this.shadow = source.shadow.clone();
33168
+
33169
+ return this;
33170
+
33171
+ }
33172
+
33173
+ }
33174
+
33175
+ class AmbientLight extends Light {
33176
+
33177
+ constructor( color, intensity ) {
33178
+
33179
+ super( color, intensity );
33180
+
33181
+ this.isAmbientLight = true;
33182
+
33183
+ this.type = 'AmbientLight';
33184
+
33185
+ }
33186
+
33187
+ }
33188
+
32931
33189
  class Clock {
32932
33190
 
32933
33191
  constructor( autoStart = true ) {
@@ -40826,7 +41084,7 @@ function InsertStackElement(node, body) {
40826
41084
  }
40827
41085
  }
40828
41086
 
40829
- var three$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
41087
+ var three$1$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
40830
41088
  : {
40831
41089
  Group: Group$1,
40832
41090
  Mesh: Mesh,
@@ -40856,8 +41114,8 @@ function InsertStackElement(node, body) {
40856
41114
  var DAG_LEVEL_NODE_RATIO = 2;
40857
41115
 
40858
41116
  // support multiple method names for backwards threejs compatibility
40859
- var setAttributeFn = new three$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
40860
- var applyMatrix4Fn = new three$1.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
41117
+ var setAttributeFn = new three$1$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
41118
+ var applyMatrix4Fn = new three$1$1.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
40861
41119
  var ForceGraph = index$2({
40862
41120
  props: {
40863
41121
  jsonUrl: {
@@ -41220,7 +41478,7 @@ function InsertStackElement(node, body) {
41220
41478
  // straight line
41221
41479
  var linePos = line.geometry.getAttribute('position');
41222
41480
  if (!linePos || !linePos.array || linePos.array.length !== 6) {
41223
- line.geometry[setAttributeFn]('position', linePos = new three$1.BufferAttribute(new Float32Array(2 * 3), 3));
41481
+ line.geometry[setAttributeFn]('position', linePos = new three$1$1.BufferAttribute(new Float32Array(2 * 3), 3));
41224
41482
  }
41225
41483
  linePos.array[0] = start.x;
41226
41484
  linePos.array[1] = start.y || 0;
@@ -41242,14 +41500,14 @@ function InsertStackElement(node, body) {
41242
41500
  if (!line.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)) {
41243
41501
  var linkWidth = Math.ceil(linkWidthAccessor(link) * 10) / 10;
41244
41502
  var r = linkWidth / 2;
41245
- var geometry = new three$1.CylinderGeometry(r, r, 1, state.linkResolution, 1, false);
41246
- geometry[applyMatrix4Fn](new three$1.Matrix4().makeTranslation(0, 1 / 2, 0));
41247
- geometry[applyMatrix4Fn](new three$1.Matrix4().makeRotationX(Math.PI / 2));
41503
+ var geometry = new three$1$1.CylinderGeometry(r, r, 1, state.linkResolution, 1, false);
41504
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeTranslation(0, 1 / 2, 0));
41505
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeRotationX(Math.PI / 2));
41248
41506
  line.geometry.dispose();
41249
41507
  line.geometry = geometry;
41250
41508
  }
41251
- var vStart = new three$1.Vector3(start.x, start.y || 0, start.z || 0);
41252
- var vEnd = new three$1.Vector3(end.x, end.y || 0, end.z || 0);
41509
+ var vStart = new three$1$1.Vector3(start.x, start.y || 0, start.z || 0);
41510
+ var vEnd = new three$1$1.Vector3(end.x, end.y || 0, end.z || 0);
41253
41511
  var distance = vStart.distanceTo(vEnd);
41254
41512
  line.position.x = vStart.x;
41255
41513
  line.position.y = vStart.y;
@@ -41267,7 +41525,7 @@ function InsertStackElement(node, body) {
41267
41525
  }
41268
41526
  var _linkWidth = Math.ceil(linkWidthAccessor(link) * 10) / 10;
41269
41527
  var _r = _linkWidth / 2;
41270
- var _geometry = new three$1.TubeGeometry(curve, curveResolution, _r, state.linkResolution, false);
41528
+ var _geometry = new three$1$1.TubeGeometry(curve, curveResolution, _r, state.linkResolution, false);
41271
41529
  line.geometry.dispose();
41272
41530
  line.geometry = _geometry;
41273
41531
  }
@@ -41287,8 +41545,8 @@ function InsertStackElement(node, body) {
41287
41545
  link.__curve = null; // Straight line
41288
41546
  } else {
41289
41547
  // bezier curve line (only for line types)
41290
- var vStart = new three$1.Vector3(start.x, start.y || 0, start.z || 0);
41291
- var vEnd = new three$1.Vector3(end.x, end.y || 0, end.z || 0);
41548
+ var vStart = new three$1$1.Vector3(start.x, start.y || 0, start.z || 0);
41549
+ var vEnd = new three$1$1.Vector3(end.x, end.y || 0, end.z || 0);
41292
41550
  var l = vStart.distanceTo(vEnd); // line length
41293
41551
 
41294
41552
  var curve;
@@ -41296,17 +41554,17 @@ function InsertStackElement(node, body) {
41296
41554
  if (l > 0) {
41297
41555
  var dx = end.x - start.x;
41298
41556
  var dy = end.y - start.y || 0;
41299
- var vLine = new three$1.Vector3().subVectors(vEnd, vStart);
41300
- var cp = vLine.clone().multiplyScalar(curvature).cross(dx !== 0 || dy !== 0 ? new three$1.Vector3(0, 0, 1) : new three$1.Vector3(0, 1, 0)) // avoid cross-product of parallel vectors (prefer Z, fallback to Y)
41557
+ var vLine = new three$1$1.Vector3().subVectors(vEnd, vStart);
41558
+ var cp = vLine.clone().multiplyScalar(curvature).cross(dx !== 0 || dy !== 0 ? new three$1$1.Vector3(0, 0, 1) : new three$1$1.Vector3(0, 1, 0)) // avoid cross-product of parallel vectors (prefer Z, fallback to Y)
41301
41559
  .applyAxisAngle(vLine.normalize(), curveRotation) // rotate along line axis according to linkCurveRotation
41302
- .add(new three$1.Vector3().addVectors(vStart, vEnd).divideScalar(2));
41303
- curve = new three$1.QuadraticBezierCurve3(vStart, cp, vEnd);
41560
+ .add(new three$1$1.Vector3().addVectors(vStart, vEnd).divideScalar(2));
41561
+ curve = new three$1$1.QuadraticBezierCurve3(vStart, cp, vEnd);
41304
41562
  } else {
41305
41563
  // Same point, draw a loop
41306
41564
  var d = curvature * 70;
41307
41565
  var endAngle = -curveRotation; // Rotate clockwise (from Z angle perspective)
41308
41566
  var startAngle = endAngle + Math.PI / 2;
41309
- curve = new three$1.CubicBezierCurve3(vStart, new three$1.Vector3(d * Math.cos(startAngle), d * Math.sin(startAngle), 0).add(vStart), new three$1.Vector3(d * Math.cos(endAngle), d * Math.sin(endAngle), 0).add(vStart), vEnd);
41567
+ curve = new three$1$1.CubicBezierCurve3(vStart, new three$1$1.Vector3(d * Math.cos(startAngle), d * Math.sin(startAngle), 0).add(vStart), new three$1$1.Vector3(d * Math.cos(endAngle), d * Math.sin(endAngle), 0).add(vStart), vEnd);
41310
41568
  }
41311
41569
  link.__curve = curve;
41312
41570
  }
@@ -41354,7 +41612,7 @@ function InsertStackElement(node, body) {
41354
41612
  ['x', 'y', 'z'].forEach(function (dim) {
41355
41613
  return arrowObj.position[dim] = arrowTail[dim];
41356
41614
  });
41357
- var headVec = _construct$1(three$1.Vector3, _toConsumableArray$1(['x', 'y', 'z'].map(function (c) {
41615
+ var headVec = _construct$1(three$1$1.Vector3, _toConsumableArray$1(['x', 'y', 'z'].map(function (c) {
41358
41616
  return arrowHead[c];
41359
41617
  })));
41360
41618
  arrowObj.parent.localToWorld(headVec); // lookAt requires world coords
@@ -41417,7 +41675,7 @@ function InsertStackElement(node, body) {
41417
41675
  emitParticle: function emitParticle(state, link) {
41418
41676
  if (link && state.graphData.links.includes(link)) {
41419
41677
  if (!link.__singleHopPhotonsObj) {
41420
- var obj = new three$1.Group();
41678
+ var obj = new three$1$1.Group();
41421
41679
  obj.__linkThreeObjType = 'singleHopPhotons';
41422
41680
  link.__singleHopPhotonsObj = obj;
41423
41681
  state.graphScene.add(obj);
@@ -41425,20 +41683,20 @@ function InsertStackElement(node, body) {
41425
41683
  var particleWidthAccessor = index$1(state.linkDirectionalParticleWidth);
41426
41684
  var photonR = Math.ceil(particleWidthAccessor(link) * 10) / 10 / 2;
41427
41685
  var numSegments = state.linkDirectionalParticleResolution;
41428
- var particleGeometry = new three$1.SphereGeometry(photonR, numSegments, numSegments);
41686
+ var particleGeometry = new three$1$1.SphereGeometry(photonR, numSegments, numSegments);
41429
41687
  var linkColorAccessor = index$1(state.linkColor);
41430
41688
  var particleColorAccessor = index$1(state.linkDirectionalParticleColor);
41431
41689
  var photonColor = particleColorAccessor(link) || linkColorAccessor(link) || '#f0f0f0';
41432
- var materialColor = new three$1.Color(colorStr2Hex(photonColor));
41690
+ var materialColor = new three$1$1.Color(colorStr2Hex(photonColor));
41433
41691
  var opacity = state.linkOpacity * 3;
41434
- var particleMaterial = new three$1.MeshLambertMaterial({
41692
+ var particleMaterial = new three$1$1.MeshLambertMaterial({
41435
41693
  color: materialColor,
41436
41694
  transparent: true,
41437
41695
  opacity: opacity
41438
41696
  });
41439
41697
 
41440
41698
  // add a single hop particle
41441
- link.__singleHopPhotonsObj.add(new three$1.Mesh(particleGeometry, particleMaterial));
41699
+ link.__singleHopPhotonsObj.add(new three$1$1.Mesh(particleGeometry, particleMaterial));
41442
41700
  }
41443
41701
  return this;
41444
41702
  },
@@ -41453,7 +41711,7 @@ function InsertStackElement(node, body) {
41453
41711
  var bboxes = [];
41454
41712
  if (obj.geometry) {
41455
41713
  obj.geometry.computeBoundingBox();
41456
- var box = new three$1.Box3();
41714
+ var box = new three$1$1.Box3();
41457
41715
  box.copy(obj.geometry.boundingBox).applyMatrix4(obj.matrixWorld);
41458
41716
  bboxes.push(box);
41459
41717
  }
@@ -41530,7 +41788,7 @@ function InsertStackElement(node, body) {
41530
41788
  obj = customObj;
41531
41789
  } else {
41532
41790
  // Add default object (sphere mesh)
41533
- obj = new three$1.Mesh();
41791
+ obj = new three$1$1.Mesh();
41534
41792
  obj.__graphDefaultObj = true;
41535
41793
  if (customObj && extendObj) {
41536
41794
  obj.add(customObj); // extend default with custom
@@ -41549,17 +41807,17 @@ function InsertStackElement(node, body) {
41549
41807
  var numSegments = state.nodeResolution;
41550
41808
  if (!obj.geometry.type.match(/^Sphere(Buffer)?Geometry$/) || obj.geometry.parameters.radius !== radius || obj.geometry.parameters.widthSegments !== numSegments) {
41551
41809
  if (!sphereGeometries.hasOwnProperty(val)) {
41552
- sphereGeometries[val] = new three$1.SphereGeometry(radius, numSegments, numSegments);
41810
+ sphereGeometries[val] = new three$1$1.SphereGeometry(radius, numSegments, numSegments);
41553
41811
  }
41554
41812
  obj.geometry.dispose();
41555
41813
  obj.geometry = sphereGeometries[val];
41556
41814
  }
41557
41815
  var color = colorAccessor(node);
41558
- var materialColor = new three$1.Color(colorStr2Hex(color || '#ffffaa'));
41816
+ var materialColor = new three$1$1.Color(colorStr2Hex(color || '#ffffaa'));
41559
41817
  var opacity = state.nodeOpacity * colorAlpha(color);
41560
41818
  if (obj.material.type !== 'MeshLambertMaterial' || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
41561
41819
  if (!sphereMaterials.hasOwnProperty(color)) {
41562
- sphereMaterials[color] = new three$1.MeshLambertMaterial({
41820
+ sphereMaterials[color] = new three$1$1.MeshLambertMaterial({
41563
41821
  color: materialColor,
41564
41822
  transparent: true,
41565
41823
  opacity: opacity
@@ -41617,12 +41875,12 @@ function InsertStackElement(node, body) {
41617
41875
  // construct default line obj
41618
41876
  var useCylinder = !!widthAccessor(link);
41619
41877
  if (useCylinder) {
41620
- defaultObj = new three$1.Mesh();
41878
+ defaultObj = new three$1$1.Mesh();
41621
41879
  } else {
41622
41880
  // Use plain line (constant width)
41623
- var lineGeometry = new three$1.BufferGeometry();
41624
- lineGeometry[setAttributeFn]('position', new three$1.BufferAttribute(new Float32Array(2 * 3), 3));
41625
- defaultObj = new three$1.Line(lineGeometry);
41881
+ var lineGeometry = new three$1$1.BufferGeometry();
41882
+ lineGeometry[setAttributeFn]('position', new three$1$1.BufferAttribute(new Float32Array(2 * 3), 3));
41883
+ defaultObj = new three$1$1.Line(lineGeometry);
41626
41884
  }
41627
41885
  }
41628
41886
  var obj;
@@ -41635,7 +41893,7 @@ function InsertStackElement(node, body) {
41635
41893
  obj = customObj;
41636
41894
  } else {
41637
41895
  // extend default with custom in a group
41638
- obj = new three$1.Group();
41896
+ obj = new three$1$1.Group();
41639
41897
  obj.__graphDefaultObj = true;
41640
41898
  obj.add(defaultObj);
41641
41899
  obj.add(customObj);
@@ -41659,9 +41917,9 @@ function InsertStackElement(node, body) {
41659
41917
  var numSegments = state.linkResolution;
41660
41918
  if (!obj.geometry.type.match(/^Cylinder(Buffer)?Geometry$/) || obj.geometry.parameters.radiusTop !== r || obj.geometry.parameters.radialSegments !== numSegments) {
41661
41919
  if (!cylinderGeometries.hasOwnProperty(linkWidth)) {
41662
- var geometry = new three$1.CylinderGeometry(r, r, 1, numSegments, 1, false);
41663
- geometry[applyMatrix4Fn](new three$1.Matrix4().makeTranslation(0, 1 / 2, 0));
41664
- geometry[applyMatrix4Fn](new three$1.Matrix4().makeRotationX(Math.PI / 2));
41920
+ var geometry = new three$1$1.CylinderGeometry(r, r, 1, numSegments, 1, false);
41921
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeTranslation(0, 1 / 2, 0));
41922
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeRotationX(Math.PI / 2));
41665
41923
  cylinderGeometries[linkWidth] = geometry;
41666
41924
  }
41667
41925
  obj.geometry.dispose();
@@ -41673,13 +41931,13 @@ function InsertStackElement(node, body) {
41673
41931
  obj.material = customMaterial;
41674
41932
  } else {
41675
41933
  var color = _colorAccessor(link);
41676
- var materialColor = new three$1.Color(colorStr2Hex(color || '#f0f0f0'));
41934
+ var materialColor = new three$1$1.Color(colorStr2Hex(color || '#f0f0f0'));
41677
41935
  var opacity = state.linkOpacity * colorAlpha(color);
41678
41936
  var materialType = useCylinder ? 'MeshLambertMaterial' : 'LineBasicMaterial';
41679
41937
  if (obj.material.type !== materialType || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
41680
41938
  var lineMaterials = useCylinder ? lambertLineMaterials : basicLineMaterials;
41681
41939
  if (!lineMaterials.hasOwnProperty(color)) {
41682
- lineMaterials[color] = new three$1[materialType]({
41940
+ lineMaterials[color] = new three$1$1[materialType]({
41683
41941
  color: materialColor,
41684
41942
  transparent: opacity < 1,
41685
41943
  opacity: opacity,
@@ -41705,7 +41963,7 @@ function InsertStackElement(node, body) {
41705
41963
  return obj.__linkThreeObjType === 'arrow';
41706
41964
  },
41707
41965
  createObj: function createObj() {
41708
- var obj = new three$1.Mesh(undefined, new three$1.MeshLambertMaterial({
41966
+ var obj = new three$1$1.Mesh(undefined, new three$1$1.MeshLambertMaterial({
41709
41967
  transparent: true
41710
41968
  }));
41711
41969
  obj.__linkThreeObjType = 'arrow'; // Add object type
@@ -41716,7 +41974,7 @@ function InsertStackElement(node, body) {
41716
41974
  var arrowLength = arrowLengthAccessor(link);
41717
41975
  var numSegments = state.linkDirectionalArrowResolution;
41718
41976
  if (!obj.geometry.type.match(/^Cone(Buffer)?Geometry$/) || obj.geometry.parameters.height !== arrowLength || obj.geometry.parameters.radialSegments !== numSegments) {
41719
- var coneGeometry = new three$1.ConeGeometry(arrowLength * 0.25, arrowLength, numSegments);
41977
+ var coneGeometry = new three$1$1.ConeGeometry(arrowLength * 0.25, arrowLength, numSegments);
41720
41978
  // Correct orientation
41721
41979
  coneGeometry.translate(0, arrowLength / 2, 0);
41722
41980
  coneGeometry.rotateX(Math.PI / 2);
@@ -41724,7 +41982,7 @@ function InsertStackElement(node, body) {
41724
41982
  obj.geometry = coneGeometry;
41725
41983
  }
41726
41984
  var arrowColor = arrowColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
41727
- obj.material.color = new three$1.Color(colorStr2Hex(arrowColor));
41985
+ obj.material.color = new three$1$1.Color(colorStr2Hex(arrowColor));
41728
41986
  obj.material.opacity = state.linkOpacity * 3 * colorAlpha(arrowColor);
41729
41987
  }
41730
41988
  });
@@ -41744,7 +42002,7 @@ function InsertStackElement(node, body) {
41744
42002
  return obj.__linkThreeObjType === 'photons';
41745
42003
  },
41746
42004
  createObj: function createObj() {
41747
- var obj = new three$1.Group();
42005
+ var obj = new three$1$1.Group();
41748
42006
  obj.__linkThreeObjType = 'photons'; // Add object type
41749
42007
 
41750
42008
  return obj;
@@ -41759,20 +42017,20 @@ function InsertStackElement(node, body) {
41759
42017
  particleGeometry = curPhoton.geometry;
41760
42018
  } else {
41761
42019
  if (!particleGeometries.hasOwnProperty(photonR)) {
41762
- particleGeometries[photonR] = new three$1.SphereGeometry(photonR, numSegments, numSegments);
42020
+ particleGeometries[photonR] = new three$1$1.SphereGeometry(photonR, numSegments, numSegments);
41763
42021
  }
41764
42022
  particleGeometry = particleGeometries[photonR];
41765
42023
  curPhoton && curPhoton.geometry.dispose();
41766
42024
  }
41767
42025
  var photonColor = particleColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
41768
- var materialColor = new three$1.Color(colorStr2Hex(photonColor));
42026
+ var materialColor = new three$1$1.Color(colorStr2Hex(photonColor));
41769
42027
  var opacity = state.linkOpacity * 3;
41770
42028
  var particleMaterial;
41771
42029
  if (curPhoton && curPhoton.material.color.equals(materialColor) && curPhoton.material.opacity === opacity) {
41772
42030
  particleMaterial = curPhoton.material;
41773
42031
  } else {
41774
42032
  if (!particleMaterials.hasOwnProperty(photonColor)) {
41775
- particleMaterials[photonColor] = new three$1.MeshLambertMaterial({
42033
+ particleMaterials[photonColor] = new three$1$1.MeshLambertMaterial({
41776
42034
  color: materialColor,
41777
42035
  transparent: true,
41778
42036
  opacity: opacity
@@ -41792,7 +42050,7 @@ function InsertStackElement(node, body) {
41792
42050
  return d.idx;
41793
42051
  },
41794
42052
  createObj: function createObj() {
41795
- return new three$1.Mesh(particleGeometry, particleMaterial);
42053
+ return new three$1$1.Mesh(particleGeometry, particleMaterial);
41796
42054
  },
41797
42055
  updateObj: function updateObj(obj) {
41798
42056
  obj.geometry = particleGeometry;
@@ -46698,7 +46956,7 @@ function InsertStackElement(node, body) {
46698
46956
  return typeof key === "symbol" ? key : String(key);
46699
46957
  }
46700
46958
 
46701
- var three = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
46959
+ var three$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
46702
46960
  : {
46703
46961
  WebGLRenderer: WebGLRenderer,
46704
46962
  Scene: Scene,
@@ -46883,7 +47141,7 @@ function InsertStackElement(node, body) {
46883
47141
  if (z !== undefined) camera.position.z = z;
46884
47142
  }
46885
47143
  function setLookAt(lookAt) {
46886
- var lookAtVect = new three.Vector3(lookAt.x, lookAt.y, lookAt.z);
47144
+ var lookAtVect = new three$1.Vector3(lookAt.x, lookAt.y, lookAt.z);
46887
47145
  if (state.controls.target) {
46888
47146
  state.controls.target = lookAtVect;
46889
47147
  } else {
@@ -46893,7 +47151,7 @@ function InsertStackElement(node, body) {
46893
47151
  }
46894
47152
 
46895
47153
  function getLookAt() {
46896
- return Object.assign(new three.Vector3(0, 0, -1000).applyQuaternion(camera.quaternion).add(camera.position));
47154
+ return Object.assign(new three$1.Vector3(0, 0, -1000).applyQuaternion(camera.quaternion).add(camera.position));
46897
47155
  }
46898
47156
  },
46899
47157
  zoomToFit: function zoomToFit(state) {
@@ -46910,7 +47168,7 @@ function InsertStackElement(node, body) {
46910
47168
  // based on https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24
46911
47169
  var camera = state.camera;
46912
47170
  if (bbox) {
46913
- var center = new three.Vector3(0, 0, 0); // reset camera aim to center
47171
+ var center = new three$1.Vector3(0, 0, 0); // reset camera aim to center
46914
47172
  var maxBoxSide = Math.max.apply(Math, _toConsumableArray(Object.entries(bbox).map(function (_ref) {
46915
47173
  var _ref2 = _slicedToArray(_ref, 2),
46916
47174
  coordType = _ref2[0],
@@ -46936,7 +47194,7 @@ function InsertStackElement(node, body) {
46936
47194
  var objFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
46937
47195
  return true;
46938
47196
  };
46939
- var box = new three.Box3(new three.Vector3(0, 0, 0), new three.Vector3(0, 0, 0));
47197
+ var box = new three$1.Box3(new three$1.Vector3(0, 0, 0), new three$1.Vector3(0, 0, 0));
46940
47198
  var objs = state.objects.filter(objFilter);
46941
47199
  if (!objs.length) return null;
46942
47200
  objs.forEach(function (obj) {
@@ -46949,7 +47207,7 @@ function InsertStackElement(node, body) {
46949
47207
  })));
46950
47208
  },
46951
47209
  getScreenCoords: function getScreenCoords(state, x, y, z) {
46952
- var vec = new three.Vector3(x, y, z);
47210
+ var vec = new three$1.Vector3(x, y, z);
46953
47211
  vec.project(this.camera()); // project to the camera plane
46954
47212
  return {
46955
47213
  // align relative pos to canvas dimensions
@@ -46959,14 +47217,14 @@ function InsertStackElement(node, body) {
46959
47217
  },
46960
47218
  getSceneCoords: function getSceneCoords(state, screenX, screenY) {
46961
47219
  var distance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
46962
- var relCoords = new three.Vector2(screenX / state.width * 2 - 1, -(screenY / state.height) * 2 + 1);
46963
- var raycaster = new three.Raycaster();
47220
+ var relCoords = new three$1.Vector2(screenX / state.width * 2 - 1, -(screenY / state.height) * 2 + 1);
47221
+ var raycaster = new three$1.Raycaster();
46964
47222
  raycaster.setFromCamera(relCoords, state.camera);
46965
- return Object.assign({}, raycaster.ray.at(distance, new three.Vector3()));
47223
+ return Object.assign({}, raycaster.ray.at(distance, new three$1.Vector3()));
46966
47224
  },
46967
47225
  intersectingObjects: function intersectingObjects(state, x, y) {
46968
- var relCoords = new three.Vector2(x / state.width * 2 - 1, -(y / state.height) * 2 + 1);
46969
- var raycaster = new three.Raycaster();
47226
+ var relCoords = new three$1.Vector2(x / state.width * 2 - 1, -(y / state.height) * 2 + 1);
47227
+ var raycaster = new three$1.Raycaster();
46970
47228
  raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision
46971
47229
  raycaster.setFromCamera(relCoords, state.camera);
46972
47230
  return raycaster.intersectObjects(state.objects, true);
@@ -46993,9 +47251,9 @@ function InsertStackElement(node, body) {
46993
47251
 
46994
47252
  stateInit: function stateInit() {
46995
47253
  return {
46996
- scene: new three.Scene(),
46997
- camera: new three.PerspectiveCamera(),
46998
- clock: new three.Clock()
47254
+ scene: new three$1.Scene(),
47255
+ camera: new three$1.PerspectiveCamera(),
47256
+ clock: new three$1.Clock()
46999
47257
  };
47000
47258
  },
47001
47259
  init: function init(domNode, state) {
@@ -47032,7 +47290,7 @@ function InsertStackElement(node, body) {
47032
47290
  state.container.appendChild(state.toolTipElem);
47033
47291
 
47034
47292
  // Capture pointer coords on move or touchstart
47035
- state.pointerPos = new three.Vector2();
47293
+ state.pointerPos = new three$1.Vector2();
47036
47294
  state.pointerPos.x = -2; // Initialize off canvas
47037
47295
  state.pointerPos.y = -2;
47038
47296
  ['pointermove', 'pointerdown'].forEach(function (evType) {
@@ -47104,7 +47362,7 @@ function InsertStackElement(node, body) {
47104
47362
  });
47105
47363
 
47106
47364
  // Setup renderer, camera and controls
47107
- state.renderer = new three.WebGLRenderer(Object.assign({
47365
+ state.renderer = new three$1.WebGLRenderer(Object.assign({
47108
47366
  antialias: true,
47109
47367
  alpha: true
47110
47368
  }, rendererConfig));
@@ -47160,7 +47418,7 @@ function InsertStackElement(node, body) {
47160
47418
  state.camera.position.z = 1000;
47161
47419
 
47162
47420
  // add sky
47163
- state.scene.add(state.skysphere = new three.Mesh());
47421
+ state.scene.add(state.skysphere = new three$1.Mesh());
47164
47422
  state.skysphere.visible = false;
47165
47423
  state.loadComplete = state.scene.visible = !waitForLoadComplete;
47166
47424
  window.scene = state.scene;
@@ -47180,12 +47438,12 @@ function InsertStackElement(node, body) {
47180
47438
  state.controls.hasOwnProperty('maxDistance') && changedProps.skyRadius && (state.controls.maxDistance = Math.min(state.controls.maxDistance, state.skyRadius));
47181
47439
  state.camera.far = state.skyRadius * 2.5;
47182
47440
  state.camera.updateProjectionMatrix();
47183
- state.skysphere.geometry = new three.SphereGeometry(state.skyRadius);
47441
+ state.skysphere.geometry = new three$1.SphereGeometry(state.skyRadius);
47184
47442
  }
47185
47443
  if (changedProps.hasOwnProperty('backgroundColor')) {
47186
47444
  var alpha = parseToRgb(state.backgroundColor).alpha;
47187
47445
  if (alpha === undefined) alpha = 1;
47188
- state.renderer.setClearColor(new three.Color(curriedOpacify$1(1, state.backgroundColor)), alpha);
47446
+ state.renderer.setClearColor(new three$1.Color(curriedOpacify$1(1, state.backgroundColor)), alpha);
47189
47447
  }
47190
47448
  if (changedProps.hasOwnProperty('backgroundImageUrl')) {
47191
47449
  if (!state.backgroundImageUrl) {
@@ -47193,11 +47451,11 @@ function InsertStackElement(node, body) {
47193
47451
  state.skysphere.material.map = null;
47194
47452
  !state.loadComplete && finishLoad();
47195
47453
  } else {
47196
- new three.TextureLoader().load(state.backgroundImageUrl, function (texture) {
47197
- texture.colorSpace = three.SRGBColorSpace;
47198
- state.skysphere.material = new three.MeshBasicMaterial({
47454
+ new three$1.TextureLoader().load(state.backgroundImageUrl, function (texture) {
47455
+ texture.colorSpace = three$1.SRGBColorSpace;
47456
+ state.skysphere.material = new three$1.MeshBasicMaterial({
47199
47457
  map: texture,
47200
- side: three.BackSide
47458
+ side: three$1.BackSide
47201
47459
  });
47202
47460
  state.skysphere.visible = true;
47203
47461
 
@@ -47254,6 +47512,13 @@ function InsertStackElement(node, body) {
47254
47512
  };
47255
47513
  }
47256
47514
 
47515
+ var three = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
47516
+ : {
47517
+ AmbientLight: AmbientLight,
47518
+ DirectionalLight: DirectionalLight,
47519
+ Vector3: Vector3
47520
+ };
47521
+
47257
47522
  //
47258
47523
 
47259
47524
  var CAMERA_DISTANCE2NODES_FACTOR = 170;
@@ -47590,7 +47855,7 @@ function InsertStackElement(node, body) {
47590
47855
  state.renderObjs.renderer().useLegacyLights = false; // force behavior for three < 155
47591
47856
  state.renderObjs.objects([
47592
47857
  // Populate scene
47593
- new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI), state.forceGraph]).hoverOrderComparator(function (a, b) {
47858
+ new three.AmbientLight(0xcccccc, Math.PI), new three.DirectionalLight(0xffffff, 0.6 * Math.PI), state.forceGraph]).hoverOrderComparator(function (a, b) {
47594
47859
  // Prioritize graph objects
47595
47860
  var aObj = getGraphObj(a);
47596
47861
  if (!aObj) return 1;