zyy-engine

图形引擎API


事件回调

<h1>事件回调</h1> <h2>构造函数</h2> <pre><code class="language-javascript">new BCore2DFast.Viewer.Viewer2D(config)</code></pre> <h3>参数</h3> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>config</td> <td>BCore2DFast.Viewer.Viewer2DConfig</td> <td>三维模型视图对象的配置</td> </tr> </tbody> </table> <h3>方法</h3> <ul> <li><code>addEventListener(eventType: string, callback: Function)</code> : 增加事件监听</li> <li><code>removeEventListener(eventType: string, callBack: Function)</code> : 移除事件监听</li> </ul> <h4>示例代码</h4> <pre><code class="language-javascript">var mApplication2DConfig = new BCore2DFast.Application.Application2DConfig(); var mApplication2D = new BCore2DFast.Application.Application2D(mApplication2DConfig); var mViewer2D = new BCore2DFast.Viewer.Viewer2D('bcorecontainer-2d', new BCore2DFast.Viewer.Viewer2DConfig()); mApplication2D.addViewer2D(mViewer2D); mViewer2D.addEventListener(BCore2DFast.Static.EventType.AddDrawingEnd, (data) =&amp;gt; { console.log('模型加载成功'); });</code></pre> <h4>事件类型</h4> <table> <thead> <tr> <th>事件类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>BCore2DFast.Static.EventType.AddDrawingBegin</code></td> <td>加载图纸开始</td> </tr> <tr> <td><code>BCore2DFast.Static.EventType.AddDrawingProgress</code></td> <td>加载图纸中,返回加载进度</td> </tr> <tr> <td><code>BCore2DFast.Static.EventType.AddDrawingEnd</code></td> <td>加载图纸结束</td> </tr> <tr> <td><code>BCore2DFast.Static.EventType.SavePostilScreenShot</code></td> <td>保存批注快照</td> </tr> <tr> <td><code>BCore2DFast.Static.EventType.TokenInvalid</code></td> <td>token无效</td> </tr> <tr> <td><code>BCore2DFast.Static.EventType.LayoutChange</code></td> <td>布局切换</td> </tr> </tbody> </table> <h3>使用指南</h3> <ol> <li><strong>实例化配置</strong>:创建 <code>Application2DConfig</code> 和 <code>Viewer2DConfig</code> 的实例。</li> <li><strong>创建应用和查看器</strong>:使用配置实例创建应用和查看器。</li> <li><strong>事件监听</strong>:为视图添加事件监听器以处理不同的事件。</li> </ol> <hr />

页面列表

ITEM_HTML