Skip to content

Commit 834c3e7

Browse files
committed
chore: remove else block
1 parent 4c026eb commit 834c3e7

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

src/visualBuilder/utils/getChildrenDirection.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,23 @@ export default function getChildrenDirection(
3030

3131
if (directionFromParentElement && isValidParentDirection) {
3232
return directionFromParentElement as ValidPositions;
33-
} else {
34-
const [firstChildElement, secondChildElement, removeClone] =
35-
getChildElements(parentElement, parentCslpValue);
33+
}
34+
const [firstChildElement, secondChildElement, removeClone] =
35+
getChildElements(parentElement, parentCslpValue);
3636

37-
if (!firstChildElement) return "none";
37+
if (!firstChildElement) return "none";
3838

39-
// get horizontal and vertical position differences
40-
const firstChildBounds = firstChildElement.getBoundingClientRect();
41-
const secondChildBounds = secondChildElement.getBoundingClientRect();
39+
// get horizontal and vertical position differences
40+
const firstChildBounds = firstChildElement.getBoundingClientRect();
41+
const secondChildBounds = secondChildElement.getBoundingClientRect();
4242

43-
const deltaX = Math.abs(firstChildBounds.left - secondChildBounds.left);
44-
const deltaY = Math.abs(firstChildBounds.top - secondChildBounds.top);
43+
const deltaX = Math.abs(firstChildBounds.left - secondChildBounds.left);
44+
const deltaY = Math.abs(firstChildBounds.top - secondChildBounds.top);
4545

46-
const dir = deltaX > deltaY ? "horizontal" : "vertical";
46+
const dir = deltaX > deltaY ? "horizontal" : "vertical";
4747

48-
// remove the clone that was created in case there was only one child
49-
removeClone();
48+
// remove the clone that was created in case there was only one child
49+
removeClone();
5050

51-
return dir;
52-
}
51+
return dir;
5352
}

0 commit comments

Comments
 (0)