Fixed: Inserting properties to the tree now animate correctly to the inserted property

This commit is contained in:
Stefan Zermatten
2021-02-20 16:00:40 +02:00
parent 33415275a3
commit f3e191c12e
2 changed files with 5 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ const insertProperty = new ValidatedMethod({
run({creatureProperty}) { run({creatureProperty}) {
let rootCreature = getRootCreatureAncestor(creatureProperty); let rootCreature = getRootCreatureAncestor(creatureProperty);
assertEditPermission(rootCreature, this.userId); assertEditPermission(rootCreature, this.userId);
insertPropertyWork({ return insertPropertyWork({
property: creatureProperty, property: creatureProperty,
creature: rootCreature, creature: rootCreature,
}); });

View File

@@ -205,8 +205,8 @@
creatureProperty.parent = {collection: 'creatures', id: that.creatureId}; creatureProperty.parent = {collection: 'creatures', id: that.creatureId};
creatureProperty.ancestors = [ {collection: 'creatures', id: that.creatureId}]; creatureProperty.ancestors = [ {collection: 'creatures', id: that.creatureId}];
setDocToLastOrder({collection: CreatureProperties, doc: creatureProperty}); setDocToLastOrder({collection: CreatureProperties, doc: creatureProperty});
let creaturePropertyId = insertProperty.call({creatureProperty}); let id = insertProperty.call({creatureProperty});
return creaturePropertyId; return `tree-node-${id}`;
} }
}); });
}, },
@@ -217,10 +217,11 @@
elementId: 'insert-creature-property-fab', elementId: 'insert-creature-property-fab',
callback(libraryNode){ callback(libraryNode){
if (!libraryNode) return; if (!libraryNode) return;
insertPropertyFromLibraryNode.call({ let id = insertPropertyFromLibraryNode.call({
nodeId: libraryNode._id, nodeId: libraryNode._id,
parentRef: {collection: 'creatures', id: that.creatureId}, parentRef: {collection: 'creatures', id: that.creatureId},
}); });
return `tree-node-${id}`;
} }
}); });
}, },