( event )
| 357 | |
| 358 | |
| 359 | function onTouchMove( event ) { |
| 360 | |
| 361 | trackPointer( event ); |
| 362 | |
| 363 | function getClosest( touch, touches ) { |
| 364 | |
| 365 | var closest = touches[ 0 ]; |
| 366 | |
| 367 | for ( var touch2 of touches ) { |
| 368 | |
| 369 | if ( closest.distanceTo( touch ) > touch2.distanceTo( touch ) ) closest = touch2; |
| 370 | |
| 371 | } |
| 372 | |
| 373 | return closest; |
| 374 | |
| 375 | } |
| 376 | |
| 377 | switch ( pointers.length ) { |
| 378 | |
| 379 | case 1: |
| 380 | touches[ 0 ].set( event.pageX, event.pageY, 0 ).divideScalar( window.devicePixelRatio ); |
| 381 | touches[ 1 ].set( event.pageX, event.pageY, 0 ).divideScalar( window.devicePixelRatio ); |
| 382 | scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 1 ) ); |
| 383 | break; |
| 384 | |
| 385 | case 2: |
| 386 | |
| 387 | var position = getSecondPointerPosition( event ); |
| 388 | |
| 389 | touches[ 0 ].set( event.pageX, event.pageY, 0 ).divideScalar( window.devicePixelRatio ); |
| 390 | touches[ 1 ].set( position.x, position.y, 0 ).divideScalar( window.devicePixelRatio ); |
| 391 | // Divide by 10 to offset inherent over-sensitivity (https://github.com/mrdoob/three.js/issues/32442) |
| 392 | var distance = touches[ 0 ].distanceTo( touches[ 1 ] ) / 10; |
| 393 | scope.zoom( delta.set( 0, 0, prevDistance - distance ) ); |
| 394 | prevDistance = distance; |
| 395 | |
| 396 | |
| 397 | var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ], prevTouches ) ); |
| 398 | var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ], prevTouches ) ); |
| 399 | offset0.x = - offset0.x; |
| 400 | offset1.x = - offset1.x; |
| 401 | |
| 402 | scope.pan( offset0.add( offset1 ) ); |
| 403 | |
| 404 | break; |
| 405 | |
| 406 | } |
| 407 | |
| 408 | prevTouches[ 0 ].copy( touches[ 0 ] ); |
| 409 | prevTouches[ 1 ].copy( touches[ 1 ] ); |
| 410 | |
| 411 | } |
| 412 | |
| 413 | function addPointer( event ) { |
| 414 |
nothing calls this directly
no test coverage detected