MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / touchstart

Function touchstart

public/iframe/lib/js/TrackballControls.js:614–644  ·  view source on GitHub ↗
( event )

Source from the content-addressed store, hash-verified

612 }
613
614 function touchstart( event ) {
615
616 if ( scope.enabled === false ) return;
617
618 event.preventDefault();
619
620 switch ( event.touches.length ) {
621
622 case 1:
623 _state = STATE.TOUCH_ROTATE;
624 _moveCurr.copy( getMouseOnCircle( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
625 _movePrev.copy( _moveCurr );
626 break;
627
628 default: // 2 or more
629 _state = STATE.TOUCH_ZOOM_PAN;
630 var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
631 var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
632 _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt( dx * dx + dy * dy );
633
634 var x = ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ) / 2;
635 var y = ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ) / 2;
636 _panStart.copy( getMouseOnScreen( x, y ) );
637 _panEnd.copy( _panStart );
638 break;
639
640 }
641
642 scope.dispatchEvent( startEvent );
643
644 }
645
646 function touchmove( event ) {
647

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected