看起来这个功能是最近才添加的,但还没有正确记录
PR 包括这个例子:
var d = function(selector) { return document.querySelector(selector)}
x3dom.runtime.ready = function() {
var x3d = d('x3d');
var viewpoint = d('viewpoint');
var x3dCanvas = x3d.runtime.canvas;
var _onMouseWheel = x3dCanvas.onMouseWheel;
x3dCanvas.onMouseWheel = function(event) {
if(event.altKey) {
var offset = .01
var fov = parseFloat(viewpoint.getAttribute('fieldofview')) || 1.571;
if(event.wheelDelta < 0) offset = -offset;
fov = Math.min(2, Math.max(0, fov+offset));
viewpoint.setAttribute('fieldofview', fov)
} else {
_onMouseWheel.call(this, event);
}
}
x3dCanvas.canvas.removeEventListener('mousewheel', _onMouseWheel); // unable to unbind when handler is anonymous function
x3dCanvas.canvas.addEventListener('mousewheel', x3dCanvas.onMouseWheel);
}