简体   繁体   English

3D PDF acrobat javascript

[英]3D PDF acrobat javascript

I am using acrobat js to change the default mouse behaviour on 3D annotations. 我正在使用acrobat js更改3D注释上的默认鼠标行为。 I have defined six primary views and I want the user to view the model from these views only. 我已经定义了六个主要视图,并且我希望用户仅从这些视图中查看模型。 The default tumbling of the model with the mouse should be disabled. 应该禁用使用鼠标进行模型的默认翻滚。 I want the user to still be able to make use of other functionality offered by the 3D annotation toolbar. 我希望用户仍然能够使用3D注释工具栏提供的其他功能。

I thought of stopping the propagation of mouse event, so here's what I tried 我想停止传播鼠标事件,所以这是我尝试过的

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 );
}

This code doesn't seem to do anything. 该代码似乎没有任何作用。 I am still able to rotate the model with the mouse. 我仍然可以使用鼠标旋转模型。 Any suggestions? 有什么建议么?

Got the answer from linkedin 3DPDF forum, Works like a charm 得到了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 );
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM