fix:incorrect node name length calculation (#252)

This commit is contained in:
hadesy 2023-04-05 17:23:26 +08:00 committed by GitHub
parent 0e15c023cc
commit 8077043c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,7 @@ limitations under the License. -->
:y="n.y - 38" :y="n.y - 38"
:href="!n.type || n.type === `N/A` ? icons.UNDEFINED : icons[n.type.toUpperCase().replace('-', '')]" :href="!n.type || n.type === `N/A` ? icons.UNDEFINED : icons[n.type.toUpperCase().replace('-', '')]"
/> />
<text :x="n.x - (n.name.length * 6) / 2 + 6" :y="n.y + n.height + 8" style="pointer-events: none"> <text :x="n.x - (Math.min(n.name.length, 20) * 6) / 2 + 6" :y="n.y + n.height + 8" style="pointer-events: none">
{{ n.name.length > 20 ? `${n.name.substring(0, 20)}...` : n.name }} {{ n.name.length > 20 ? `${n.name.substring(0, 20)}...` : n.name }}
</text> </text>
</g> </g>