5237 Adjust classDef and note position data

This commit is contained in:
Ashish Jain
2024-06-03 14:16:35 +02:00
parent cca1c41749
commit 01297fa042
2 changed files with 17 additions and 5 deletions

View File

@@ -206,8 +206,20 @@ function getClassesFromDbInfo(dbInfoItem) {
if (dbInfoItem === undefined || dbInfoItem === null) { if (dbInfoItem === undefined || dbInfoItem === null) {
return ''; return '';
} else { } else {
if (dbInfoItem.cssClasses) { if (dbInfoItem.classes) {
return dbInfoItem.cssClasses.join(' '); let classStr = '';
// for each class in classes, add it to the string as comma separated
for (let i = 0; i < dbInfoItem.classes.length; i++) {
//do not add comma for the last class
if (i === dbInfoItem.classes.length - 1) {
classStr += dbInfoItem.classes[i];
}
//add comma for all other classes
else {
classStr += dbInfoItem.classes[i] + ',';
}
}
return classStr;
} else { } else {
return ''; return '';
} }
@@ -224,7 +236,7 @@ export const dataFetcher = (
look look
) => { ) => {
const itemId = parsedItem.id; const itemId = parsedItem.id;
const classStr = getClassesFromDbInfo(diagramStates[itemId]); const classStr = getClassesFromDbInfo(diagramStates.get(itemId));
if (itemId !== 'root') { if (itemId !== 'root') {
let shape = SHAPE_STATE; let shape = SHAPE_STATE;
@@ -344,6 +356,7 @@ export const dataFetcher = (
padding: 0, //getConfig().flowchart.padding padding: 0, //getConfig().flowchart.padding
useRough, useRough,
look, look,
position: parsedItem.note.position,
}; };
const groupData = { const groupData = {
labelStyle: '', labelStyle: '',
@@ -358,6 +371,7 @@ export const dataFetcher = (
padding: 16, //getConfig().flowchart.padding padding: 16, //getConfig().flowchart.padding
useRough, useRough,
look, look,
position: parsedItem.note.position,
}; };
graphItemCount++; graphItemCount++;

View File

@@ -586,8 +586,6 @@ export const getData = () => {
const look = config.look; const look = config.look;
resetDataFetching(); resetDataFetching();
dataFetcher(undefined, getRootDocV2(), diagramStates, nodes, edges, true, useRough, look); dataFetcher(undefined, getRootDocV2(), diagramStates, nodes, edges, true, useRough, look);
console.log('State Nodes XDX:', nodes);
return { nodes, edges, other: {}, config }; return { nodes, edges, other: {}, config };
}; };