Skip to content

Commit

Permalink
refactor(nodes-z): groups start with z=2
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Nov 9, 2021
1 parent 8a2ac1e commit f0e79c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-flow-renderer",
"version": "10.0.0-next.13",
"version": "10.0.0-next.14",
"engines": {
"node": ">=12"
},
Expand Down
5 changes: 3 additions & 2 deletions src/store/utils.ts
Expand Up @@ -36,14 +36,15 @@ export function createNodeInternals(nodes: Node[], nodeInternals: NodeInternals)
const parentNodes: ParentNodes = {};

nodes.forEach((node) => {
const z = node.zIndex ? node.zIndex : node.dragging || node.selected ? 1000 : 0;
const internals: NodeInternalsItem = {
...nodeInternals.get(node.id),
id: node.id,
width: node.width || null,
height: node.height || null,
position: node.position,
positionAbsolute: node.position,
z: node.dragging || node.selected ? 1000 : node.zIndex || 0,
z,
};
if (node.parentNode) {
internals.parentNode = node.parentNode;
Expand All @@ -59,7 +60,7 @@ export function createNodeInternals(nodes: Node[], nodeInternals: NodeInternals)
let startingZ = updatedInternals.z || 0;

if (!startingZ) {
if (parentNodes[node.id] && node.parentNode) {
if (parentNodes[node.id]) {
startingZ = 2;
} else if (node.parentNode) {
startingZ = 1;
Expand Down

0 comments on commit f0e79c6

Please sign in to comment.