Skip to content

Commit 6d28bdb

Browse files
authored
fix(cloneCSSStyle): rounded values of d attr fix (bubkoo#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 bubkoo#357
1 parent f7c311b commit 6d28bdb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/clone-node.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ function cloneCSSStyle<T extends HTMLElement>(nativeNode: T, clonedNode: T) {
114114
Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1
115115
value = `${reducedFont}px`
116116
}
117+
if (name === 'd' && clonedNode.getAttribute('d')) {
118+
value = `path(${clonedNode.getAttribute('d')})`
119+
}
117120
targetStyle.setProperty(
118121
name,
119122
value,

0 commit comments

Comments
 (0)