Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVGLoader: parseRectNode robustness and clean up. #13843

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions examples/js/loaders/SVGLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ THREE.SVGLoader.prototype = {
point.y = numbers[ 1 ];
break;

case 'A':
// TODO:
break;
// case 'A': break;

case 'm':
var numbers = parseFloats( data );
Expand Down Expand Up @@ -309,9 +307,7 @@ THREE.SVGLoader.prototype = {
point.y = point.y + numbers[ 1 ];
break;

case 'a':
// TODO:
break;
// case 'a': break;

case 'Z':
case 'z':
Expand All @@ -331,8 +327,8 @@ THREE.SVGLoader.prototype = {

function parseRectNode( node, style ) {

var x = parseFloat( node.getAttribute( 'x' ) );
var y = parseFloat( node.getAttribute( 'y' ) );
var x = parseFloat( node.getAttribute( 'x' ) || 0 );
var y = parseFloat( node.getAttribute( 'y' ) || 0 );
var w = parseFloat( node.getAttribute( 'width' ) );
var h = parseFloat( node.getAttribute( 'height' ) );

Expand Down Expand Up @@ -360,14 +356,14 @@ THREE.SVGLoader.prototype = {
path.lineTo( x, y );
}

index++;
index ++;

}

var regex = /(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g;

var path = new THREE.ShapePath();
path.color.setStyle( parseFill( node, style ) );
path.color.setStyle( style.fill );

var index = 0;

Expand All @@ -392,7 +388,7 @@ THREE.SVGLoader.prototype = {
path.lineTo( x, y );
}

index++;
index ++;

}

Expand Down