|
@@ -120,13 +120,19 @@ THREE.SVGRenderer = function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getSvgColor( color, opacity, asStroke ) {
|
|
|
+ function getSvgColor( color ) {
|
|
|
|
|
|
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 + ')';
|
|
|
|
|
|
- return 'rgb(' + arg + ');' + ( asStroke ? 'stroke-opacity' : 'fill-opacity' ) + ':' + opacity;
|
|
|
+ }
|
|
|
+
|
|
|
+ function getSvgOpacity( opacity ) {
|
|
|
+
|
|
|
+ if ( opacity === undefined || opacity === 1 ) return 'none';
|
|
|
+
|
|
|
+ return opacity;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -139,7 +145,7 @@ THREE.SVGRenderer = function () {
|
|
|
this.clear = function () {
|
|
|
|
|
|
removeChildNodes();
|
|
|
- _svg.style.backgroundColor = getSvgColor( _clearColor, _clearAlpha );
|
|
|
+ _svg.style.backgroundColor = getSvgColor( _clearColor ) + ';fill-opacity:' + getSvgOpacity( _clearAlpha );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -373,7 +379,7 @@ THREE.SVGRenderer = function () {
|
|
|
|
|
|
if ( material.isSpriteMaterial || material.isPointsMaterial ) {
|
|
|
|
|
|
- style = 'fill:' + getSvgColor( material.color, material.opacity );
|
|
|
+ style = 'fill:' + getSvgColor( material.color ) + ';fill-opacity:' + getSvgOpacity( material.opacity );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -387,7 +393,7 @@ THREE.SVGRenderer = function () {
|
|
|
|
|
|
if ( material.isLineBasicMaterial ) {
|
|
|
|
|
|
- var style = 'fill:none;stroke:' + getSvgColor( material.color, material.opacity, true ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap;
|
|
|
+ var style = 'fill:none;stroke:' + getSvgColor( material.color ) + ';stroke-opacity:' + getSvgOpacity( material.opacity ) + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap;
|
|
|
|
|
|
if ( material.isLineDashedMaterial ) {
|
|
|
|
|
@@ -447,11 +453,11 @@ THREE.SVGRenderer = function () {
|
|
|
|
|
|
if ( material.wireframe ) {
|
|
|
|
|
|
- style = 'fill:none;stroke:' + getSvgColor( _color, material.opacity, true ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin;
|
|
|
+ style = 'fill:none;stroke:' + getSvgColor( _color ) + ';stroke-opacity:' + getSvgOpacity( material.opacity ) + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- style = 'fill:' + getSvgColor( _color, material.opacity );
|
|
|
+ style = 'fill:' + getSvgColor( _color ) + ';fill-opacity:' + getSvgOpacity( material.opacity );
|
|
|
|
|
|
}
|
|
|
|