mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 00:09:51 +02:00
chore: resolve eslint warnings in packages/mermaid-layout-elk/src/render.ts
This commit is contained in:
@@ -190,9 +190,7 @@ export const render = async (
|
|||||||
const children = nodeArr.filter((node: { parentId: any }) => node.parentId === subgraph.id);
|
const children = nodeArr.filter((node: { parentId: any }) => node.parentId === subgraph.id);
|
||||||
children.forEach((node: any) => {
|
children.forEach((node: any) => {
|
||||||
parentLookupDb.parentById[node.id] = subgraph.id;
|
parentLookupDb.parentById[node.id] = subgraph.id;
|
||||||
if (parentLookupDb.childrenById[subgraph.id] === undefined) {
|
parentLookupDb.childrenById[subgraph.id] ??= [];
|
||||||
parentLookupDb.childrenById[subgraph.id] = [];
|
|
||||||
}
|
|
||||||
parentLookupDb.childrenById[subgraph.id].push(node);
|
parentLookupDb.childrenById[subgraph.id].push(node);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -381,10 +379,10 @@ export const render = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
edgeData.labelType = edge.labelType;
|
edgeData.labelType = edge.labelType;
|
||||||
edgeData.label = (edge?.text || '').replace(common.lineBreakRegex, '\n');
|
edgeData.label = (edge?.text ?? '').replace(common.lineBreakRegex, '\n');
|
||||||
|
|
||||||
if (edge.style === undefined) {
|
if (edge.style === undefined) {
|
||||||
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
edgeData.style = edgeData.style ?? 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
||||||
@@ -725,9 +723,7 @@ export const render = async (
|
|||||||
inter = inter2;
|
inter = inter2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!inter) {
|
inter ??= intersection(bounds, lastPointOutside, point);
|
||||||
inter = intersection(bounds, lastPointOutside, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check case where the intersection is the same as the last point
|
// Check case where the intersection is the same as the last point
|
||||||
let pointPresent = false;
|
let pointPresent = false;
|
||||||
@@ -840,8 +836,8 @@ export const render = async (
|
|||||||
node.labels = [
|
node.labels = [
|
||||||
{
|
{
|
||||||
text: node.label,
|
text: node.label,
|
||||||
width: node?.labelData?.width || 50,
|
width: node?.labelData?.width ?? 50,
|
||||||
height: node?.labelData?.height || 50,
|
height: node?.labelData?.height ?? 50,
|
||||||
},
|
},
|
||||||
(node.width = node.width + 2 * node.padding),
|
(node.width = node.width + 2 * node.padding),
|
||||||
log.debug('UIO node label', node?.labelData?.width, node.padding),
|
log.debug('UIO node label', node?.labelData?.width, node.padding),
|
||||||
@@ -917,7 +913,7 @@ export const render = async (
|
|||||||
if (edge.sections) {
|
if (edge.sections) {
|
||||||
const src = edge.sections[0].startPoint;
|
const src = edge.sections[0].startPoint;
|
||||||
const dest = edge.sections[0].endPoint;
|
const dest = edge.sections[0].endPoint;
|
||||||
const segments = edge.sections[0].bendPoints ? edge.sections[0].bendPoints : [];
|
const segments = edge.sections[0].bendPoints ?? [];
|
||||||
|
|
||||||
const segPoints = segments.map((segment: { x: any; y: any }) => {
|
const segPoints = segments.map((segment: { x: any; y: any }) => {
|
||||||
return { x: segment.x + offset.x, y: segment.y + offset.y };
|
return { x: segment.x + offset.x, y: segment.y + offset.y };
|
||||||
|
Reference in New Issue
Block a user