Skip to content

Commit b507048

Browse files
committed
SVGRenderer: Implemented @srifqi clearAlpha code. Fixes mrdoob#4898.
1 parent c0aaeba commit b507048

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/js/renderers/SVGRenderer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ THREE.SVGRenderer = function () {
2323
_directionalLights = new THREE.Color(),
2424
_pointLights = new THREE.Color(),
2525
_clearColor = new THREE.Color(),
26+
_clearAlpha = 1,
2627

2728
_w, // z-buffer to w-buffer
2829
_vector3 = new THREE.Vector3(), // Needed for PointLight
@@ -67,7 +68,8 @@ THREE.SVGRenderer = function () {
6768

6869
this.setClearColor = function ( color, alpha ) {
6970

70-
_clearColor.set(color);
71+
_clearColor.set( color );
72+
_clearAlpha = alpha !== undefined ? alpha : 1;
7173

7274
};
7375

@@ -97,7 +99,7 @@ THREE.SVGRenderer = function () {
9799

98100
}
99101

100-
_svg.style.backgroundColor = _clearColor.getStyle();
102+
_svg.style.backgroundColor = 'rgba(' + ( ( _clearColor.r * 255 ) | 0 ) + ',' + ( ( _clearColor.g * 255 ) | 0 ) + ',' + ( ( _clearColor.b * 255 ) | 0 ) + ',' + _clearAlpha + ')';
101103

102104
};
103105

0 commit comments

Comments
 (0)