Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions docs/examples/controls/OrbitControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@ <h3>[property:Camera object]</h3>
The camera being controlled.
</div>

<h3>[property:Integer panningMode]</h3>
<div>
Panning mode. Defines how the camera's position is translated when panning.
The options are THREE.ScreenSpacePanning, in which the camera pans in screen space,
and THREE.HorizontalPanning, in which the camera pans in the plane orthogonal to the camera's up direction.
Default is THREE.ScreenSpacePanning.
</div>

<h3>[property:Float panSpeed]</h3>
<div>
Speed of panning. Default is 1.
Expand All @@ -225,6 +217,12 @@ <h3>[property:Float rotateSpeed]</h3>
Speed of rotation. Default is 1.
</div>

<h3>[property:Boolean screenSpacePanning]</h3>
<div>
Defines how the camera's position is translated when panning. If true, the camera pans in screen space.
Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is false.
</div>

<h3>[property:Vector3 target0]</h3>
<div>
Used internally by the [method:saveState] and [method:reset] methods.
Expand Down
19 changes: 6 additions & 13 deletions examples/js/controls/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ THREE.OrbitControls = function ( object, domElement ) {
// Set to false to disable panning
this.enablePan = true;
this.panSpeed = 1.0;
this.panningMode = THREE.ScreenSpacePanning; // alternate THREE.HorizontalPanning
this.screenSpacePanning = false; // if true, pan in screen-space
this.keyPanSpeed = 7.0; // pixels moved per arrow key push

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

return function panUp( distance, objectMatrix ) {

switch ( scope.panningMode ) {
if ( scope.screenSpacePanning === true ) {

case THREE.ScreenSpacePanning:
v.setFromMatrixColumn( objectMatrix, 1 );

v.setFromMatrixColumn( objectMatrix, 1 );
break;

case THREE.HorizontalPanning:
} else {

v.setFromMatrixColumn( objectMatrix, 0 );
v.crossVectors( scope.object.up, v );
break;
v.setFromMatrixColumn( objectMatrix, 0 );
v.crossVectors( scope.object.up, v );

}

Expand Down Expand Up @@ -1045,6 +1041,3 @@ Object.defineProperties( THREE.OrbitControls.prototype, {
}

} );

THREE.ScreenSpacePanning = 0;
THREE.HorizontalPanning = 1;
2 changes: 1 addition & 1 deletion examples/misc_controls_orbit.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled
controls.dampingFactor = 0.25;

controls.panningMode = THREE.HorizontalPanning; // default is THREE.ScreenSpacePanning
controls.screenSpacePanning = false;

controls.minDistance = 100;
controls.maxDistance = 500
Expand Down
1 change: 0 additions & 1 deletion examples/webgl_shaders_ocean.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.maxPolarAngle = Math.PI * 0.495;
controls.target.set( 0, 10, 0 );
controls.panningMode = THREE.HorizontalPanning;
controls.minDistance = 40.0;
controls.maxDistance = 200.0;
camera.lookAt( controls.target );
Expand Down