本文介绍了如何在Autodesk Forge中创建二级上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建两个级别的上下文菜单,但是对此没有api.

可以在此处找到完整的示例: DataContextMenu.js

I want to creat two level context menu but there is no api for this.Just look like thislevel context menu imagewhat I can do?

解决方案

It is rather straighforward to acheive a multi level context menu by deriving from Autodesk.Viewing.UI.ObjectContextMenu. Simply provide an array in the target field:

buildMenu (event, node) {

  var menu = []

  switch (node.type) {

    case 'hubs':

      menu.push({
        title: 'Show details',
        className: 'fa fa-share',
        target: [{
          title: 'Hub details',
          className: 'fa fa-cloud',
          target: () => {
            this.emit('context.details', {
              event, node, type: 'hubs'
            })
          }
        }, {
          title: 'Projects details',
          className: 'fa fa-folder',
          target: () => {
            this.emit('context.details', {
              event, node, type: 'hubs.projects'
            })
          }
        }]
      })

      break

A complete example of this can be found here: DataContextMenu.js

这篇关于如何在Autodesk Forge中创建二级上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:13
查看更多