默认情况下,使用鼠标右键进行摄像机平移
Control.panSpeed = 1.5;
但我想让它在鼠标左键工作。如何设置?
答案 0 :(得分:1)
这需要对轨迹球代码进行简单修改。
如果你看一下TrackballControls.js,最初详细介绍了与密码相关的状态机(source code):
SELECT r.*
FROM recipes_ingredients i
JOIN recipes r ON i.id_recipe = r.id
WHERE i.id_ingredient IN ( 96, 13196 )
GROUP BY r.id
HAVING COUNT(DISTINCT i.id_ingredient ) = 2
哪个与SELECT r.*
FROM recipes_ingredients i
JOIN recipes r ON i.id_recipe = r.id
GROUP BY r.id
HAVING SUM(i.id_ingredient = 96)
AND SUM(i.id_ingredient = 13196)
功能进一步向下(source code):
THREE.TrackballControls = function ( object, domElement ) {
var _this = this;
var STATE = {NONE: -1, ROTATE: 0, ZOOM: 1, PN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM_PANE: 4};
this.object = object;
this.domElement = ( domElement !== undefined ) ? domElement : document;
// API
this.enabled = true;
this.screen = { left: 0, top: 0, width: 0, height: 0 };
所以,我还没有机会对此进行测试,但您应该能够将第11行中的PAN从2(右键的键码)更改为0(左键单击)或您想要的任何其他键码。请记住改变ROTATE以避免同时旋转和平移的容易出错的指令。
编辑:根据@ TheJim01的有用更正,实际点击事件触发实际发生在脚本第393行的keydown()
中。 event.button对应于状态机中的相应数字。对此感到抱歉。