|
|
@@ -193,13 +193,15 @@ class Timeline extends LitElement {
|
|
|
r.parent = this.getRessourceFromId(r.parent.id) ?? this.addRessource(r.parent);
|
|
|
const idx = this.rows.indexOf(r.parent as Ressource);
|
|
|
if (idx > -1) {
|
|
|
- r.parent.children = [r, ...r.parent.children];
|
|
|
if (pos <= idx) {
|
|
|
this.rows.splice(idx + 1, 0, r);
|
|
|
+ r.parent.children = [r, ...r.parent.children];
|
|
|
} else if (pos < idx + r.parent.children.length) {
|
|
|
this.rows.splice(pos, 0, r);
|
|
|
+ r.parent.children.splice(pos - idx, 0, r);
|
|
|
} else {
|
|
|
this.rows.splice(idx + r.parent.children.length, 0, r);
|
|
|
+ r.parent.children = [...r.parent.children, r];
|
|
|
}
|
|
|
} else {
|
|
|
throw new Error("Not able to create ressource parent.\n" + r.id);
|