MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / comparePosition

Function comparePosition

packages/designer/src/document/node/node.ts:1454–1479  ·  view source on GitHub ↗
(node1: INode, node2: INode)

Source from the content-addressed store, hash-verified

1452 TheSame = 0,
1453}
1454export function comparePosition(node1: INode, node2: INode): PositionNO {
1455 if (node1 === node2) {
1456 return PositionNO.TheSame;
1457 }
1458 const l1 = node1.zLevel;
1459 const l2 = node2.zLevel;
1460 if (l1 === l2) {
1461 return PositionNO.BeforeOrAfter;
1462 }
1463
1464 let p: any;
1465 if (l1 < l2) {
1466 p = getZLevelTop(node2, l1);
1467 if (p && p === node1) {
1468 return PositionNO.Contains;
1469 }
1470 return PositionNO.BeforeOrAfter;
1471 }
1472
1473 p = getZLevelTop(node1, l2);
1474 if (p && p === node2) {
1475 return PositionNO.ContainedBy;
1476 }
1477
1478 return PositionNO.BeforeOrAfter;
1479}
1480
1481export function insertChild(
1482 container: INode,

Callers 3

getTopNodesMethod · 0.90
node.test.tsFile · 0.90
comparePositionMethod · 0.85

Calls 1

getZLevelTopFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…