瀏覽代碼

Helpers: Set some default arguments.

Mr.doob 5 年之前
父節點
當前提交
d798868e9b
共有 4 個文件被更改,包括 3 次插入10 次删除
  1. 1 3
      src/helpers/AxesHelper.js
  2. 1 3
      src/helpers/Box3Helper.js
  3. 1 3
      src/helpers/BoxHelper.js
  4. 0 1
      src/helpers/PlaneHelper.js

+ 1 - 3
src/helpers/AxesHelper.js

@@ -5,9 +5,7 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
 
 class AxesHelper extends LineSegments {
 
-	constructor( size ) {
-
-		size = size || 1;
+	constructor( size = 1 ) {
 
 		const vertices = [
 			0, 0, 0,	size, 0, 0,

+ 1 - 3
src/helpers/Box3Helper.js

@@ -6,9 +6,7 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
 
 class Box3Helper extends LineSegments {
 
-	constructor( box, color ) {
-
-		if ( color === undefined ) color = 0xffff00;
+	constructor( box, color = 0xffff00 ) {
 
 		const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
 

+ 1 - 3
src/helpers/BoxHelper.js

@@ -8,9 +8,7 @@ const _box = new Box3();
 
 class BoxHelper extends LineSegments {
 
-	constructor( object, color ) {
-
-		if ( color === undefined ) color = 0xffff00;
+	constructor( object, color = 0xffff00 ) {
 
 		const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
 		const positions = new Float32Array( 8 * 3 );

+ 0 - 1
src/helpers/PlaneHelper.js

@@ -10,7 +10,6 @@ class PlaneHelper extends Line {
 
 	constructor( plane, size, hex ) {
 
-
 		const color = ( hex !== undefined ) ? hex : 0xffff00;
 
 		const positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];