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

pull/6722/head
Simon H 3 years ago committed by GitHub
parent e34195d60d
commit c040f130b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save