From 968d0f3e2d6e10bb5b372cb8593d75604b911c17 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 19 May 2017 18:49:01 -0700 Subject: [PATCH] SVGRenderer: Clean up. --- examples/js/renderers/SVGRenderer.js | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/examples/js/renderers/SVGRenderer.js b/examples/js/renderers/SVGRenderer.js index 9ba08d45b6..2d8f7e4c26 100644 --- a/examples/js/renderers/SVGRenderer.js +++ b/examples/js/renderers/SVGRenderer.js @@ -45,7 +45,10 @@ THREE.SVGRenderer = function () { _viewProjectionMatrix = new THREE.Matrix4(), _svgPathPool = [], - _svgNode, _pathCount = 0, _currPath, _currStyle, + _svgNode, _pathCount = 0, + + _currentPath, _currentStyle, + _quality = 1, _precision = null; this.domElement = _svg; @@ -180,7 +183,11 @@ THREE.SVGRenderer = function () { _normalViewMatrix.getNormalMatrix( camera.matrixWorldInverse ); calculateLights( _lights ); - _currPath = _currStyle = ""; // reset accumulated path + + // reset accumulated path + + _currentPath = ''; + _currentStyle = ''; for ( var e = 0, el = _elements.length; e < el; e ++ ) { @@ -441,16 +448,16 @@ THREE.SVGRenderer = function () { function addPath ( style, path ) { - if ( _currStyle == style ) { + if ( _currentStyle === style ) { - _currPath += path + _currentPath += path } else { flushPath(); - _currStyle = style; - _currPath = path; + _currentStyle = style; + _currentPath = path; } @@ -458,16 +465,18 @@ THREE.SVGRenderer = function () { function flushPath() { - if ( _currPath ) { + if ( _currentPath ) { _svgNode = getPathNode( _pathCount ++ ); - _svgNode.setAttribute( 'd', _currPath ); - _svgNode.setAttribute( 'style', _currStyle ); + _svgNode.setAttribute( 'd', _currentPath ); + _svgNode.setAttribute( 'style', _currentStyle ); _svg.appendChild( _svgNode ); } - _currPath = _currStyle = ""; + _currentPath = ''; + _currentStyle = ''; + } function getPathNode( id ) { -- GitLab