diff --git a/examples/js/renderers/SVGRenderer.js b/examples/js/renderers/SVGRenderer.js index 5d95837d50f778a104cbbfd3ec584b7536a00025..155817372a1fa73a6fc52ae419dfabb2102bf6fc 100644 --- a/examples/js/renderers/SVGRenderer.js +++ b/examples/js/renderers/SVGRenderer.js @@ -122,13 +122,13 @@ THREE.SVGRenderer = function () { } - function getSvgColor( color, opacity ) { + function getSvgColor( color, opacity, asStroke ) { var arg = Math.floor( color.r * 255 ) + ',' + Math.floor( color.g * 255 ) + ',' + Math.floor( color.b * 255 ); if ( opacity === undefined || opacity === 1 ) return 'rgb(' + arg + ')'; - return 'rgb(' + arg + '); fill-opacity: ' + opacity; + return 'rgb(' + arg + ');' + ( asStroke ? 'stroke-opacity' : 'fill-opacity' ) + ':' + opacity; } @@ -389,7 +389,7 @@ THREE.SVGRenderer = function () { if ( material.isLineBasicMaterial ) { - var style = 'fill:none;stroke:' + getSvgColor( material.color, material.opacity ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap; + var style = 'fill:none;stroke:' + getSvgColor( material.color, material.opacity, true ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap; if ( material.isLineDashedMaterial ) { @@ -449,7 +449,7 @@ THREE.SVGRenderer = function () { if ( material.wireframe ) { - style = 'fill:none;stroke:' + getSvgColor( _color, material.opacity ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin; + style = 'fill:none;stroke:' + getSvgColor( _color, material.opacity, true ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin; } else { diff --git a/examples/jsm/renderers/SVGRenderer.js b/examples/jsm/renderers/SVGRenderer.js index 7cbe3ef9801629f44b50ea7c3c0c10cd94db6aa3..5e3c1ed1089902e165f06aed96f2945714a08807 100644 --- a/examples/jsm/renderers/SVGRenderer.js +++ b/examples/jsm/renderers/SVGRenderer.js @@ -139,13 +139,13 @@ var SVGRenderer = function () { } - function getSvgColor( color, opacity ) { + function getSvgColor( color, opacity, asStroke ) { var arg = Math.floor( color.r * 255 ) + ',' + Math.floor( color.g * 255 ) + ',' + Math.floor( color.b * 255 ); if ( opacity === undefined || opacity === 1 ) return 'rgb(' + arg + ')'; - return 'rgb(' + arg + '); fill-opacity: ' + opacity; + return 'rgb(' + arg + ');' + ( asStroke ? 'stroke-opacity' : 'fill-opacity' ) + ':' + opacity; } @@ -406,7 +406,7 @@ var SVGRenderer = function () { if ( material.isLineBasicMaterial ) { - var style = 'fill:none;stroke:' + getSvgColor( material.color, material.opacity ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap; + var style = 'fill:none;stroke:' + getSvgColor( material.color, material.opacity, true ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap; if ( material.isLineDashedMaterial ) { @@ -466,7 +466,7 @@ var SVGRenderer = function () { if ( material.wireframe ) { - style = 'fill:none;stroke:' + getSvgColor( _color, material.opacity ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin; + style = 'fill:none;stroke:' + getSvgColor( _color, material.opacity, true ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin; } else {