瀏覽代碼

SVGRenderer: use svg:path for line drawing

Idea to use svg:path for all SVG primitives.
Later one can concatenate svg:path if they have identical styles
Sergey Linev 8 年之前
父節點
當前提交
23cc902593
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      examples/js/renderers/SVGRenderer.js

+ 2 - 5
examples/js/renderers/SVGRenderer.js

@@ -350,12 +350,9 @@ THREE.SVGRenderer = function () {
 
 
 	function renderLine( v1, v2, element, material ) {
 	function renderLine( v1, v2, element, material ) {
 
 
-		_svgNode = getLineNode( _lineCount ++ );
+		_svgNode = getPathNode( _pathCount ++ );
 
 
-		_svgNode.setAttribute( 'x1', v1.positionScreen.x );
-		_svgNode.setAttribute( 'y1', v1.positionScreen.y );
-		_svgNode.setAttribute( 'x2', v2.positionScreen.x );
-		_svgNode.setAttribute( 'y2', v2.positionScreen.y );
+		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y );
 
 
 		if ( material instanceof THREE.LineBasicMaterial ) {
 		if ( material instanceof THREE.LineBasicMaterial ) {