sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
19 lines • 1.12 kB
JavaScript
/*
Fired when a variable name got changed in the DraggableComponent
traverse through Sparnatural and change the var names in the StartGrp and EndGrp
*/
export default function updateVarName(actionStore, variableState, previousVarName) {
// traversePreOrder through components and calculate background / linkAndBottoms / for them
actionStore.sparnatural.BgWrapper.componentsList.rootGroupWrapper.traversePreOrder((grpWrapper) => {
let startGrp = grpWrapper.criteriaGroup.startClassGroup;
let endGrp = grpWrapper.criteriaGroup.endClassGroup;
if (startGrp.getVarName() === previousVarName.variable)
startGrp.setVarName(variableState.selectedVariable.variable);
if (endGrp.getVarName() === previousVarName.variable)
endGrp.setVarName(variableState.selectedVariable.variable);
});
//add variables list in actionstore
// actionStore.variables = actionStore.sparnatural.variableSection.listVariables();
actionStore.sparnatural.html[0].dispatchEvent(new CustomEvent("redrawBackgroundAndLinks"));
}
//# sourceMappingURL=UpdateVarName.js.map