貌似this functionality was added fairly recently,但has yet to be properly documented
公關包括下面的例子:
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);
}
希望做同樣的事情。你有沒有想過這個? –
不完全。 X3DOM具有「檢查」和「轉盤」導航模式。我的解決方案在它們之間切換,並使用一個平移和另一個旋轉。 – user2939415