onTouchStart method
dynamic
onTouchStart(
- dynamic event
Implementation
onTouchStart(event) {
trackPointer(event);
switch (_pointers.length) {
case 1:
_state = STATE.TOUCH_ROTATE;
_moveCurr
.copy(getMouseOnCircle(_pointers[0].pageX, _pointers[0].pageY));
_movePrev.copy(_moveCurr);
break;
default: // 2 or more
_state = STATE.TOUCH_ZOOM_PAN;
var dx = _pointers[0].pageX - _pointers[1].pageX;
var dy = _pointers[0].pageY - _pointers[1].pageY;
_touchZoomDistanceEnd =
_touchZoomDistanceStart = Math.sqrt(dx * dx + dy * dy);
var x = (_pointers[0].pageX + _pointers[1].pageX) / 2;
var y = (_pointers[0].pageY + _pointers[1].pageY) / 2;
_panStart.copy(getMouseOnScreen(x, y));
_panEnd.copy(_panStart);
break;
}
scope.dispatchEvent(_startEvent);
}