Browse Source

SVGLoader: Basic A/a command handling to avoid path breakage

Mr.doob 7 years ago
parent
commit
d7b2614aa0
1 changed files with 26 additions and 2 deletions
  1. 26 2
      examples/js/loaders/SVGLoader.js

+ 26 - 2
examples/js/loaders/SVGLoader.js

@@ -220,7 +220,19 @@ THREE.SVGLoader.prototype = {
 						point.y = numbers[ 1 ];
 						break;
 
-					// case 'A': break;
+					case 'A':
+						console.warn( command );
+						var numbers = parseFloats( data );
+						for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) {
+							// TODO
+							point.x = numbers[ j + 5 ];
+							point.y = numbers[ j + 6 ];
+							control.x = point.x;
+							control.y = point.y;
+						}
+						break;
+
+					//
 
 					case 'm':
 						var numbers = parseFloats( data );
@@ -328,7 +340,19 @@ THREE.SVGLoader.prototype = {
 						point.y = point.y + numbers[ 1 ];
 						break;
 
-					// case 'a': break;
+					case 'a':
+						console.warn( command );
+						var numbers = parseFloats( data );
+						for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) {
+							// TODO
+							point.x += numbers[ j + 5 ];
+							point.y += numbers[ j + 6 ];
+							control.x = point.x;
+							control.y = point.y;
+						}
+						break;
+
+					//
 
 					case 'Z':
 					case 'z':