nodelayout
Advanced tools
Comparing version 1.3.0 to 1.3.2
{ | ||
"name": "nodelayout", | ||
"version": "1.3.0", | ||
"version": "1.3.2", | ||
"description": "For node Layout.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -24,3 +24,4 @@ # nodeLayout | ||
```js | ||
nodeLayout.init({ | ||
import * as nodelayout from "nodelayout"; | ||
nodelayout.init({ | ||
id: "node-wrap", | ||
@@ -72,3 +73,3 @@ connectType: "line", // path or line | ||
```js | ||
nodeLayout.add({ | ||
nodelayout.add({ | ||
title: 'step', | ||
@@ -75,0 +76,0 @@ id: Math.random() + '' |
@@ -46,5 +46,14 @@ import * as d3 from "d3"; | ||
d3.selectAll(".unit-dis").attr("class", "unit-dis"); | ||
d3.selectAll('.connect-fixed-line').attr('data-selected', '') | ||
d3.select(this).attr("class", "unit-dis selected"); | ||
} | ||
// on path click | ||
function handlePathClick (event, d) { | ||
d3.selectAll(".unit-dis").attr("class", "unit-dis"); | ||
d3.selectAll('.connect-fixed-line').attr('data-selected', '') | ||
d3.select(this).attr("data-selected", true); | ||
if (onPathClick) onPathClick(d); | ||
} | ||
// drag start | ||
@@ -113,5 +122,3 @@ function dragstart (event, d) { | ||
.attr("data-id", d => d.id) | ||
.on("click", (event, d) => { | ||
if (onPathClick) onPathClick(d); | ||
}); | ||
.on("click", handlePathClick); | ||
if (isInit) { | ||
@@ -323,4 +330,4 @@ allPath.transition() | ||
text: item.title, | ||
x: 100 * index + 200, | ||
y: svgHeight/5 | ||
x: item.x || 100 * index + 200, | ||
y: item.y || svgHeight/5 | ||
}; | ||
@@ -342,6 +349,6 @@ }); | ||
endIndex: endIndex, | ||
x1: nodeData[0].x + Math.cos(Math.PI / 180 * startIndex * 90) * mainCirceRadius, | ||
y1: nodeData[0].y + Math.sin(Math.PI / 180 * startIndex * 90) * mainCirceRadius, | ||
x2: nodeData[index + 1].x + Math.cos(Math.PI / 180 * endIndex * 90) * mainCirceRadius, | ||
y2: nodeData[index + 1].y + Math.sin(Math.PI / 180 * endIndex * 90) * mainCirceRadius | ||
x1: item.x1 || nodeData[0].x + Math.cos(Math.PI / 180 * startIndex * 90) * mainCirceRadius, | ||
y1: item.y1 || nodeData[0].y + Math.sin(Math.PI / 180 * startIndex * 90) * mainCirceRadius, | ||
x2: item.x2 || nodeData[index + 1].x + Math.cos(Math.PI / 180 * endIndex * 90) * mainCirceRadius, | ||
y2: item.y2 || nodeData[index + 1].y + Math.sin(Math.PI / 180 * endIndex * 90) * mainCirceRadius | ||
}); | ||
@@ -348,0 +355,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
136873
566
76