我正在使用acrobat js更改3D注释的默认鼠标行为。我已经定义了六个主要视图,我希望用户只能从这些视图中查看模型。应禁用使用鼠标的模型的默认翻滚。我希望用户仍然能够使用3D注释工具栏提供的其他功能。
我想停止鼠标事件的传播,所以这就是我尝试过的事情
myAnnotsQ13D = getAnnots3D(0)[0];
if(myAnnotsQ13D.activated){
c3D = myAnnotsQ13D.context3D;
mouseEventHandler = c3D.MouseEventHandler();
mouseEventHandler.onMouseDown = true;
mouseEventHandler.onMouseMove = true;
mouseEventHandler.onMouseUp = true;
mouseEventHandler.onEvent = function(event){
event.stopAllDispatch = true;
}
c3D.runtime.addEventHandler( mouseEventHandler );
}
此代码似乎没有做任何事情。我仍然可以用鼠标旋转模型。有什么建议吗?
答案 0 :(得分:0)
来自linkedin 3DPDF论坛的答案,像魅力一样工作
myAnnotsQ13D = getAnnots3D(0)[0];
if(myAnnotsQ13D.activated){
c3D = myAnnotsQ13D.context3D;
c3D.runtime.overrideRotateTool = true; // add these two lines to disable mouse tumbling
c3D.runtime.overrideSpinTool = true;
mouseEventHandler = c3D.MouseEventHandler();
mouseEventHandler.onMouseDown = false;
mouseEventHandler.onMouseMove = false;
mouseEventHandler.onMouseUp = true
mouseEventHandler.onEvent = function(event){
var field = getField("NoOfClicksIM");
field.value = ++noOfClicksIM;
}
c3D.runtime.addEventHandler( mouseEventHandler );
}