Skip to content

Commit f2c16d0

Browse files
authored
Merge pull request #17 from oslabs-beta/jon-nestedCanvasMove
Nested elements on cavas can now be dragged anywhere except into their own children
2 parents 7b365e7 + ec67b8f commit f2c16d0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/src/components/main/SeparatorChild.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '../../redux/reducers/slice/appStateSlice';
1717
import { emitEvent } from '../../helperFunctions/socket';
1818

19-
function DirectChildHTMLNestable({
19+
function SeparatorChild({
2020
childId,
2121
type,
2222
typeId,
@@ -165,4 +165,4 @@ function DirectChildHTMLNestable({
165165
);
166166
}
167167

168-
export default DirectChildHTMLNestable;
168+
export default SeparatorChild;

app/src/helperFunctions/changePositionValidation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const validateNewParent = (
1818
nestedParent = false
1919
): boolean => {
2020
for (const element of array) {
21-
if (element.childId === toTargetParentId && nestedChild === true)
21+
if (
22+
element.childId === toTargetParentId &&
23+
nestedChild === true &&
24+
element.typeId > 1000 // check if not a separator (1000) or previously dragged component (> 1000)
25+
)
2226
return (nestedParent = true);
2327
else if (
2428
element.childId === currentChildId &&

0 commit comments

Comments
 (0)