To zoom in or out logarithmically, I simply click and hold either the left or right mouse button.
/// event listeners
document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);
document.addEventListener('mousedown', startZoom, false)
document.addEventListener('mouseup', endZoom, false)
/// zoom controls
function startZoom(event){
if(zoomTimer == 0){
clickButton = event.which;
zoomTimer = setInterval('initiateZoom()', zoomSpeed);
}
}
function endZoom(){
if(zoomTimer != 0){
clearInterval(zoomTimer);
zoomTimer = 0;
}
}
function initiateZoom(event){
if(clickButton == 1){
camera.fov += zoomSpeed;
} else if(clickButton == 3){
camera.fov -= zoomSpeed;
}
camera.updateProjectionMatrix();
render();
}