From 05953d6c2ec196003f7cacc1ce6026f5687dc6da Mon Sep 17 00:00:00 2001 From: Wouter van der Wal <33957974+wjtje@users.noreply.github.com> Date: Fri, 10 Sep 2021 17:56:52 +0200 Subject: [PATCH] [fix] wrong len in draw transition with stroke-linecap (#6195) --- src/runtime/transition/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index dc398348b4..fc42ee2dcf 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -178,7 +178,10 @@ export function draw(node: SVGElement & { getTotalLength(): number }, { duration, easing = cubicInOut }: DrawParams = {}): TransitionConfig { - const len = node.getTotalLength(); + let len = node.getTotalLength(); + if (getComputedStyle(node).strokeLinecap !== 'butt') { + len += parseInt(getComputedStyle(node).strokeWidth); + } if (duration === undefined) { if (speed === undefined) {