소스 검색

remove console.log and take into account different types of Curve classes on z-command

Jonathan Brandel 7 년 전
부모
커밋
5248b91f8e
1개의 변경된 파일14개의 추가작업 그리고 3개의 파일을 삭제
  1. 14 3
      examples/js/loaders/SVGLoader.js

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

@@ -249,7 +249,6 @@ THREE.SVGLoader.prototype = {
 							point.y += numbers[ j + 1 ];
 							control.x = point.x;
 							control.y = point.y;
-							console.log( point.x, point.y );
 							path.moveTo( point.x, point.y );
 						}
 						break;
@@ -375,8 +374,20 @@ THREE.SVGLoader.prototype = {
 					case 'z':
 						path.currentPath.autoClose = true;
 						// Reset point to beginning of Path
-						point.x = path.currentPath.curves[ 0 ].v0.x;
-						point.y = path.currentPath.curves[ 0 ].v0.y;
+						var curve = path.currentPath.curves[ 0 ];
+						if ( curve.isLineCurve ) {
+							point.x = curve.v1.x;
+							point.y = curve.v1.y;
+						} else if ( curve.isEllipseCurve || curve.isArcCurve ) {
+							point.x = curve.aX;
+							point.y = curve.aY;
+						} else if ( curve.isCubicBezierCurve || curve.isQuadraticBezierCurve ) {
+							point.x = curve.v0.x;
+							point.y = curve.v0.y;
+						} else if ( curve.isSplineCurve ) {
+							point.x = curve.points[ 0 ].x;
+							point.y = curve.points[ 0 ].y;
+						}
 						path.currentPath.currentPoint.copy( point );
 						break;