fix flowchart edges

This commit is contained in:
Ashish Jain
2024-07-08 14:04:59 +02:00
parent e63b5a7de2
commit fe22a5f7b3
4 changed files with 4 additions and 5 deletions

View File

@@ -730,7 +730,7 @@ export const destructLink = (_str: string, _startStr: string) => {
// Todo optimizer this by caching existing nodes // Todo optimizer this by caching existing nodes
const exists = (allSgs: FlowSubGraph[], _id: string) => { const exists = (allSgs: FlowSubGraph[], _id: string) => {
for (const sg of allSgs) { for (const sg of allSgs) {
if (sg.nodes.indexOf(_id) >= 0) { if (sg.nodes.includes(_id)) {
return true; return true;
} }
} }
@@ -890,7 +890,7 @@ export const getData = () => {
styles.push(...rawEdge.style); styles.push(...rawEdge.style);
} }
const edge: Edge = { const edge: Edge = {
id: getEdgeId(rawEdge.start, rawEdge.end, { counter: index, prefix: 'edge' }), id: getEdgeId(rawEdge.start, rawEdge.end, { counter: index, prefix: 'L' }),
start: rawEdge.start, start: rawEdge.start,
end: rawEdge.end, end: rawEdge.end,
type: rawEdge.type ?? 'normal', type: rawEdge.type ?? 'normal',

View File

@@ -17,7 +17,6 @@ export const diagram = {
} }
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } }); setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
flowRendererV3.setConf(cnf.flowchart);
flowDb.clear(); flowDb.clear();
flowDb.setGen('gen-2'); flowDb.setGen('gen-2');
}, },

View File

@@ -19,7 +19,7 @@ export const getClasses = function (
export const draw = async function (text: string, id: string, _version: string, diag: any) { export const draw = async function (text: string, id: string, _version: string, diag: any) {
log.info('REF0:'); log.info('REF0:');
log.info('Drawing state diagram (v2)', id); log.info('Drawing state diagram (v2)', id);
const { securityLevel, state: conf, layout } = getConfig(); const { securityLevel, flowchart: conf, layout } = getConfig();
// Handle root and document for when rendering in sandbox mode // Handle root and document for when rendering in sandbox mode
let sandboxElement; let sandboxElement;

View File

@@ -16,7 +16,7 @@ import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
* @param defaultDir - the direction to use if none is found * @param defaultDir - the direction to use if none is found
* @returns The direction to use * @returns The direction to use
*/ */
const getDir = (parsedItem: any, defaultDir = DEFAULT_NESTED_DOC_DIR) => { export const getDir = (parsedItem: any, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
if (!parsedItem.doc) { if (!parsedItem.doc) {
return defaultDir; return defaultDir;
} }