Skip to content

Commit 78786a7

Browse files
committed
fix(flowchart): harden orthogonal edge rendering in web view
- ignore invalid `markerEnd` values such as `url('#')` to prevent broken SVG edge markers - cap chevron textPath glyph count to avoid oversized SVG text nodes on long routes - improve stability/performance of flow edge animation rendering
1 parent b77b36c commit 78786a7

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/components/FlowchartOrthogonalEdge.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ const edgeLength = computed(() => {
8080
const chevronText = computed(() => {
8181
// Keep visual density unchanged; only increase total length coverage.
8282
const approxGlyphAdvancePx = 7
83-
const count = Math.max(14, Math.min(5000, Math.ceil((edgeLength.value + 96) / approxGlyphAdvancePx)))
83+
// Guard against huge SVG text nodes on very long paths (web browsers may render poorly).
84+
const count = Math.max(14, Math.min(420, Math.ceil((edgeLength.value + 96) / approxGlyphAdvancePx)))
8485
return '>'.repeat(count)
8586
})
8687
@@ -103,6 +104,17 @@ const chevronStroke = computed(() => {
103104
if (typeof raw === 'string' && raw.trim()) return raw
104105
return '#18a058'
105106
})
107+
108+
const normalizedMarkerEnd = computed(() => {
109+
const raw = props.markerEnd
110+
if (typeof raw !== 'string') return undefined
111+
const value = raw.trim()
112+
if (!value) return undefined
113+
if (value === '#' || value === 'url(#)' || value === "url('#')" || value === 'url("#")') {
114+
return undefined
115+
}
116+
return value
117+
})
106118
</script>
107119

108120
<template>
@@ -112,7 +124,7 @@ const chevronStroke = computed(() => {
112124
:id="id"
113125
:path="path"
114126
:style="style"
115-
:marker-end="markerEnd"
127+
:marker-end="normalizedMarkerEnd"
116128
/>
117129
<text
118130
v-if="flowMode === 'chevron'"
@@ -146,4 +158,4 @@ const chevronStroke = computed(() => {
146158
pointer-events: none;
147159
user-select: none;
148160
}
149-
</style>
161+
</style>

0 commit comments

Comments
 (0)