@ -38,7 +38,7 @@ class LayoutEngine {
if ( this . options . hierarchical . enabled === true ) {
// make sure the level seperation is the right way up
if ( this . options . hierarchical . direction == "RL" || this . options . hierarchical . direction == "DU" ) {
if ( this . options . hierarchical . direction === "RL" || this . options . hierarchical . direction = == "DU" ) {
if ( this . options . hierarchical . levelSeparation > 0 ) {
this . options . hierarchical . levelSeparation *= - 1 ;
}
@ -68,7 +68,7 @@ class LayoutEngine {
// get the type of static smooth curve in case it is required
let type = 'horizontal' ;
if ( this . options . hierarchical . direction == "RL" || this . options . hierarchical . direction == "LR" ) {
if ( this . options . hierarchical . direction === "RL" || this . options . hierarchical . direction = == "LR" ) {
type = 'vertical' ;
}
@ -102,10 +102,10 @@ class LayoutEngine {
let radius = 10 * 0.1 * nodesArray . length + 10 ;
let angle = 2 * Math . PI * this . seededRandom ( ) ;
if ( node . options . fixed . x == false ) {
if ( node . options . fixed . x === false ) {
node . x = radius * Math . cos ( angle ) ;
}
if ( node . options . fixed . x == false ) {
if ( node . options . fixed . x === false ) {
node . y = radius * Math . sin ( angle ) ;
}
}
@ -124,7 +124,7 @@ class LayoutEngine {
* @ private
* /
setupHierarchicalLayout ( ) {
if ( this . options . hierarchical . enabled == true && this . body . nodeIndices . length > 0 ) {
if ( this . options . hierarchical . enabled === true && this . body . nodeIndices . length > 0 ) {
// get the size of the largest hubs and check if the user has defined a level for a node.
let node , nodeId ;
let definedLevel = false ;
@ -146,7 +146,7 @@ class LayoutEngine {
}
// if the user defined some levels but not all, alert and run without hierarchical layout
if ( undefinedLevel == true && definedLevel == true ) {
if ( undefinedLevel === true && definedLevel = == true ) {
throw new Error ( "To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes." ) ;
return ;
}
@ -155,11 +155,11 @@ class LayoutEngine {
//this._changeConstants();
// define levels if undefined by the users. Based on hubsize
if ( undefinedLevel == true ) {
if ( this . options . hierarchical . sortMethod == "hubsize" ) {
if ( undefinedLevel === true ) {
if ( this . options . hierarchical . sortMethod === "hubsize" ) {
this . _determineLevelsByHubsize ( ) ;
}
else if ( this . options . hierarchical . sortMethod == "directed" || "direction" ) {
else if ( this . options . hierarchical . sortMethod === "directed" || "direction" ) {
this . _determineLevelsDirected ( ) ;
}
}
@ -189,7 +189,7 @@ class LayoutEngine {
if ( distribution [ level ] . nodes . hasOwnProperty ( nodeId ) ) {
node = distribution [ level ] . nodes [ nodeId ] ;
if ( this . options . hierarchical . direction == "UD" || this . options . hierarchical . direction == "DU" ) {
if ( this . options . hierarchical . direction === "UD" || this . options . hierarchical . direction = == "DU" ) {
if ( node . x === undefined ) { node . x = distribution [ level ] . distance ; }
distribution [ level ] . distance = node . x + this . nodeSpacing ;
}
@ -222,7 +222,7 @@ class LayoutEngine {
for ( nodeId in this . body . nodes ) {
if ( this . body . nodes . hasOwnProperty ( nodeId ) ) {
node = this . body . nodes [ nodeId ] ;
if ( this . options . hierarchical . direction == "UD" || this . options . hierarchical . direction == "DU" ) {
if ( this . options . hierarchical . direction === "UD" || this . options . hierarchical . direction = == "DU" ) {
node . y = this . options . hierarchical . levelSeparation * this . hierarchicalLevels [ nodeId ] ;
node . options . fixed . y = true ;
}
@ -274,13 +274,13 @@ class LayoutEngine {
while ( hubSize > 0 ) {
// determine hubs
hubSize = this . _getHubSize ( ) ;
if ( hubSize == 0 )
if ( hubSize === 0 )
break ;
for ( nodeId in this . body . nodes ) {
if ( this . body . nodes . hasOwnProperty ( nodeId ) ) {
node = this . body . nodes [ nodeId ] ;
if ( node . edges . length == hubSize ) {
if ( node . edges . length === hubSize ) {
this . _setLevel ( 0 , node ) ;
}
}
@ -304,7 +304,7 @@ class LayoutEngine {
let childNode ;
this . hierarchicalLevels [ node . id ] = level ;
for ( let i = 0 ; i < node . edges . length ; i ++ ) {
if ( node . edges [ i ] . toId == node . id ) {
if ( node . edges [ i ] . toId === node . id ) {
childNode = node . edges [ i ] . from ;
}
else {
@ -366,7 +366,7 @@ class LayoutEngine {
this . hierarchicalLevels [ node . id ] = level ;
for ( let i = 0 ; i < node . edges . length ; i ++ ) {
if ( node . edges [ i ] . toId == node . id ) {
if ( node . edges [ i ] . toId === node . id ) {
childNode = node . edges [ i ] . from ;
this . _setLevelDirected ( level - 1 , childNode ) ;
}
@ -393,7 +393,7 @@ class LayoutEngine {
for ( let i = 0 ; i < edges . length ; i ++ ) {
let childNode = undefined ;
let parentNode = undefined ;
if ( edges [ i ] . toId == parentId ) {
if ( edges [ i ] . toId === parentId ) {
childNode = edges [ i ] . from ;
parentNode = edges [ i ] . to ;
}
@ -405,7 +405,7 @@ class LayoutEngine {
if ( this . positionedNodes [ childNode . id ] === undefined ) {
// if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here.
if ( childNodeLevel > parentLevel ) {
if ( this . options . hierarchical . direction == "UD" || this . options . hierarchical . direction == "DU" ) {
if ( this . options . hierarchical . direction === "UD" || this . options . hierarchical . direction = == "DU" ) {
if ( childNode . x === undefined ) {
childNode . x = Math . max ( distribution [ childNodeLevel ] . distance , parentNode . x ) ;
}