function handleMouseMovePan(event) { //console.log( 'handleMouseMovePan' ); panEnd.set(event.clientX, event.clientY); panDelta.subVectors(panEnd, panStart); pan(panDelta.x, panDelta.y); panStart.copy(panEnd); scope.update(); }
function handleTouchMovePan(event) { //console.log( 'handleTouchMovePan' ); panEnd.set(event.touches[0].pageX, event.touches[0].pageY); panDelta.subVectors(panEnd, panStart); pan(panDelta.x, panDelta.y); panStart.copy(panEnd); scope.update(); }
function handleTouchMoveDolly(event) { //console.log( 'handleTouchMoveDolly' ); var dx = event.touches[0].pageX - event.touches[1].pageX; var dy = event.touches[0].pageY - event.touches[1].pageY; var distance = Math.sqrt(dx * dx + dy * dy); dollyEnd.set(0, distance); dollyDelta.subVectors(dollyEnd, dollyStart); if (dollyDelta.y > 0) { dollyOut(getZoomScale()); } else if (dollyDelta.y < 0) { dollyIn(getZoomScale()); } dollyStart.copy(dollyEnd); scope.update(); }
useCallback((event, fn) => { prepareRay(event); // If the interaction is captured, take the last known hit instead of raycasting again const hits = state.current.captured && event.type !== 'click' && event.type !== 'wheel' ? state.current.captured : intersect(event, false); if (hits.length) { const unprojectedPoint = new Vector3(mouse.x, mouse.y, 0).unproject(state.current.camera); for (let hit of hits) { let stopped = { current: false }; fn(_extends({}, event, hit, { stopped, unprojectedPoint, ray: defaultRaycaster.ray, // Hijack stopPropagation, which just sets a flag stopPropagation: () => stopped.current = true, sourceEvent: event })); if (stopped.current === true) break; } } return hits; }, [])
function handleMouseMoveDolly(event) { //console.log( 'handleMouseMoveDolly' ); dollyEnd.set(event.clientX, event.clientY); dollyDelta.subVectors(dollyEnd, dollyStart); if (dollyDelta.y > 0) { dollyIn(getZoomScale()); } else if (dollyDelta.y < 0) { dollyOut(getZoomScale()); } dollyStart.copy(dollyEnd); scope.update(); }
...object, longitude: latlngVector.x, latitude: latlngVector.y };
function handleTouchMoveRotate(event) { //console.log( 'handleTouchMoveRotate' ); rotateEnd.set(event.touches[0].pageX, event.touches[0].pageY); rotateDelta.subVectors(rotateEnd, rotateStart); // rotating across whole screen goes 360 degrees around rotateLeft( ((2 * Math.PI * rotateDelta.x) / scope.clientWidth) * scope.rotateSpeed ); // rotating up and down along whole screen attempts to go 360, but limited to 180 rotateUp( ((2 * Math.PI * rotateDelta.y) / scope.clientHeight) * scope.rotateSpeed ); rotateStart.copy(rotateEnd); scope.update(); }
function handleMouseMoveRotate(event) { //console.log( 'handleMouseMoveRotate' ); rotateEnd.set(event.clientX, event.clientY); rotateDelta.subVectors(rotateEnd, rotateStart); // rotating across whole screen goes 360 degrees around rotateLeft( ((2 * Math.PI * rotateDelta.x) / scope.clientWidth) * scope.rotateSpeed ); // rotating up and down along whole screen attempts to go 360, but limited to 180 rotateUp( ((2 * Math.PI * rotateDelta.y) / scope.clientHeight) * scope.rotateSpeed ); rotateStart.copy(rotateEnd); scope.update(); }