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
1 change: 1 addition & 0 deletions docs/components/look-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ component](camera.md).
| Property | Description | Default Value |
|------------------|------------------------------------------------------------------|---------------|
| enabled | Whether look controls are enabled. | true |
| touchEnabled | Whether to use touch controls in magic window mode. | true |
| hmdEnabled | Whether to use VR headset pose in VR mode. | true |
| reverseMouseDrag | Whether to reverse mouse drag. | false |
| standing | Whether standing mode is enabled (passed to `THREE.VRControls`). | true |
Expand Down
5 changes: 3 additions & 2 deletions src/components/look-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports.Component = registerComponent('look-controls', {

schema: {
enabled: {default: true},
touchEnabled: {default: true},
hmdEnabled: {default: true},
reverseMouseDrag: {default: false},
standing: {default: true}
Expand Down Expand Up @@ -311,7 +312,7 @@ module.exports.Component = registerComponent('look-controls', {
* Register touch down to detect touch drag.
*/
onTouchStart: function (evt) {
if (evt.touches.length !== 1) { return; }
if (evt.touches.length !== 1 || !this.data.touchEnabled) { return; }
this.touchStart = {
x: evt.touches[0].pageX,
y: evt.touches[0].pageY
Expand All @@ -327,7 +328,7 @@ module.exports.Component = registerComponent('look-controls', {
var deltaY;
var yawObject = this.yawObject;

if (!this.touchStarted) { return; }
if (!this.touchStarted || !this.data.touchEnabled) { return; }

deltaY = 2 * Math.PI * (evt.touches[0].pageX - this.touchStart.x) / canvas.clientWidth;

Expand Down