File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module.exports.Component = registerComponent('look-controls', {
2121 hmdEnabled : { default : true } ,
2222 pointerLockEnabled : { default : false } ,
2323 reverseMouseDrag : { default : false } ,
24+ reverseTouchDrag : { default : false } ,
2425 touchEnabled : { default : true }
2526 } ,
2627
@@ -282,6 +283,7 @@ module.exports.Component = registerComponent('look-controls', {
282283 * Translate touch move to Y-axis rotation.
283284 */
284285 onTouchMove : function ( evt ) {
286+ var direction ;
285287 var canvas = this . el . sceneEl . canvas ;
286288 var deltaY ;
287289 var yawObject = this . yawObject ;
@@ -290,8 +292,9 @@ module.exports.Component = registerComponent('look-controls', {
290292
291293 deltaY = 2 * Math . PI * ( evt . touches [ 0 ] . pageX - this . touchStart . x ) / canvas . clientWidth ;
292294
295+ direction = this . data . reverseTouchDrag ? 1 : - 1 ;
293296 // Limit touch orientaion to to yaw (y axis).
294- yawObject . rotation . y -= deltaY * 0.5 ;
297+ yawObject . rotation . y -= deltaY * 0.5 * direction ;
295298 this . touchStart = {
296299 x : evt . touches [ 0 ] . pageX ,
297300 y : evt . touches [ 0 ] . pageY
You can’t perform that action at this time.
0 commit comments