File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,7 +238,10 @@ class SVGLoader extends Loader {
238238
239239 paths . push ( path ) ;
240240
241- path . userData = { node : node , style : style } ;
241+ const pathStyle = Object . assign ( { } , style ) ;
242+ pathStyle . strokeWidth = style . strokeWidth * getTransformScale ( currentTransform ) ;
243+
244+ path . userData = { node : node , style : pathStyle } ;
242245
243246 }
244247
@@ -1875,6 +1878,14 @@ class SVGLoader extends Loader {
18751878
18761879 }
18771880
1881+ function getTransformScale ( m ) {
1882+
1883+ const te = m . elements ;
1884+ const det = te [ 0 ] * te [ 4 ] - te [ 1 ] * te [ 3 ] ;
1885+ return Math . sqrt ( Math . abs ( det ) ) ;
1886+
1887+ }
1888+
18781889 // Calculates the eigensystem of a real symmetric 2x2 matrix
18791890 // [ A B ]
18801891 // [ B C ]
Original file line number Diff line number Diff line change 110110 'Defs4' : 'models/svg/tests/testDefs/defs4.svg' ,
111111 'Defs5' : 'models/svg/tests/testDefs/defs5.svg' ,
112112 'Style CSS inside defs' : 'models/svg/style-css-inside-defs.svg' ,
113+ 'Styled Paths' : 'models/svg/styled-paths.svg' ,
113114 'Multiple CSS classes' : 'models/svg/multiple-css-classes.svg' ,
114115 'Zero Radius' : 'models/svg/zero-radius.svg' ,
115116 'Styles in svg tag' : 'models/svg/tests/styles.svg' ,
You can’t perform that action at this time.
0 commit comments