提交 33c2c947 编写于 作者: S Sergey Linev

SVGRenderer: remove spaces from svg:path

When SVG stored into the file, reduces file size by ~5%
上级 6dbc68c8
......@@ -334,12 +334,12 @@ THREE.SVGRenderer = function () {
scaleY *= material.size;
}
var path = 'M ' + ( v1.x - scaleX * 0.5 ) + ' ' + ( v1.y - scaleY * 0.5 ) + ' h ' + scaleX + ' v ' + scaleY + ' h ' + (-scaleX) + ' z';
var path = 'M' + ( v1.x - scaleX * 0.5 ) + ',' + ( v1.y - scaleY * 0.5 ) + 'h' + scaleX + 'v' + scaleY + 'h' + (-scaleX) + 'z';
var style = "";
if ( material.isSpriteMaterial || material.isPointsMaterial ) {
style = 'fill: ' + material.color.getStyle();
style = 'fill:' + material.color.getStyle();
}
......@@ -349,11 +349,11 @@ THREE.SVGRenderer = function () {
function renderLine( v1, v2, element, material ) {
var path = 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y;
var path = 'M' + v1.positionScreen.x + ',' + v1.positionScreen.y + 'L' + v2.positionScreen.x + ',' + v2.positionScreen.y;
if ( material instanceof THREE.LineBasicMaterial ) {
var style = 'fill: none; stroke: ' + material.color.getStyle() + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin;
var style = 'fill:none;stroke:' + material.color.getStyle() + ';stroke-width:' + material.linewidth + ';stroke-opacity:' + material.opacity + ';stroke-linecap:' + material.linecap + ';stroke-linejoin:' + material.linejoin;
addPath( style, path );
......@@ -366,7 +366,7 @@ THREE.SVGRenderer = function () {
_this.info.render.vertices += 3;
_this.info.render.faces ++;
var path = 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + 'z';
var path = 'M' + v1.positionScreen.x + ',' + v1.positionScreen.y + 'L' + v2.positionScreen.x + ',' + v2.positionScreen.y + 'L' + v3.positionScreen.x + ',' + v3.positionScreen.y + 'z';
var style = '';
if ( material instanceof THREE.MeshBasicMaterial ) {
......@@ -407,11 +407,11 @@ THREE.SVGRenderer = function () {
if ( material.wireframe ) {
style = 'fill: none; stroke: ' + _color.getStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin;
style = 'fill:none;stroke:' + _color.getStyle() + ';stroke-width:' + material.wireframeLinewidth + ';stroke-opacity:' + material.opacity + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin;
} else {
style = 'fill: ' + _color.getStyle() + '; fill-opacity: ' + material.opacity;
style = 'fill:' + _color.getStyle() + ';fill-opacity:' + material.opacity;
}
......@@ -423,7 +423,6 @@ THREE.SVGRenderer = function () {
if ( _currStyle == style ) {
if ( _currPath ) _currPath += " ";
_currPath += path
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册