Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layout-base

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layout-base - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

src/util/Matrix.js

2

index.js

@@ -33,2 +33,4 @@ 'use strict';

layoutBase.NeedlemanWunsch = require('./src/util/alignment/NeedlemanWunsch');
layoutBase.Matrix = require('./src/util/Matrix');
layoutBase.SVD = require('./src/util/SVD');

@@ -35,0 +37,0 @@ module.exports = layoutBase;

2

package.json
{
"name": "layout-base",
"version": "1.0.2",
"version": "2.0.0",
"description": "Basic layout model and some utilities for Cytoscape.js layout extensions",

@@ -5,0 +5,0 @@ "main": "layout-base.js",

@@ -11,5 +11,2 @@ var Layout = require('../Layout');

this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;

@@ -46,2 +43,3 @@ this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;

var edge;
var originalIdealLength;
var lcaDepth;

@@ -57,5 +55,5 @@ var source;

edge = allEdges[i];
originalIdealLength = edge.idealLength;
edge.idealLength = this.idealEdgeLength;
if (edge.isInterGraph)

@@ -77,3 +75,3 @@ {

edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH *
edge.idealLength += originalIdealLength *
FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR *

@@ -110,6 +108,7 @@ (source.getInclusionTreeDepth() +

Math.max(this.getAllNodes().length * 5, this.maxIterations);
// Reassign this attribute by using new constant value
this.displacementThresholdPerNode = (3.0 * FDLayoutConstants.DEFAULT_EDGE_LENGTH) / 100;
this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length;
this.totalDisplacementThreshold =
this.displacementThresholdPerNode * this.getAllNodes().length;
this.repulsionRange = this.calcRepulsionRange();

@@ -228,3 +227,3 @@ };

// Calculate spring forces
springForce = this.springConstant * (length - idealLength);
springForce = edge.edgeElasticity * (length - idealLength);

@@ -307,5 +306,6 @@ // Project force onto x and y axes

distance = Math.sqrt(distanceSquared);
// Here we use half of the nodes' repulsion values for backward compatibility
repulsionForce = (nodeA.nodeRepulsion / 2 + nodeB.nodeRepulsion / 2) * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared;
repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared;
// Project force onto x and y axes

@@ -312,0 +312,0 @@ repulsionForceX = repulsionForce * distanceX / distance;

@@ -6,3 +6,6 @@ var LEdge = require('../LEdge');

LEdge.call(this, source, target, vEdge);
// Ideal length and elasticity value for this edge
this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
this.edgeElasticity = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
}

@@ -9,0 +12,0 @@

var LNode = require('../LNode');
var FDLayoutConstants = require('./FDLayoutConstants');

@@ -6,2 +7,6 @@ function FDLayoutNode(gm, loc, size, vNode) {

LNode.call(this, gm, loc, size, vNode);
// Repulsion value of this node
this.nodeRepulsion = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
//Spring, repulsion and gravitational forces acting on this node

@@ -8,0 +13,0 @@ this.springForceX = 0;

@@ -319,15 +319,28 @@ var LGraphObject = require('./LGraphObject');

if(this.labelWidth > width){
this.rect.x -= (this.labelWidth - width) / 2;
this.setWidth(this.labelWidth);
if(this.labelWidth){
if(this.labelPosHorizontal == "left"){
this.rect.x -= (this.labelWidth);
this.setWidth(width + this.labelWidth);
}
else if(this.labelPosHorizontal == "center" && this.labelWidth > width){
this.rect.x -= (this.labelWidth - width) / 2;
this.setWidth(this.labelWidth);
}
else if(this.labelPosHorizontal == "right"){
this.setWidth(width + this.labelWidth);
}
}
if(this.labelHeight > height){
if(this.labelPos == "center"){
if(this.labelHeight){
if(this.labelPosVertical == "top"){
this.rect.y -= (this.labelHeight);
this.setHeight(height + this.labelHeight);
}
else if(this.labelPosVertical == "center" && this.labelHeight > height){
this.rect.y -= (this.labelHeight - height) / 2;
this.setHeight(this.labelHeight);
}
else if(this.labelPos == "top"){
this.rect.y -= (this.labelHeight - height);
else if(this.labelPosVertical == "bottom"){
this.setHeight(height + this.labelHeight);
}
this.setHeight(this.labelHeight);
}

@@ -334,0 +347,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc