cytoscape-cose-bilkent
Advanced tools
Comparing version 1.3.2 to 1.3.3
{ | ||
"name": "cytoscape-cose-bilkent", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "The CoSE layout for Cytoscape.js by Bilkent", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cose-bilkent.js", |
{ | ||
"name": "cytoscape-cose-bilkent", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "The CoSE layout for Cytoscape.js by Bilkent", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cose-bilkent.js", |
@@ -70,3 +70,3 @@ cytoscape-cose-bilkent | ||
// Gravity force (constant) | ||
gravity: 0.4, | ||
gravity: 0.25, | ||
// Maximum number of iterations to perform | ||
@@ -76,7 +76,7 @@ numIter: 2500, | ||
tile: true, | ||
//whether to make animation while performing the layout | ||
animate: true, | ||
//represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) | ||
// Type of layout animation. The option set is {'during', 'end', false} | ||
animate: 'end', | ||
// Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) | ||
tilingPaddingVertical: 10, | ||
//represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) | ||
// Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) | ||
tilingPaddingHorizontal: 10 | ||
@@ -83,0 +83,0 @@ }; |
@@ -141,3 +141,3 @@ var FDLayout = require('./FDLayout'); | ||
this.animate(); | ||
if (layoutOptionsPack.animate && this.totalIterations % animationPeriod == 0) { | ||
if (layoutOptionsPack.animate === 'during' && this.totalIterations % animationPeriod == 0) { | ||
for (var i = 0; i < 1e7; i++) { | ||
@@ -144,0 +144,0 @@ if ((new Date().getTime() - lastFrame) > 25) { |
@@ -32,3 +32,3 @@ var layoutOptionsPack = require('./layoutOptionsPack'); | ||
FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1.0; | ||
FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 2.35; | ||
FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8; | ||
FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5; | ||
@@ -35,0 +35,0 @@ FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true; |
@@ -119,3 +119,3 @@ 'use strict'; | ||
//whether to make animation while performing the layout | ||
animate: true, | ||
animate: 'end', | ||
//represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) | ||
@@ -426,3 +426,3 @@ tilingPaddingVertical: 10, | ||
after.options.eles.nodes().positions(function (i, ele) { | ||
var getPositions = function(i ,ele){ | ||
var theId = ele.data('id'); | ||
@@ -435,18 +435,25 @@ var lNode = _CoSELayout.idToLNode[theId]; | ||
}; | ||
}); | ||
}; | ||
if (after.options.fit) | ||
after.options.cy.fit(after.options.eles.nodes(), after.options.padding); | ||
//trigger layoutready when each node has had its position set at least once | ||
if (!ready) { | ||
after.cy.one('layoutready', after.options.ready); | ||
after.cy.trigger('layoutready'); | ||
if(after.options.animate !== 'during'){ | ||
after.options.eles.nodes().layoutPositions(after, after.options, getPositions); | ||
} | ||
// trigger layoutstop when the layout stops (e.g. finishes) | ||
after.cy.one('layoutstop', after.options.stop); | ||
after.cy.trigger('layoutstop'); | ||
else { | ||
after.options.eles.nodes().positions(getPositions); | ||
if (after.options.fit) | ||
after.options.cy.fit(after.options.eles.nodes(), after.options.padding); | ||
//trigger layoutready when each node has had its position set at least once | ||
if (!ready) { | ||
after.cy.one('layoutready', after.options.ready); | ||
after.cy.trigger('layoutready'); | ||
} | ||
// trigger layoutstop when the layout stops (e.g. finishes) | ||
after.cy.one('layoutstop', after.options.stop); | ||
after.cy.trigger('layoutstop'); | ||
} | ||
t1.stop(); | ||
after.options.eles.nodes().removeData('dummy_parent_id'); | ||
@@ -499,23 +506,20 @@ }); | ||
//Get the top most ones of a list of nodes in linear time | ||
//Get the top most ones of a list of nodes | ||
_CoSELayout.getTopMostNodes = function(nodes) { | ||
//Map the ids of nodes in the list to check if a node is in the list in constant time | ||
var nodeIdMap = {}; | ||
//Fill the map in linear time | ||
for(var i = 0; i < nodes.length; i++){ | ||
nodeIdMap[nodes[i].id()] = true; | ||
var nodesMap = {}; | ||
for (var i = 0; i < nodes.length; i++) { | ||
nodesMap[nodes[i].id()] = true; | ||
} | ||
//The nodes whose parent is not mapped are top most ones | ||
var topMostNodes = nodes.filter(function(i, ele){ | ||
if(nodeIdMap[ele.data('parent')]){ | ||
return false; | ||
} | ||
return true; | ||
var roots = nodes.filter(function (i, ele) { | ||
var parent = ele.parent()[0]; | ||
while(parent != null){ | ||
if(nodesMap[parent.id()]){ | ||
return false; | ||
} | ||
parent = parent.parent()[0]; | ||
} | ||
return true; | ||
}); | ||
//return the list of top most nodes | ||
return topMostNodes; | ||
return roots; | ||
}; | ||
@@ -771,8 +775,3 @@ | ||
var lnode = row[j]; | ||
var node = this.cy.getElementById(lnode.id); | ||
node.position({ | ||
x: x + lnode.rect.width / 2, | ||
y: y + lnode.rect.height / 2 | ||
}); | ||
@@ -779,0 +778,0 @@ lnode.rect.x = x;// + lnode.rect.width / 2; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
555885
10052
2