Skip to content

Commit 294db9d

Browse files
committed
Lint examples
1 parent ac67e6c commit 294db9d

File tree

7 files changed

+262
-280
lines changed

7 files changed

+262
-280
lines changed

js/src/examples/.eslintrc.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"commonjs": true
5+
},
6+
"extends": "eslint:recommended",
7+
"rules": {
8+
"indent": [
9+
"error",
10+
"tab"
11+
],
12+
"linebreak-style": [
13+
"error",
14+
"windows"
15+
],
16+
"quotes": [
17+
"error",
18+
"single"
19+
],
20+
"semi": [
21+
"error",
22+
"always"
23+
],
24+
"no-console": "off",
25+
"no-unused-vars": "warn",
26+
"no-redeclare": "warn",
27+
}
28+
};

js/src/examples/cameras/CombinedCamera.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var THREE = require('three');
1414

1515
var CombinedCamera = function ( width, height, fov, near, far, orthoNear, orthoFar ) {
1616

17-
THREE.Camera.call( this );
17+
THREE.Camera.call( this );
1818

1919
this.fov = fov;
2020

@@ -34,7 +34,7 @@ var CombinedCamera = function ( width, height, fov, near, far, orthoNear, orthoF
3434
this.view = null;
3535
// We could also handle the projectionMatrix internally, but just wanted to test nested camera objects
3636

37-
this.cameraO = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, orthoNear, orthoFar );
37+
this.cameraO = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, orthoNear, orthoFar );
3838
this.cameraP = new THREE.PerspectiveCamera( fov, width / height, near, far );
3939

4040
this.impersonate = true;
@@ -86,7 +86,7 @@ CombinedCamera.prototype.toPerspective = function () {
8686
this.inPerspectiveMode = true;
8787
this.inOrthographicMode = false;
8888

89-
this.type = 'PerspectiveCamera'; // Act as a perspective camera
89+
this.type = 'PerspectiveCamera'; // Act as a perspective camera
9090

9191
};
9292

@@ -96,8 +96,6 @@ CombinedCamera.prototype.toOrthographic = function () {
9696

9797
var fov = this.fov;
9898
var aspect = this.cameraP.aspect;
99-
var near = this.cameraP.near;
100-
var far = this.cameraP.far;
10199

102100
// The size that we set is the plane of the viewing frustum at the focus
103101

@@ -122,7 +120,7 @@ CombinedCamera.prototype.toOrthographic = function () {
122120
this.inPerspectiveMode = false;
123121
this.inOrthographicMode = true;
124122

125-
this.type = 'OrthographicCamera'; // Act as an orthographic camera
123+
this.type = 'OrthographicCamera'; // Act as an orthographic camera
126124

127125
};
128126

@@ -318,5 +316,5 @@ CombinedCamera.prototype.toBottomView = function() {
318316

319317

320318
module.exports = {
321-
CombinedCamera: CombinedCamera
322-
}
319+
CombinedCamera: CombinedCamera
320+
};

js/src/examples/controls/MomentumCameraControls.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ var FlyControls = function ( object, domElement ) {
6767
}
6868
};
6969

70-
function bind( scope, fn ) {
71-
return function () {
72-
fn.apply( scope, arguments );
73-
};
74-
};
75-
7670
// events
7771

7872
var changeEvent = { type: 'change' };

js/src/examples/controls/OrbitControls.js

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ var OrbitControls = function ( object, domElement ) {
8888

8989
this.getPolarAngle = function () {
9090

91-
return phi;
91+
return spherical.phi;
9292

9393
};
9494

9595
this.getAzimuthalAngle = function () {
9696

97-
return theta;
97+
return spherical.theta;
9898

9999
};
100100

@@ -563,25 +563,25 @@ var OrbitControls = function ( object, domElement ) {
563563

564564
switch ( event.keyCode ) {
565565

566-
case scope.keys.UP:
567-
pan( 0, scope.keyPanSpeed );
568-
scope.update();
569-
break;
566+
case scope.keys.UP:
567+
pan( 0, scope.keyPanSpeed );
568+
scope.update();
569+
break;
570570

571-
case scope.keys.BOTTOM:
572-
pan( 0, - scope.keyPanSpeed );
573-
scope.update();
574-
break;
571+
case scope.keys.BOTTOM:
572+
pan( 0, - scope.keyPanSpeed );
573+
scope.update();
574+
break;
575575

576-
case scope.keys.LEFT:
577-
pan( scope.keyPanSpeed, 0 );
578-
scope.update();
579-
break;
576+
case scope.keys.LEFT:
577+
pan( scope.keyPanSpeed, 0 );
578+
scope.update();
579+
break;
580580

581-
case scope.keys.RIGHT:
582-
pan( - scope.keyPanSpeed, 0 );
583-
scope.update();
584-
break;
581+
case scope.keys.RIGHT:
582+
pan( - scope.keyPanSpeed, 0 );
583+
scope.update();
584+
break;
585585

586586
}
587587

@@ -808,39 +808,39 @@ var OrbitControls = function ( object, domElement ) {
808808

809809
switch ( event.touches.length ) {
810810

811-
case 1: // one-fingered touch: rotate
811+
case 1: // one-fingered touch: rotate
812812

813-
if ( scope.enableRotate === false ) return;
813+
if ( scope.enableRotate === false ) return;
814814

815-
handleTouchStartRotate( event );
815+
handleTouchStartRotate( event );
816816

817-
state = STATE.TOUCH_ROTATE;
817+
state = STATE.TOUCH_ROTATE;
818818

819-
break;
819+
break;
820820

821-
case 2: // two-fingered touch: dolly
821+
case 2: // two-fingered touch: dolly
822822

823-
if ( scope.enableZoom === false ) return;
823+
if ( scope.enableZoom === false ) return;
824824

825-
handleTouchStartDolly( event );
825+
handleTouchStartDolly( event );
826826

827-
state = STATE.TOUCH_DOLLY;
827+
state = STATE.TOUCH_DOLLY;
828828

829-
break;
829+
break;
830830

831-
case 3: // three-fingered touch: pan
831+
case 3: // three-fingered touch: pan
832832

833-
if ( scope.enablePan === false ) return;
833+
if ( scope.enablePan === false ) return;
834834

835-
handleTouchStartPan( event );
835+
handleTouchStartPan( event );
836836

837-
state = STATE.TOUCH_PAN;
837+
state = STATE.TOUCH_PAN;
838838

839-
break;
839+
break;
840840

841-
default:
841+
default:
842842

843-
state = STATE.NONE;
843+
state = STATE.NONE;
844844

845845
}
846846

@@ -861,36 +861,36 @@ var OrbitControls = function ( object, domElement ) {
861861

862862
switch ( event.touches.length ) {
863863

864-
case 1: // one-fingered touch: rotate
864+
case 1: // one-fingered touch: rotate
865865

866-
if ( scope.enableRotate === false ) return;
867-
if ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...
866+
if ( scope.enableRotate === false ) return;
867+
if ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...
868868

869-
handleTouchMoveRotate( event );
869+
handleTouchMoveRotate( event );
870870

871-
break;
871+
break;
872872

873-
case 2: // two-fingered touch: dolly
873+
case 2: // two-fingered touch: dolly
874874

875-
if ( scope.enableZoom === false ) return;
876-
if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
875+
if ( scope.enableZoom === false ) return;
876+
if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
877877

878-
handleTouchMoveDolly( event );
878+
handleTouchMoveDolly( event );
879879

880-
break;
880+
break;
881881

882-
case 3: // three-fingered touch: pan
882+
case 3: // three-fingered touch: pan
883883

884-
if ( scope.enablePan === false ) return;
885-
if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...
884+
if ( scope.enablePan === false ) return;
885+
if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...
886886

887-
handleTouchMovePan( event );
887+
handleTouchMovePan( event );
888888

889-
break;
889+
break;
890890

891-
default:
891+
default:
892892

893-
state = STATE.NONE;
893+
state = STATE.NONE;
894894

895895
}
896896

0 commit comments

Comments
 (0)