|
@@ -182,7 +182,7 @@ class Timeline extends LitElement {
|
|
|
* @param ressource
|
|
* @param ressource
|
|
|
* @returns The Ressource object registered to in the timeline
|
|
* @returns The Ressource object registered to in the timeline
|
|
|
*/
|
|
*/
|
|
|
- addRessource(ressource: IRessource, pos = 0): Ressource {
|
|
|
|
|
|
|
+ addRessource(ressource: IRessource, pos = Infinity): Ressource {
|
|
|
const existingRessource = this.getRessourceFromId(ressource.id);
|
|
const existingRessource = this.getRessourceFromId(ressource.id);
|
|
|
if (existingRessource) {
|
|
if (existingRessource) {
|
|
|
return existingRessource;
|
|
return existingRessource;
|
|
@@ -196,10 +196,10 @@ class Timeline extends LitElement {
|
|
|
r.parent.children = [r, ...r.parent.children];
|
|
r.parent.children = [r, ...r.parent.children];
|
|
|
if (pos <= idx) {
|
|
if (pos <= idx) {
|
|
|
this.rows.splice(idx + 1, 0, r);
|
|
this.rows.splice(idx + 1, 0, r);
|
|
|
- } else if (pos > idx + r.parent.children.length) {
|
|
|
|
|
- this.rows.splice(idx + r.parent.children.length, 0, r);
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (pos < idx + r.parent.children.length) {
|
|
|
this.rows.splice(pos, 0, r);
|
|
this.rows.splice(pos, 0, r);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.rows.splice(idx + r.parent.children.length, 0, r);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
throw new Error("Not able to create ressource parent.\n" + r.id);
|
|
throw new Error("Not able to create ressource parent.\n" + r.id);
|