[fix] (perf) deduplicate getComputedStyle call (#6721)

pull/7738/head
Simon H 5 years ago committed by GitHub
parent b83fb3c27a
commit 9c742678db

@ -179,8 +179,9 @@ export function draw(node: SVGElement & { getTotalLength(): number }, {
easing = cubicInOut easing = cubicInOut
}: DrawParams = {}): TransitionConfig { }: DrawParams = {}): TransitionConfig {
let len = node.getTotalLength(); let len = node.getTotalLength();
if (getComputedStyle(node).strokeLinecap !== 'butt') { const style = getComputedStyle(node);
len += parseInt(getComputedStyle(node).strokeWidth); if (style.strokeLinecap !== 'butt') {
len += parseInt(style.strokeWidth);
} }
if (duration === undefined) { if (duration === undefined) {

Loading…
Cancel
Save