Browse Source

Helpers: Set some default arguments.

Mr.doob 5 years ago
parent
commit
d798868e9b
4 changed files with 3 additions and 10 deletions
  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 {
 class AxesHelper extends LineSegments {
 
 
-	constructor( size ) {
-
-		size = size || 1;
+	constructor( size = 1 ) {
 
 
 		const vertices = [
 		const vertices = [
 			0, 0, 0,	size, 0, 0,
 			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 {
 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 ] );
 		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 {
 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 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 );
 		const positions = new Float32Array( 8 * 3 );

+ 0 - 1
src/helpers/PlaneHelper.js

@@ -10,7 +10,6 @@ class PlaneHelper extends Line {
 
 
 	constructor( plane, size, hex ) {
 	constructor( plane, size, hex ) {
 
 
-
 		const color = ( hex !== undefined ) ? hex : 0xffff00;
 		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 ];
 		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 ];