未验证 提交 4f5af7f0 编写于 作者: M Michael Herzog 提交者: GitHub

Merge pull request #17373 from migiyubi/patch-svgrenderer

SVGRenderer: Fix opacity is not applied to line
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册