From 002b28148a4209fb04ccd82b05af8bedb2fd0467 Mon Sep 17 00:00:00 2001 From: AndrewN93 <31307316+AndrewN93@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:36:13 +0200 Subject: [PATCH] fix(cloneCSSStyle): rounded values of d attr fix (#358) There is a difference between values in actual d attribute of path and value that returns from window.getComputedStyles() object For some generated svg shapes at particular place is crutial to have exact values in order them to be displayed at all. Closes #357 --- src/clone-node.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/clone-node.ts b/src/clone-node.ts index 57e2106d..2989fbcf 100644 --- a/src/clone-node.ts +++ b/src/clone-node.ts @@ -114,6 +114,9 @@ function cloneCSSStyle(nativeNode: T, clonedNode: T) { Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1 value = `${reducedFont}px` } + if (name === 'd' && clonedNode.getAttribute('d')) { + value = `path(${clonedNode.getAttribute('d')})` + } targetStyle.setProperty( name, value,