Merged PR 216: Deprecate parent from IContainerModel for FindContainerById
This commit is contained in:
parent
d40cd8cf8e
commit
b4eba6bb9b
19 changed files with 97 additions and 109 deletions
|
@ -87,8 +87,9 @@ function HandleOnDrop(
|
|||
return;
|
||||
}
|
||||
|
||||
if (targetContainer.parent === null ||
|
||||
targetContainer.parent === undefined) {
|
||||
const parent = FindContainerById(containers, targetContainer.properties.parentId);
|
||||
if (parent === null ||
|
||||
parent === undefined) {
|
||||
throw new Error('[handleDrop] Tried to drop into a child container without a parent!');
|
||||
}
|
||||
|
||||
|
@ -97,11 +98,11 @@ function HandleOnDrop(
|
|||
|
||||
// locate the hitboxes
|
||||
if (y < 12) {
|
||||
const index = targetContainer.parent.children.indexOf(targetContainer.properties.id);
|
||||
const index = parent.children.indexOf(targetContainer.properties.id);
|
||||
addContainer(
|
||||
index,
|
||||
type,
|
||||
targetContainer.parent.properties.id
|
||||
parent.properties.id
|
||||
);
|
||||
} else if (y < 24) {
|
||||
addContainer(
|
||||
|
@ -109,11 +110,11 @@ function HandleOnDrop(
|
|||
type,
|
||||
targetContainer.properties.id);
|
||||
} else {
|
||||
const index = targetContainer.parent.children.indexOf(targetContainer.properties.id);
|
||||
const index = parent.children.indexOf(targetContainer.properties.id);
|
||||
addContainer(
|
||||
index + 1,
|
||||
type,
|
||||
targetContainer.parent.properties.id
|
||||
parent.properties.id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue