重新排列上下文菜单,并在Forge Viewer中添加分隔符



有没有办法重新排列上下文菜单项的顺序,并可能在它们之间添加分隔符进行分组?

我关注了这篇文章https://forge.autodesk.com/blog/customize-viewer-context-menu以制作自定义上下文菜单。

对于分隔器,我在源代码中找到了功能:

menu.push({divider: true})

contextMenu中show((的源代码片段:

for (var i = 0; i < menu.length; ++i) {
var defn = menu[i],
title = defn.title,
target = defn.target,
icon = defn.icon,
shortcut = defn.shortcut,
divider = defn.divider;
var hasChildren = Array.isArray(target);
if (hasChildren && !menu.isChild) {
addExpandDiv = true; // Keep track of any item that is expandable
} else {
// As described in the design, limit the the number of menu levels to two.
// We will flatten the target array
hasChildren = false;
}
if (divider) {
menuItem = this.createDivider();
menuDiv.appendChild(menuItem);
} else {

相关内容

最新更新