From 0336a9d456495435d19f2f1d149854f7ecb2c8f2 Mon Sep 17 00:00:00 2001 From: Wouter van der Wal <33957974+wjtje@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:40:06 +0200 Subject: [PATCH] fix: wrong len in draw transition --- src/runtime/transition/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index 3a978a146a..f787121149 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -178,7 +178,9 @@ export function draw(node: SVGElement & { getTotalLength(): number }, { duration, easing = cubicInOut }: DrawParams = {}): TransitionConfig { - const len = node.getTotalLength(); + const has_end_caps = getComputedStyle(node).strokeLinecap !== 'butt'; + const cap_size = has_end_caps ? parseInt(getComputedStyle(node).strokeWidth) : 0; + const len = node.getTotalLength() + cap_size; if (duration === undefined) { if (speed === undefined) {