Skip to content

Commit 525b9c6

Browse files
committed
remove closure of clampLength
1 parent 57902f1 commit 525b9c6

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

src/math/Vector2.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,11 @@ THREE.Vector2.prototype = {
290290

291291
}(),
292292

293-
clampLength: function () {
293+
clampLength: function ( min, max ) {
294294

295-
var oldLength, newLength;
295+
var oldLength = this.length();
296296

297-
return function clampLength( min, max ) {
298-
299-
oldLength = this.length();
300-
301-
newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
297+
var newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
302298

303299
if ( newLength !== oldLength ) {
304300

@@ -308,9 +304,7 @@ THREE.Vector2.prototype = {
308304

309305
return this;
310306

311-
};
312-
313-
}(),
307+
},
314308

315309
floor: function () {
316310

src/math/Vector3.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,11 @@ THREE.Vector3.prototype = {
520520

521521
}(),
522522

523-
clampLength: function () {
523+
clampLength: function ( min, max ) {
524524

525-
var oldLength, newLength;
525+
var oldLength = this.length();
526526

527-
return function clampLength( min, max ) {
528-
529-
oldLength = this.length();
530-
531-
newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
527+
var newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
532528

533529
if ( newLength !== oldLength ) {
534530

@@ -538,9 +534,7 @@ THREE.Vector3.prototype = {
538534

539535
return this;
540536

541-
};
542-
543-
}(),
537+
},
544538

545539
floor: function () {
546540

0 commit comments

Comments
 (0)