先把几个函数发上来,完整代码等解耦后再完善
单手指点击屏幕前进,双手指点击后退 左右滑动专向
this.onTouchStart=function( event ) {isUserInteracting = true;var clientX = event.clientX || event.touches[ 0 ].clientX;var clientY = event.clientY || event.touches[ 0 ].clientY;onMouseDownMouseX = clientX;onMouseDownMouseY = clientY;onMouseDownLon = lon;onMouseDownLat = lat;if ( this.domElement !== document ) {this.domElement.focus();}event.preventDefault(); //防止违约event.stopPropagation(); //停止传播if ( this.activeLook ) {var touch = event.targetTouches[0];touchstartY=touch.pageX;switch ( event.touches.length ) {case 1:this.moveForward = true;break;case 2:this.moveBackward = true; break;default:}}this.mouseDragOn = true; //鼠标拖动console.log("touchstart");}this.onTouchEnd=function( event ) {console.log("touchend");isUserInteracting = false;//console.log(event.touches.length);this.moveForward = false; this.moveBackward = false; this.mouseDragOn = false;}this.onTouchMove=function( event ) {console.log("touchmove");if ( isUserInteracting === true ) {var clientX = event.clientX || event.touches[ 0 ].clientX;var clientY = event.clientY || event.touches[ 0 ].clientY;lon = ( onMouseDownMouseX - clientX ) * 0.1 + onMouseDownLon;lat = ( clientY - onMouseDownMouseY ) * 0.1 + onMouseDownLat;}}