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

nodelayout

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodelayout - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

2

package.json
{
"name": "nodelayout",
"version": "1.2.5",
"version": "1.2.6",
"description": "For node Layout.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -25,44 +25,45 @@ # nodeLayout

nodeLayout.init({
id: "node-wrap",
connectType: "line", // connectType: "path", // path or line
onNodeClick: function (d) {
console.log(d);
},
onPathClick: function (d) {
console.log(d);
},
list: [{
title: "step1",
id: 0
}, {
title: "step2",
id: 1
}, {
title: "step3",
id: 2
}, {
title: "step4",
id: 3
}, {
title: "step5",
id: 4
}, {
title: "step6",
id: 5
}, {
title: "step7",
id: 6
}],
nodes: [{
title: "step8",
id: 0
}, {
title: "step9",
id: 1
}],
lines: [{
source: 0,
target: 1
}]
})
id: "node-wrap",
connectType: "line", // path or line
nodeType: "rect", // rect or circle
onNodeClick: function (d) {
console.log(d);
},
onPathClick: function (d) {
console.log(d);
},
list: [{
title: "step1",
id: "0"
}, {
title: "step2",
id: "1"
}, {
title: "step3",
id: "2"
}, {
title: "step4",
id: "3"
}, {
title: "step5",
id: "4"
}, {
title: "step6",
id: "5"
}, {
title: "step7",
id: "6"
}],
nodes: [{
title: "step8",
id: "0"
}, {
title: "step9",
id: "1"
}],
lines: [{
source: "0",
target: "1"
}]
})
```

@@ -73,4 +74,4 @@ ### Add

title: 'step',
id: Math.random()
id: Math.random() + ''
});
```

@@ -15,3 +15,4 @@ import * as d3 from "d3";

});
});;
});
// circle radius

@@ -32,2 +33,4 @@ const mainCirceRadius = 25;

let connectType = "line";
// node type
let nodeType = "circle";

@@ -161,6 +164,5 @@ const connectData = deepProxy((data) => {

if (connectType === "path") {
console.log(d);
switch (d.index) {
case 0:
pos = `M${d.x1},${d.y1} C${d.x2},${d.y1} ${d.x1},${d.y2} ${d.x2},${d.y2}`;
pos = `M${d.x1},${d.y1} C${(d.x1 + d.x2)/2},${d.y1} ${(d.x2 + d.x1)/2},${d.y2} ${d.x2},${d.y2}`;
break;

@@ -171,3 +173,3 @@ case 1:

case 2:
pos = `M${d.x1},${d.y1} C${d.x2},${d.y1} ${d.x1},${d.y2} ${d.x2},${d.y2}`;
pos = `M${d.x1},${d.y1} C${(d.x2 + d.x1)/2},${d.y1} ${(d.x1 + d.x2)/2},${d.y2} ${d.x2},${d.y2}`;
break;

@@ -202,7 +204,20 @@ case 3:

// main circle
objectWrap.append("circle")
.attr("fill", "#fff")
.attr("class", "main-circle")
.attr("stroke", "#227AE6")
.attr("r", mainCirceRadius);
if (nodeType === "rect") {
objectWrap.append("rect")
.attr("fill", "#fff")
.attr("class", "main-circle")
.attr("stroke", "#227AE6")
.attr("x", -mainCirceRadius)
.attr("y", -mainCirceRadius)
.attr("rx", 5)
.attr("ry", 5)
.attr("height", mainCirceRadius * 2)
.attr("width", mainCirceRadius * 2);
} else {
objectWrap.append("circle")
.attr("fill", "#fff")
.attr("class", "main-circle")
.attr("stroke", "#227AE6")
.attr("r", mainCirceRadius);
}
// small circle

@@ -256,2 +271,3 @@ const smallCircelData = [{

connectType = params.connectType || "line"
nodeType = params.nodeType || "circle"
renderOptionList({

@@ -258,0 +274,0 @@ wrap,

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