Skip to content

Commit 1a12cc8

Browse files
authored
Merge pull request #13720 from WestLangley/dev-panning_mode
OrbitControls: remove HorizontalPanning nomenclature
2 parents 7af60e6 + a9cf263 commit 1a12cc8

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

docs/examples/controls/OrbitControls.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,6 @@ <h3>[property:Camera object]</h3>
202202
The camera being controlled.
203203
</div>
204204

205-
<h3>[property:Integer panningMode]</h3>
206-
<div>
207-
Panning mode. Defines how the camera's position is translated when panning.
208-
The options are THREE.ScreenSpacePanning, in which the camera pans in screen space,
209-
and THREE.HorizontalPanning, in which the camera pans in the plane orthogonal to the camera's up direction.
210-
Default is THREE.ScreenSpacePanning.
211-
</div>
212-
213205
<h3>[property:Float panSpeed]</h3>
214206
<div>
215207
Speed of panning. Default is 1.
@@ -225,6 +217,12 @@ <h3>[property:Float rotateSpeed]</h3>
225217
Speed of rotation. Default is 1.
226218
</div>
227219

220+
<h3>[property:Boolean screenSpacePanning]</h3>
221+
<div>
222+
Defines how the camera's position is translated when panning. If true, the camera pans in screen space.
223+
Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is false.
224+
</div>
225+
228226
<h3>[property:Vector3 target0]</h3>
229227
<div>
230228
Used internally by the [method:saveState] and [method:reset] methods.

examples/js/controls/OrbitControls.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ THREE.OrbitControls = function ( object, domElement ) {
6060
// Set to false to disable panning
6161
this.enablePan = true;
6262
this.panSpeed = 1.0;
63-
this.panningMode = THREE.ScreenSpacePanning; // alternate THREE.HorizontalPanning
63+
this.screenSpacePanning = false; // if true, pan in screen-space
6464
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
6565

6666
// Set to true to automatically rotate around the target
@@ -321,18 +321,14 @@ THREE.OrbitControls = function ( object, domElement ) {
321321

322322
return function panUp( distance, objectMatrix ) {
323323

324-
switch ( scope.panningMode ) {
324+
if ( scope.screenSpacePanning === true ) {
325325

326-
case THREE.ScreenSpacePanning:
326+
v.setFromMatrixColumn( objectMatrix, 1 );
327327

328-
v.setFromMatrixColumn( objectMatrix, 1 );
329-
break;
330-
331-
case THREE.HorizontalPanning:
328+
} else {
332329

333-
v.setFromMatrixColumn( objectMatrix, 0 );
334-
v.crossVectors( scope.object.up, v );
335-
break;
330+
v.setFromMatrixColumn( objectMatrix, 0 );
331+
v.crossVectors( scope.object.up, v );
336332

337333
}
338334

@@ -1045,6 +1041,3 @@ Object.defineProperties( THREE.OrbitControls.prototype, {
10451041
}
10461042

10471043
} );
1048-
1049-
THREE.ScreenSpacePanning = 0;
1050-
THREE.HorizontalPanning = 1;

examples/misc_controls_orbit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled
7777
controls.dampingFactor = 0.25;
7878

79-
controls.panningMode = THREE.HorizontalPanning; // default is THREE.ScreenSpacePanning
79+
controls.screenSpacePanning = false;
8080

8181
controls.minDistance = 100;
8282
controls.maxDistance = 500

examples/webgl_shaders_ocean.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
controls = new THREE.OrbitControls( camera, renderer.domElement );
169169
controls.maxPolarAngle = Math.PI * 0.495;
170170
controls.target.set( 0, 10, 0 );
171-
controls.panningMode = THREE.HorizontalPanning;
172171
controls.minDistance = 40.0;
173172
controls.maxDistance = 200.0;
174173
camera.lookAt( controls.target );

0 commit comments

Comments
 (0)