如何在Autodesk Forge中创建二级上下文菜单 [英] How to create two level context menu in autodesk forge

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

问题描述

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

可以在此处找到完整的示例:level context menu image what 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中创建二级上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆