2
0
Эх сурвалжийг харах

Merge pull request #14122 from mrdoob/svgloader

SVGLoader: Fixed getReflection() and fixed control point after c command
Mr.doob 7 жил өмнө
parent
commit
c4cc1595da

+ 3 - 3
examples/js/loaders/SVGLoader.js

@@ -289,6 +289,8 @@ THREE.SVGLoader.prototype = {
 								point.x + numbers[ j + 4 ],
 								point.x + numbers[ j + 4 ],
 								point.y + numbers[ j + 5 ]
 								point.y + numbers[ j + 5 ]
 							);
 							);
+							control.x = point.x + numbers[ j + 2 ];
+							control.y = point.y + numbers[ j + 3 ];
 							point.x += numbers[ j + 4 ];
 							point.x += numbers[ j + 4 ];
 							point.y += numbers[ j + 5 ];
 							point.y += numbers[ j + 5 ];
 						}
 						}
@@ -297,8 +299,6 @@ THREE.SVGLoader.prototype = {
 					case 's':
 					case 's':
 						var numbers = parseFloats( data );
 						var numbers = parseFloats( data );
 						path.bezierCurveTo(
 						path.bezierCurveTo(
-							// TODO: Not sure if point needs
-							// to be added to reflection...
 							getReflection( point.x, control.x ),
 							getReflection( point.x, control.x ),
 							getReflection( point.y, control.y ),
 							getReflection( point.y, control.y ),
 							point.x + numbers[ 0 ],
 							point.x + numbers[ 0 ],
@@ -620,7 +620,7 @@ THREE.SVGLoader.prototype = {
 
 
 		function getReflection( a, b ) {
 		function getReflection( a, b ) {
 
 
-			return 2 * a - ( b - a );
+			return a - ( b - a );
 
 
 		}
 		}