Skip to content

Commit

Permalink
fix(cloneCSSStyle): rounded values of d attr fix (bubkoo#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 bubkoo#357
  • Loading branch information
AndrewN93 authored and istaiti committed Feb 7, 2023
1 parent 85aa4a8 commit 002b281
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/clone-node.ts
Original file line number Diff line number Diff line change
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 002b281

Please sign in to comment.