Skip to content

Commit

Permalink
fix(cloneCSSStyle): rounded values of d attr fix (#358)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AndrewN93 committed Jan 30, 2023
1 parent f7c311b commit 6d28bdb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/clone-node.ts
Expand Up @@ -114,6 +114,9 @@ function cloneCSSStyle<T extends HTMLElement>(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,
Expand Down

0 comments on commit 6d28bdb

Please sign in to comment.